From d3d8a9772777b4fe27bfad0049f0a8a0399e9882 Mon Sep 17 00:00:00 2001 From: Chris Paul Date: Sat, 27 Jan 2018 13:51:02 -0800 Subject: [PATCH 01/65] cleaning (#1096) --- indent/javascript.vim | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/indent/javascript.vim b/indent/javascript.vim index e4cf6866..a87d8e20 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -269,10 +269,7 @@ function s:OneScope() return s:Pure('s:PreviousToken') != '.' elseif strpart(getline('.'),col('.')-2,2) == '=>' call cursor(0,col('.')-1) - if s:PreviousToken() == ')' - return s:GetPair('(', ')', 'bW', s:skip_expr) - endif - return 1 + return s:PreviousToken() != ')' || s:GetPair('(', ')', 'bW', s:skip_expr) endif endfunction @@ -374,7 +371,7 @@ function GetJavascriptIndent() if s:PreviousToken() is '' return endif - let [l:lnum, pline] = [line('.'), getline('.')[:col('.')-1]] + let [l:lnum, lcol, pline] = getpos('.')[1:2] + [getline('.')[:col('.')-1]] let l:line = substitute(l:line,'^\s*','','') let l:line_raw = l:line @@ -427,7 +424,7 @@ function GetJavascriptIndent() endif endif if idx == -1 && pline[-1:] !~ '[{;]' - call cursor(l:lnum, len(pline)) + call cursor(l:lnum, lcol) let sol = matchstr(l:line,s:opfirst) if sol is '' || sol == '/' && s:SynAt(v:lnum, \ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex' @@ -443,10 +440,11 @@ function GetJavascriptIndent() else let is_op = s:sw() endif - call cursor(l:lnum, len(pline)) + call cursor(l:lnum, lcol) let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw() endif - elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U')) + elseif idx == -1 && s:LookingAt() == '(' && &cino =~ '(' && + \ (search('\m\S','nbW',num) || s:ParseCino('U')) let pval = s:ParseCino('(') if !pval let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')] From e110653ae74065f4dee48867713e12627a2d8509 Mon Sep 17 00:00:00 2001 From: Chris Paul Date: Fri, 2 Feb 2018 18:14:06 -0800 Subject: [PATCH 02/65] fix for unnested js in