Skip to content

limiting for slow function and operator fix #455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 2, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions indent/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,18 @@ endfunction
" Find if the string is inside var statement (but not the first string)
function s:InMultiVarStatement(lnum, cont, prev)
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
let cont = a:cont
let prev = a:prev

" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')

" loop through previous expressions to find a var statement
while lnum > 0 && (s:Match(lnum, s:comma_last) ||(a:cont && getline(lnum) =~ s:line_pre . '}') ||
while lnum > 0 && (s:Match(lnum, s:comma_last) ||(cont && getline(lnum) =~ s:line_pre . '[]})]') ||
\ s:Match(lnum,s:continuation_regex)) || (prev && (s:Match(prev, s:comma_last) ||
\ s:Match(prev,s:continuation_regex)))
" if the line is a js keyword
if a:cont
if cont
let cont = 0
call cursor(lnum,1)
let parlnum = s:lookForParens('(\|{\|\[', ')\|}\|\]', 'nbW', 0)
if parlnum > 0
Expand Down Expand Up @@ -381,7 +383,9 @@ function GetJavascriptIndent()
if parlnum > 0 && s:Match(parlnum, s:operator_first)
return indent(parlnum)
end
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
elseif (counts[0] != '1' && counts[1] != '1' && counts[2] != '1') &&
\ (!s:Match(s:PrevNonBlankNonString(lnum - 1), s:block_regex) ||
\ s:Match(lnum, s:var_stmt))
" otherwise, indent 1 level
return indent(lnum) + s:sw()
end
Expand Down