diff options
Diffstat (limited to 'indent/svelte.vim')
-rw-r--r-- | indent/svelte.vim | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/indent/svelte.vim b/indent/svelte.vim index 147df65b..bae715df 100644 --- a/indent/svelte.vim +++ b/indent/svelte.vim @@ -119,7 +119,7 @@ function! GetSvelteIndent() let cursyns = s:SynsSOL(v:lnum) let cursyn = get(cursyns, 0, '') - if s:SynHTML(cursyn) + if s:SynHTML(cursyn) && !s:IsMultipleLineSvelteExpression(curline, cursyns) call s:Log('syntax: html') let ind = XmlIndentGet(v:lnum, 0) if prevline =~? s:empty_tag @@ -233,6 +233,20 @@ function! s:SynHTML(syn) return a:syn ==? 'htmlSvelteTemplate' endfunction +function! s:IsMultipleLineSvelteExpression(curline, syns) + if a:curline =~ '^\s*{.*}\s*$' + return 0 + endif + + for syn in a:syns + if syn ==? 'svelteExpression' + return 1 + endif + endfor + + return 0 +endfunction + function! s:SynBlockBody(syn) return a:syn ==? 'svelteBlockBody' endfunction |