Skip to content

Commit 56dea5e

Browse files
author
Robin Allen
committed
Fix case where line ends with [ within (
The opening square bracket would be treated as if it were an argument to a function call delimited by the enclosing parentheses. This adds square brackets to the already-existing special case which handles braces in this context. Examples: 1. var a = [ x but: var a = ([ x 2. var a = fn({ // braces already handled correctly x: y but: var a = fn([ x
1 parent ccdf8b7 commit 56dea5e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

indent/javascript.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ let s:msl_regex = '\%([\\*+/.:([]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_
5757
let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term
5858

5959
" Regex that defines blocks.
60-
let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
60+
let s:block_regex = '\%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
6161

6262
let s:var_stmt = '^\s*var'
6363

0 commit comments

Comments
 (0)