summaryrefslogtreecommitdiffstats
path: root/indent/svelte.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2022-03-12 15:46:18 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2022-03-12 15:46:18 +0100
commita4f98d2a9e9dfeb110d4a910ea177432fec88b81 (patch)
tree0da567e3f00dd1da076f5fb45331c24e4a90a646 /indent/svelte.vim
parent83422e0a1fcfc88f3475104b0e0674e8dbe3130e (diff)
downloadvim-polyglot-a4f98d2a9e9dfeb110d4a910ea177432fec88b81.tar.gz
vim-polyglot-a4f98d2a9e9dfeb110d4a910ea177432fec88b81.zip
Update
Diffstat (limited to 'indent/svelte.vim')
-rw-r--r--indent/svelte.vim16
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