mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-11-01 18:12:19 +08:00
Merge pull request #42 from leafOfTree/fix-indent-error
Fix undefined a:block in indent
This commit is contained in:
4 files changed
+49
-1
No files matched your search
+1
-1
@@ -122,7 +122,6 @@ function! s:PrevNonBlankNonComment(lnum)
|
||||
endfunction
|
||||
|
||||
function! s:AdjustBlockIndent(syntax, ind)
|
||||
let block = a:block
|
||||
let syntax = a:syntax
|
||||
let ind = a:ind
|
||||
|
||||
@@ -173,6 +172,7 @@ function! s:PrevMultilineEmptyTag(lnum)
|
||||
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
return [0, 0]
|
||||
endfunction
|
||||
|
||||
function! s:AdjustHTMLIndent(ind)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
" GetVueIndent() for each line without errors
|
||||
let g:test_flatten = 1
|
||||
|
||||
function! Check()
|
||||
call ExpectIndentEachLine()
|
||||
endfunction
|
||||
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<div
|
||||
class="a"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
>
|
||||
<p :class="{ a: b }">x</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return { a: 1 }
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
p {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@@ -91,6 +91,24 @@ function! ExpectTag(lnum, tag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Call GetVueIndent() for each non-blank line from line 2 as when typing it,
|
||||
" which shows errors hidden by 'indentexpr', and check the indent
|
||||
function! ExpectIndentEachLine()
|
||||
for lnum in range(2, line('$'))
|
||||
if getline(lnum) =~ '^\s*$'
|
||||
continue
|
||||
endif
|
||||
call cursor(lnum, 1)
|
||||
let v:lnum = lnum
|
||||
try
|
||||
call ExpectEqual(GetVueIndent(), indent(lnum),
|
||||
\ printf('GetVueIndent() at line %d', lnum))
|
||||
catch
|
||||
call Fail(printf('GetVueIndent() at line %d: %s', lnum, v:exception))
|
||||
endtry
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
if filereadable(s:case.'.vim')
|
||||
execute 'source '.fnameescape(s:case.'.vim')
|
||||
endif
|
||||
|
||||
Reference in new issue
Block a user