Skip to content

Commit 69e38f5

Browse files
committed
[java mode] Fix indentation after class extends clause
Closes #7049
1 parent a0854c7 commit 69e38f5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

mode/clike/clike.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
218218
},
219219

220220
indent: function(state, textAfter) {
221-
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
221+
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine && isTopScope(state.context))
222+
return CodeMirror.Pass;
222223
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
223224
var closing = firstChar == ctx.type;
224225
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;

mode/clike/test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,9 @@
162162
"[type StringBuffer];",
163163
"[type StringBuilder];",
164164
"[type Void];");
165+
166+
MTJAVA("indent",
167+
"[keyword public] [keyword class] [def A] [keyword extends] [variable B]",
168+
"{",
169+
" [variable c]()")
165170
})();

0 commit comments

Comments
 (0)