Skip to content

Commit 5453eb0

Browse files
authored
more string/comment cleaning
1 parent ce7c06c commit 5453eb0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

indent/javascript.vim

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,15 @@ function GetJavascriptIndent()
159159
let syns = synIDattr(synID(v:lnum, 1, 0), 'name')
160160

161161
" start with strings,comments,etc.
162-
if l:line !~ '^[''"]' && syns =~? '\%(string\|template\)' ||
163-
\ l:line !~ '^\s*[/*]' && syns =~? s:syng_comment
162+
if syns =~? s:syng_comment
163+
if l:line =~ '^\s*\*'
164+
return cindent(v:lnum)
165+
elseif l:line !~ '^\s*\/'
166+
return -1
167+
endif
168+
elseif syns =~? '\%(string\|template\)' && l:line !~ '^[''"]'
164169
return -1
165170
endif
166-
if l:line =~ '^\s*\*' && syns =~? s:syng_comment
167-
return cindent(v:lnum)
168-
endif
169171
let l:lnum = s:PrevCodeLine(v:lnum - 1)
170172
if l:lnum == 0
171173
return 0

0 commit comments

Comments
 (0)