@@ -186,15 +186,17 @@ function GetJavascriptIndent()
186
186
if line = ~ s: line_pre . ' [])}]'
187
187
return indent (num)
188
188
endif
189
- let inb = num == 0 ? 1 : s: Onescope (num, s: StripLine (strpart (getline (num),0 ,b: js_cache [2 ] - 1 )),1 )
189
+
190
+ let pline = s: StripLine (getline (lnum))
191
+ let inb = num == 0 ? 1 : s: Onescope (num, s: StripLine (strpart (getline (num),0 ,b: js_cache [2 ] - 1 )),1 ) ||
192
+ \ (num < lnum && (line !~ s: line_pre . ' ,' && pline !~ ' ,' . s: line_term ))
190
193
let switch_offset = (! inb || num == 0 ) || expand (" <cword>" ) !=# ' switch' ? 0 : &cino !~ ' :' || ! has (' float' ) ? s: sw () :
191
194
\ float2nr (str2float (matchstr (&cino ,' .*:\zs[-0-9.]*' )) * (match (&cino ,' .*:\zs[^,]*s' ) ? s: sw () : 1 ))
192
- let pline = s: StripLine (getline (lnum))
193
- if ((line = ~# g: javascript_opfirst ||
194
- \ (pline = ~# g: javascript_continuation && pline !~# s: expr_case &&
195
- \ (pline !~ ' :' . s: line_term || line !~#
196
- \ s: line_pre . ' \%(d\%(o\|ebugger\)\|else\|f\%(or\|inally\)\|if\|let\|switch\|t\%(hrow\|ry\)\|w\%(hile\|ith\)\)\>' ))) &&
197
- \ inb) || (s: Onescope (lnum,pline,0 ) && line !~ s: line_pre . ' {' )
195
+
196
+ if (inb && (line = ~# g: javascript_opfirst ||
197
+ \ (pline = ~# g: javascript_continuation && pline !~# s: expr_case && (pline !~ ' :' . s: line_term || line !~#
198
+ \ s: line_pre . ' \%(d\%(o\|ebugger\)\|else\|f\%(or\|inally\)\|if\|let\|switch\|t\%(hrow\|ry\)\|w\%(hile\|ith\)\)\>' )))) ||
199
+ \ (num < lnum && s: Onescope (lnum,pline,0 ) && line !~ s: line_pre . ' {' )
198
200
return (num > 0 ? indent (num) : - s: sw ()) + (s: sw () * 2 ) + switch_offset
199
201
elseif num > 0
200
202
return indent (num) + s: sw () + switch_offset
0 commit comments