Skip to content

Commit

Permalink
Skip comma
Browse files Browse the repository at this point in the history
  • Loading branch information
arronzhang committed Dec 4, 2011
1 parent 7b2f2ef commit f476e3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 12 additions & 6 deletions javascript.vim
Expand Up @@ -116,7 +116,8 @@ function s:GetLineBlockStart(lnum)
let msl = -1
" let lnum = s:PrevNonBlankNonString(a:lnum)
let lnum = a:lnum
let dotline = ""
let commaline = ""
let notcomma = 0
while lnum > 0
" If we have a continuation line, or we're in a string, use line as MSL.
" Otherwise, terminate search as we have found our MSL already.
Expand All @@ -129,14 +130,19 @@ function s:GetLineBlockStart(lnum)

" call confirm("col: " . col . ":" . lnum . ":" . line[col] )
if (col > 0 && !s:IsInStringOrComment(lnum, col)) || (col2 > 0 && !s:IsInStringOrComment(lnum2, col2)) || s:IsInString(lnum, strlen(line))
let msl = lnum2
let lnum = lnum2
" call confirm("col: " . col . " col2:" . col2)
" , only indent after var..
if (col > 0 && (match(line, '^\s*,') + 1) > 0) || (col2 > 0 && (match(line2, ',' . s:line_term) + 1) > 0)
let dotline = line2
" call confirm("ok: " . dotline . ":" . line2)
if !notcomma
" call confirm("l: " . lnum)
let commaline = line2
end
" call confirm("ok: " . commaline . ":" . line2)
else
let notcomma = 1
endif
let msl = lnum2
let lnum = lnum2
else
"Skip block
let lnum2 = s:GetBlockStart(lnum)
Expand All @@ -146,7 +152,7 @@ function s:GetLineBlockStart(lnum)
let msl = lnum2
endif
else
if strlen(dotline) && match(dotline, '^\s*var') == -1
if strlen(commaline) && match(commaline, '^\s*var') == -1
" call confirm("ok3: ")
return -1
endif
Expand Down
6 changes: 4 additions & 2 deletions test/line.js
Expand Up @@ -59,8 +59,10 @@ function line(){
}, 100);
})
, email: type.string()
.email(),
pass: type.string()
.trim()
.email(),
pass: type.string().
trim()
});
}

0 comments on commit f476e3d

Please sign in to comment.