Skip to content

Commit d0a4aa4

Browse files
authored
more regex (#608)
1 parent 67f2990 commit d0a4aa4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

indent/javascript.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ else
3737
endfunction
3838
endif
3939

40-
let s:line_pre = '^\s*\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\='
40+
let s:line_pre = '^\s*\%(\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\=\)\@>'
4141
let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:'
4242
" Regex of syntax group names that are or delimit string or are comments.
4343
let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'
@@ -83,7 +83,7 @@ endfunction
8383
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
8484
function s:IsBlock()
8585
return getline(line('.'))[col('.')-1] == '{' && !search(
86-
\ '\C\%(\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|\<in\%(stanceof\)\=\)\)\_s*\|\<return\s*\)\%#','bnW') &&
86+
\ '\C\%(\<return\s*\|\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|\<in\%(stanceof\)\=\)\)\_s*\)\%#','bnW') &&
8787
\ (!search(':\_s*\%#','bW') || (!s:GetPair('[({[]','[])}]','bW',200) || s:IsBlock()))
8888
endfunction
8989

0 commit comments

Comments
 (0)