Merge pull request #42 from leafOfTree/fix-indent-error

Fix undefined a:block in indent
This commit is contained in:
leaf authored and GitHub committed 2026-10-21 20:21:14 +08:00
commit fc45b47958
4 files changed
+49 -1

No files matched your search

+1 -1
View File
@@ -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)
+6
View File
@@ -0,0 +1,6 @@
" GetVueIndent() for each line without errors
let g:test_flatten = 1
function! Check()
call ExpectIndentEachLine()
endfunction
+24
View File
@@ -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>
+18
View File
@@ -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