@@ -69,9 +69,9 @@ let s:msl_regex = s:continuation_regex.'\|'.s:expr_case
6969let s: one_line_scope_regex = ' \%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(.*)\)\|=>\)' . s: line_term
7070
7171" Regex that defines blocks.
72- let s: block_regex = ' \%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s: line_term
72+ let s: block_regex = ' \%([{( []\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s: line_term
7373
74- let s: var_stmt = ' ^\s*(const\|let\|var)'
74+ let s: var_stmt = ' ^\s*\% (const\|let\|var\ )'
7575
7676let s: comma_first = ' ^\s*,'
7777let s: comma_last = ' ,\s*$'
@@ -240,7 +240,7 @@ function s:LineHasOpeningBrackets(lnum)
240240 endif
241241 let pos = match (line , ' [][(){}]' , pos + 1 )
242242 endwhile
243- return (open_0 > 0 ) . (open_2 > 0 ) . (open_4 > 0 )
243+ return (open_0 > 0 ? 1 : (open_0 == 0 ? 0 : 2 ) ) . (open_2 > 0 ) . (open_4 > 0 )
244244endfunction
245245
246246function s: Match (lnum, regex)
@@ -448,7 +448,19 @@ function GetJavascriptIndent()
448448 else
449449 call cursor (v: lnum , vcol)
450450 end
451- endif
451+ elseif line = ~ ' )' || line = ~ s: comma_last
452+ let counts = s: LineHasOpeningBrackets (lnum)
453+ if counts[0 ] == ' 2'
454+ call cursor (lnum, 1 )
455+ " Search for the opening tag
456+ let mnum = searchpair (' (' , ' ' , ' )' , ' bW' , s: skip_expr )
457+ if mnum > 0
458+ return indent (s: GetMSL (mnum, 0 ))
459+ end
460+ elseif line !~ s: var_stmt
461+ return indent (prevline)
462+ end
463+ end
452464
453465 " 3.4. Work on the MSL line. {{{2
454466 " --------------------------
0 commit comments