[java mode] Fix indentation after class extends clause

Closes https://github.com/codemirror/codemirror5/issues/7049
This commit is contained in:
Marijn Haverbeke 2023-07-15 08:59:15 +02:00
parent a0854c752a
commit 69e38f574c
2 changed files with 7 additions and 1 deletions

View File

@ -218,7 +218,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine && isTopScope(state.context))
return CodeMirror.Pass;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
var closing = firstChar == ctx.type;
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;

View File

@ -162,4 +162,9 @@
"[type StringBuffer];",
"[type StringBuilder];",
"[type Void];");
MTJAVA("indent",
"[keyword public] [keyword class] [def A] [keyword extends] [variable B]",
"{",
" [variable c]()")
})();