diff --git a/mode/clike/clike.js b/mode/clike/clike.js index dc20003c2b94ab7212eb2dd08dfb2d8521e6ab57..0f24bb8497be88c4c01801eef395d421bf0c5c03 100644 --- a/mode/clike/clike.js +++ b/mode/clike/clike.js @@ -20,7 +20,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { blockKeywords = parserConfig.blockKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks || {}, - multiLineStrings = parserConfig.multiLineStrings; + multiLineStrings = parserConfig.multiLineStrings, + indentStatements = parserConfig.indentStatements !== false; var isOperatorChar = /[+\-*&%=<>!?|\/]/; var curPunc; @@ -151,7 +152,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { while (ctx.type == "statement") ctx = popContext(state); } else if (curPunc == ctx.type) popContext(state); - else if (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || (ctx.type == "statement" && curPunc == "newstatement")) + else if (indentStatements && + (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || + (ctx.type == "statement" && curPunc == "newstatement"))) pushContext(state, stream.column(), "statement"); state.startOfLine = false; return style; @@ -385,6 +388,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { multiLineStrings: true, blockKeywords: words("catch class do else finally for forSome if match switch try while"), atoms: words("true false null"), + indentStatements: false, hooks: { "@": function(stream) { stream.eatWhile(/[\w\$_]/);