Skip to content

Commit a6c58e9

Browse files
committed
working detection of object/array properties (#460)
* working detection of object properties the previous method is likely slower and doesn't really work * fun args supported also add support for func args
1 parent 07d2112 commit a6c58e9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

indent/javascript.vim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,8 @@ function GetJavascriptIndent()
383383
if parlnum > 0
384384
return !s:Match(parlnum, s:operator_first) ? indent(lnum) + s:sw() : indent(parlnum)
385385
end
386-
elseif (counts[0] != '1' && counts[1] != '1' && counts[2] != '1') &&
387-
\ (!s:Match(s:PrevNonBlankNonString(lnum - 1), s:block_regex) ||
388-
\ s:Match(lnum, s:var_stmt))
386+
elseif line !~ s:line_pre . ',\s*\%(\%(\([''"]\).*\1\)\|\%(\h\w*\)\)\s*:.*' . s:line_term &&
387+
\ synIDattr(synID(v:lnum, 1, 1), 'name') !~? 'jsbracket\|jsparen'
389388
" otherwise, indent 1 level
390389
return indent(lnum) + s:sw()
391390
end

0 commit comments

Comments
 (0)