mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CPP-1843 Typing :: in switch case statement breaks indentation
This commit is contained in:
+3
-3
@@ -157,9 +157,9 @@ public class SemanticEditorPosition {
|
||||
|
||||
public void moveToLeftParenthesisBackwardsSkippingNested(@NotNull SyntaxElement leftParenthesis,
|
||||
@NotNull SyntaxElement rightParenthesis,
|
||||
@NotNull Condition<SyntaxElement> terminationCondition) {
|
||||
@NotNull Condition<SemanticEditorPosition> terminationCondition) {
|
||||
while (!myIterator.atEnd()) {
|
||||
if (terminationCondition.value(map(myIterator.getTokenType()))) {
|
||||
if (terminationCondition.value(this)) {
|
||||
break;
|
||||
}
|
||||
if (rightParenthesis.equals(map(myIterator.getTokenType()))) {
|
||||
@@ -174,7 +174,7 @@ public class SemanticEditorPosition {
|
||||
|
||||
public SemanticEditorPosition findLeftParenthesisBackwardsSkippingNested(@NotNull SyntaxElement leftParenthesis,
|
||||
@NotNull SyntaxElement rightParenthesis,
|
||||
@NotNull Condition<SyntaxElement> terminationCondition) {
|
||||
@NotNull Condition<SemanticEditorPosition> terminationCondition) {
|
||||
return copyAnd(
|
||||
position -> position.moveToLeftParenthesisBackwardsSkippingNested(leftParenthesis, rightParenthesis, terminationCondition));
|
||||
}
|
||||
|
||||
+3
-5
@@ -21,7 +21,6 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.lineIndent.LineIndentProvider;
|
||||
@@ -98,8 +97,7 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
|
||||
!position.after().matchesRule(
|
||||
p->p.isAtAnyOf(ArrayClosingBracket, BlockOpeningBrace, BlockClosingBrace, RightParenthesis) || p.isAtEnd()) &&
|
||||
position.findLeftParenthesisBackwardsSkippingNested(LeftParenthesis, RightParenthesis,
|
||||
element -> element == BlockClosingBrace || element == BlockOpeningBrace ||
|
||||
element == Semicolon)
|
||||
self -> self.isAtAnyOf(BlockClosingBrace, BlockOpeningBrace, Semicolon))
|
||||
.isAt(LeftParenthesis)) {
|
||||
return myFactory.createIndentCalculator(NONE, IndentCalculator.LINE_AFTER);
|
||||
}
|
||||
@@ -231,7 +229,7 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
|
||||
}
|
||||
}
|
||||
|
||||
private int getDeepBlockStatementStartOffset(@NotNull SemanticEditorPosition position) {
|
||||
protected int getDeepBlockStatementStartOffset(@NotNull SemanticEditorPosition position) {
|
||||
while (!(position.isAt(BlockOpeningBrace) || position.isAtEnd())) {
|
||||
position.moveBefore();
|
||||
}
|
||||
@@ -311,7 +309,7 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
|
||||
return true;
|
||||
}
|
||||
|
||||
protected SemanticEditorPosition getPosition(@NotNull Editor editor, int offset) {
|
||||
public SemanticEditorPosition getPosition(@NotNull Editor editor, int offset) {
|
||||
return SemanticEditorPosition.createEditorPosition((EditorEx)editor, offset,
|
||||
(_editor, _offset) -> getIteratorAtPosition(_editor, _offset),
|
||||
tokenType -> mapType(tokenType));
|
||||
|
||||
Reference in New Issue
Block a user