Skip to content
Browse files

[javascript&clike modes] Indent block comments with CodeMirror.Pass

This'll align them with the previous line. It's not a perfect solution,
but probably better than simply returning 0.

Issue #854
  • Loading branch information...
1 parent cede207 commit 45f85d3a6701e876f6502ee054509ecdfd621374 @marijnh marijnh committed Sep 28, 2012
Showing with 2 additions and 0 deletions.
  1. +1 −0 mode/clike/clike.js
  2. +1 −0 mode/javascript/javascript.js
View
1 mode/clike/clike.js
@@ -140,6 +140,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
},
indent: function(state, textAfter) {
+ if (state.tokenize == tokenComment) return CodeMirror.Pass;
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
View
1 mode/javascript/javascript.js
@@ -340,6 +340,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
},
indent: function(state, textAfter) {
+ if (state.tokenize == jsTokenComment) return CodeMirror.Pass;
if (state.tokenize != jsTokenBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;

0 comments on commit 45f85d3

Please sign in to comment.
Something went wrong with that request. Please try again.