diff --git a/indent/vue.vim b/indent/vue.vim index 5f3c60b..f4b1fe3 100644 --- a/indent/vue.vim +++ b/indent/vue.vim @@ -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) diff --git a/test/cases/indent-each-line.vim b/test/cases/indent-each-line.vim new file mode 100644 index 0000000..7c3977e --- /dev/null +++ b/test/cases/indent-each-line.vim @@ -0,0 +1,6 @@ +" GetVueIndent() for each line without errors +let g:test_flatten = 1 + +function! Check() + call ExpectIndentEachLine() +endfunction diff --git a/test/cases/indent-each-line.vue b/test/cases/indent-each-line.vue new file mode 100644 index 0000000..2c132d6 --- /dev/null +++ b/test/cases/indent-each-line.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/test/run.vim b/test/run.vim index beaa711..1179998 100644 --- a/test/run.vim +++ b/test/run.vim @@ -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