mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-02 00:57:59 +07:00
temporary fix for completion issue (IDEA-80056, EA-54248)
This commit is contained in:
+12
@@ -1384,6 +1384,18 @@ class Foo {{
|
||||
doMultiCaretTest()
|
||||
}
|
||||
|
||||
public void testFinishWithEqualsWhenMultipleCaretsAreEnabled() {
|
||||
EditorTestUtil.enableMultipleCarets()
|
||||
try {
|
||||
configureByFile("SpacesAroundEq.java");
|
||||
type('=');
|
||||
checkResultByFile("SpacesAroundEq_after.java");
|
||||
}
|
||||
finally {
|
||||
EditorTestUtil.disableMultipleCarets()
|
||||
}
|
||||
}
|
||||
|
||||
public void "test complete lowercase class name"() {
|
||||
myFixture.addClass("package foo; public class myClass {}")
|
||||
myFixture.configureByText "a.java", """
|
||||
|
||||
+24
-18
@@ -51,7 +51,7 @@ public class TypedAction {
|
||||
|
||||
private static class Handler implements TypedActionHandler {
|
||||
@Override
|
||||
public void execute(@NotNull Editor editor, char charTyped, @NotNull DataContext dataContext) {
|
||||
public void execute(@NotNull final Editor editor, char charTyped, @NotNull DataContext dataContext) {
|
||||
if (editor.isViewer()) return;
|
||||
|
||||
Document doc = editor.getDocument();
|
||||
@@ -64,7 +64,18 @@ public class TypedAction {
|
||||
try {
|
||||
final String str = String.valueOf(charTyped);
|
||||
CommandProcessor.getInstance().setCurrentCommandName(EditorBundle.message("typing.in.editor.command.name"));
|
||||
EditorModificationUtil.typeInStringAtCaretHonorBlockSelection(editor, str, true);
|
||||
|
||||
if (editor.getCaretModel().getAllCarets().size() == 1) { // temporary fix for completion - going forward we shouldn't use this check
|
||||
EditorModificationUtil.typeInStringAtCaretHonorBlockSelection(editor, str, true);
|
||||
}
|
||||
else {
|
||||
editor.getCaretModel().runForEachCaret(new CaretAction() {
|
||||
@Override
|
||||
public void perform(Caret caret) {
|
||||
EditorModificationUtil.typeInStringAtCaretHonorBlockSelection(editor, str, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (ReadOnlyFragmentModificationException e) {
|
||||
EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e);
|
||||
@@ -127,22 +138,17 @@ public class TypedAction {
|
||||
ApplicationManager.getApplication().runWriteAction(new DocumentRunnable(myEditor.getDocument(), myEditor.getProject()) {
|
||||
@Override
|
||||
public void run() {
|
||||
myEditor.getCaretModel().runForEachCaret(new CaretAction() {
|
||||
@Override
|
||||
public void perform(Caret caret) {
|
||||
Document doc = myEditor.getDocument();
|
||||
doc.startGuardedBlockChecking();
|
||||
try {
|
||||
getHandler().execute(myEditor, myCharTyped, myDataContext);
|
||||
}
|
||||
catch (ReadOnlyFragmentModificationException e) {
|
||||
EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e);
|
||||
}
|
||||
finally {
|
||||
doc.stopGuardedBlockChecking();
|
||||
}
|
||||
}
|
||||
});
|
||||
Document doc = myEditor.getDocument();
|
||||
doc.startGuardedBlockChecking();
|
||||
try {
|
||||
getHandler().execute(myEditor, myCharTyped, myDataContext);
|
||||
}
|
||||
catch (ReadOnlyFragmentModificationException e) {
|
||||
EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e);
|
||||
}
|
||||
finally {
|
||||
doc.stopGuardedBlockChecking();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user