Skip to content

Commit 05bec05

Browse files
committed
[javascript mode] Also count on semicolon omittance in var lists
Issue #898
1 parent e28462f commit 05bec05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mode/javascript/javascript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
322322
register(value);
323323
return isTS ? cont(maybetype, vardef2) : cont(vardef2);
324324
}
325-
return cont();
325+
return pass();
326326
}
327327
function vardef2(type, value) {
328328
if (value == "=") return cont(expression, vardef2);
@@ -388,7 +388,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
388388
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
389389
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
390390
var type = lexical.type, closing = firstChar == type;
391-
if (type == "vardef") return lexical.indented + 4;
391+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0);
392392
else if (type == "form" && firstChar == "{") return lexical.indented;
393393
else if (type == "form") return lexical.indented + indentUnit;
394394
else if (type == "stat")

0 commit comments

Comments
 (0)