Skip to content

Commit 734cdfc

Browse files
committed
Improve one line scope
pangloss#293 this will detect the start and end parentheses,allowing statements with parentheses to come after the condition parens.This regex can detect with up to 4 levels of nesting.
1 parent 2881bba commit 734cdfc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

indent/javascript.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\|[^=]
6666
" TODO: this needs to deal with if ...: and so on
6767
let s:msl_regex = s:continuation_regex.'\|'.s:expr_case
6868

69-
let s:one_line_scope_regex = '\%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(.*)\)\|=>\)' . s:line_term
69+
let s:one_line_scope_regex = '\%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*([^()]*)[^()]*\))[^()]*\))[^()]*\))\)\|=>\)' . s:line_term
7070

7171
" Regex that defines blocks.
7272
let s:block_regex = '\%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term

0 commit comments

Comments
 (0)