Skip to content

Commit 5923f80

Browse files
authored
comment on performance, angle brackets
1 parent ee3183e commit 5923f80

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

indent/javascript.vim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ let s:line_term = '\s*\%(\/\*.*\*\/\s*\)*\%(:\@<!\/\/.*\)\=$'
6161

6262
" configurable regexes that define continuation lines, not including (, {, or [.
6363
if !exists('g:javascript_opfirst')
64-
let g:javascript_opfirst = '\%([,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)\C'
64+
let g:javascript_opfirst = '\%([<>,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)\C'
6565
endif
6666
let g:javascript_opfirst = s:line_pre . g:javascript_opfirst
6767

6868
if !exists('g:javascript_continuation')
69-
let g:javascript_continuation = '\%([*,.?:^%]\|+\@<!+\|-\@<!-\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)\C'
69+
let g:javascript_continuation = '\%([<*,.?:^%]\|+\@<!+\|-\@<!-\|=\@<!>\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)\C'
7070
endif
7171
let g:javascript_continuation .= s:line_term
7272

@@ -155,7 +155,8 @@ function GetJavascriptIndent()
155155
endif
156156
"}}}
157157

158-
" the containing paren, bracket, curly
158+
" the containing paren, bracket, curly. Memoize, last lineNr either has the
159+
" same scope or starts a new one, unless if it closed a scope.
159160
let pcounts = [0]
160161
if b:js_cache[0] >= lnum && b:js_cache[0] <= v:lnum && b:js_cache[0] &&
161162
\ (b:js_cache[0] > lnum || map(pcounts,'s:LineHasOpeningBrackets(lnum)')[0][0] !~ '2')

0 commit comments

Comments
 (0)