Skip to content

Commit c11f34f

Browse files
committed
[clike mode] Simplify hooks.indent interface
Issue codemirror#5487
1 parent e338ab2 commit c11f34f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mode/clike/clike.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
222222
while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
223223
ctx = ctx.prev
224224
if (hooks.indent) {
225-
var hook = hooks.indent(state, ctx, textAfter, indentUnit, closing);
225+
var hook = hooks.indent(state, ctx, textAfter, indentUnit);
226226
if (typeof hook == "number") return hook
227227
}
228228
var switchBlock = ctx.prev && ctx.prev.info == "switch";
@@ -632,7 +632,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
632632
state.tokenize = tokenKotlinString(stream.match('""'));
633633
return state.tokenize(stream, state);
634634
},
635-
indent: function(state, ctx, textAfter, indentUnit, closing) {
635+
indent: function(state, ctx, textAfter, indentUnit) {
636636
var firstChar = textAfter && textAfter.charAt(0);
637637
if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "")
638638
return state.indented;
@@ -641,7 +641,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
641641
(state.prevToken == "}" || state.prevToken == ")") && firstChar == ".")
642642
return indentUnit * 2 + ctx.indented;
643643
if (ctx.align && ctx.type == "}")
644-
return ctx.indented + (closing ? 0 : indentUnit);
644+
return ctx.indented + (state.context.type == (textAfter || "").charAt(0) ? 0 : indentUnit);
645645
}
646646
},
647647
modeProps: {closeBrackets: {triples: '"'}}

0 commit comments

Comments
 (0)