mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-03-06 23:24:59 +08:00
Fix script fold issue
This commit is contained in:
@@ -37,7 +37,7 @@ function! GetVueFold(lnum)
|
|||||||
|
|
||||||
" For <script> block
|
" For <script> block
|
||||||
if GetVueTag(a:lnum) == 'script'
|
if GetVueTag(a:lnum) == 'script'
|
||||||
let value = s:GetVueFoldForScript(a:lnum, this_line, this_indent)
|
let value = s:FoldForScript(a:lnum, this_line, this_indent)
|
||||||
else
|
else
|
||||||
let value = this_indent
|
let value = this_indent
|
||||||
endif
|
endif
|
||||||
@@ -46,23 +46,23 @@ function! GetVueFold(lnum)
|
|||||||
return value
|
return value
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:GetVueFoldForScript(lnum, this_line, this_indent)
|
function! s:FoldForScript(lnum, this_line, this_indent)
|
||||||
let value = -2
|
let value = -2
|
||||||
if a:lnum > 1
|
if a:lnum > 1
|
||||||
let prev_indent = s:IndentLevel(a:lnum - 1)
|
let prev_indent = s:IndentLevel(a:lnum - 1)
|
||||||
else
|
else
|
||||||
let prev_indent = 0
|
let prev_indent = 0
|
||||||
endif
|
endif
|
||||||
let next_indent = s:IndentLevel(nextnonblank(a:lnum))
|
let next_indent = s:IndentLevel(nextnonblank(a:lnum + 1))
|
||||||
|
|
||||||
if a:this_line =~ '[]})],\?\s*$'
|
if a:this_line =~ '^\s*[]})]\+,\?\s*$'
|
||||||
" Closing ']})'
|
" Closing ']})'
|
||||||
let value = '<'.prev_indent
|
let value = '<'.prev_indent
|
||||||
elseif a:this_indent < next_indent
|
elseif a:this_indent < next_indent
|
||||||
" --this
|
" --this
|
||||||
" ----next
|
" ----next
|
||||||
let value = '>'.next_indent
|
let value = '>'.next_indent
|
||||||
elseif a:this_indent >= next_indent
|
else
|
||||||
" ----this
|
" ----this
|
||||||
" --next
|
" --next
|
||||||
let value = a:this_indent
|
let value = a:this_indent
|
||||||
|
|||||||
Reference in New Issue
Block a user