@@ -83,7 +83,7 @@ endfunction
83
83
84
84
" strip line of comment
85
85
function s: StripLine (c )
86
- return substitute (a: c , ' \%(:\@<!\/\/.*\)$' , ' ' ,' ' )
86
+ return a: c !~ s: expr_case ? substitute (a: c , ' \%(:\@<!\/\/.*\)$' , ' ' ,' ' ) : a: c
87
87
endfunction
88
88
89
89
" Check if the character at lnum:col is inside a string, comment, or is ascii.
@@ -147,7 +147,6 @@ function GetJavascriptIndent()
147
147
if lnum == 0
148
148
return 0
149
149
endif
150
- let line = s: StripLine (line )
151
150
152
151
if (line = ~# s: expr_case )
153
152
let cpo_switch = &cpo
@@ -164,15 +163,15 @@ function GetJavascriptIndent()
164
163
let pcounts = [0 ]
165
164
if b: js_cache [0 ] >= lnum && b: js_cache [0 ] <= v: lnum && b: js_cache [0 ] &&
166
165
\ (b: js_cache [0 ] > lnum || map (pcounts,' s:LineHasOpeningBrackets(lnum)' )[0 ] !~ ' 2' )
167
- let num = pcounts[0 ] = ~ ' 1' ? s: lookForParens (' (\|{\|\[ ' ,' )\|}\|\ ]' ,' bW' ,2000 ) : b: js_cache [1 ]
166
+ let num = pcounts[0 ] = ~ ' 1' ? s: lookForParens (' [({[] ' ,' [])} ]' ,' bW' ,2000 ) : b: js_cache [1 ]
168
167
else
169
168
let syns = synIDattr (synID (v: lnum , 1 , 1 ), ' name' )
170
169
if line [0 ] = ~ ' \s' && syns != ' '
171
170
let pattern = syns = ~? ' funcblock' ? [' {' ,' }' ] : syns = ~? ' jsparen' ? [' (' ,' )' ] : syns = ~? ' jsbracket' ? [' \[' ,' \]' ] :
172
- \ [' (\|{\|\[ ' ,' )\|}\|\ ]' ]
171
+ \ [' [({[] ' ,' [])} ]' ]
173
172
let num = s: lookForParens (pattern[0 ],pattern[1 ],' bW' ,2000 )
174
173
else
175
- let num = s: lookForParens (' (\|{\|\[ ' ,' )\|}\|\ ]' ,' bW' ,2000 )
174
+ let num = s: lookForParens (' [({[] ' ,' [])} ]' ,' bW' ,2000 )
176
175
endif
177
176
endif
178
177
let b: js_cache = [v: lnum ,num,line (' .' ) == v: lnum ? b: js_cache [2 ] : col (' .' )]
0 commit comments