@@ -69,9 +69,9 @@ let s:msl_regex = s:continuation_regex.'\|'.s:expr_case
69
69
let s: one_line_scope_regex = ' \%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(.*)\)\|=>\)' . s: line_term
70
70
71
71
" 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
73
73
74
- let s: var_stmt = ' ^\s*(const\|let\|var)'
74
+ let s: var_stmt = ' ^\s*\% (const\|let\|var\ )'
75
75
76
76
let s: comma_first = ' ^\s*,'
77
77
let s: comma_last = ' ,\s*$'
@@ -240,7 +240,7 @@ function s:LineHasOpeningBrackets(lnum)
240
240
endif
241
241
let pos = match (line , ' [][(){}]' , pos + 1 )
242
242
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 )
244
244
endfunction
245
245
246
246
function s: Match (lnum, regex)
@@ -448,7 +448,19 @@ function GetJavascriptIndent()
448
448
else
449
449
call cursor (v: lnum , vcol)
450
450
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
452
464
453
465
" 3.4. Work on the MSL line. {{{2
454
466
" --------------------------
0 commit comments