mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-198893 Parameter info hints: exception on undo
This commit is contained in:
+28
@@ -22,6 +22,8 @@ import com.intellij.psi.PsiExpressionCodeFragment;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.fixtures.EditorMouseFixture;
|
||||
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class CompletionHintsTest extends AbstractParameterInfoTestCase {
|
||||
private boolean myStoredSettingValue;
|
||||
|
||||
@@ -1637,6 +1639,32 @@ public class CompletionHintsTest extends AbstractParameterInfoTestCase {
|
||||
"<html><b>int c</b>, int d, int e</html>");
|
||||
}
|
||||
|
||||
public void testUndoRedoAfterOverloadSwitch() {
|
||||
configureJava("class C { void some(int a) {} void some(int a, int b) {} void m() { s<caret> } }");
|
||||
complete("some(int a)");
|
||||
type('1');
|
||||
showParameterInfo();
|
||||
methodOverloadDown();
|
||||
checkResultWithInlays("class C { void some(int a) {} void some(int a, int b) {} void m() { some(<Hint text=\"a:\"/>1, <HINT text=\"b:\"/><caret>); } }");
|
||||
EditorTestUtil.testUndoInEditor(getEditor(), () -> {
|
||||
myFixture.performEditorAction(IdeActions.ACTION_UNDO);
|
||||
try {
|
||||
waitForAllAsyncStuff();
|
||||
}
|
||||
catch (TimeoutException e) {
|
||||
fail();
|
||||
}
|
||||
myFixture.performEditorAction(IdeActions.ACTION_REDO);
|
||||
try {
|
||||
waitForAllAsyncStuff();
|
||||
}
|
||||
catch (TimeoutException e) {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
checkResultWithInlays("class C { void some(int a) {} void some(int a, int b) {} void m() { some(<Hint text=\"a:\"/>1, <HINT text=\"b:\"/><caret>); } }");
|
||||
}
|
||||
|
||||
private void checkResultWithInlays(String text) {
|
||||
myFixture.checkResultWithInlays(text);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.lang.parameterInfo.*;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.command.undo.UndoManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
@@ -145,8 +146,11 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib
|
||||
myEditorCaretListener = new CaretListener(){
|
||||
@Override
|
||||
public void caretPositionChanged(@NotNull CaretEvent e) {
|
||||
syncUpdateOnCaretMove();
|
||||
rescheduleUpdate();
|
||||
UndoManager undoManager = UndoManager.getInstance(myProject);
|
||||
if (!undoManager.isUndoInProgress() && !undoManager.isRedoInProgress()) {
|
||||
syncUpdateOnCaretMove();
|
||||
rescheduleUpdate();
|
||||
}
|
||||
}
|
||||
};
|
||||
myEditor.getCaretModel().addCaretListener(myEditorCaretListener);
|
||||
|
||||
Reference in New Issue
Block a user