From a4f98d2a9e9dfeb110d4a910ea177432fec88b81 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sat, 12 Mar 2022 15:46:18 +0100 Subject: Update --- indent/svelte.vim | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indent/svelte.vim') 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 -- cgit v1.2.3