Skip to content

Commit

Permalink
[javascript&clike modes] Indent block comments with CodeMirror.Pass
Browse files Browse the repository at this point in the history
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
marijnh committed Sep 28, 2012
1 parent cede207 commit 45f85d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions mode/clike/clike.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions mode/javascript/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 45f85d3

Please sign in to comment.