mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-32053, EA-31726 diagnostics for lookup start invalidation when selecting an item by typing a char
This commit is contained in:
@@ -845,16 +845,22 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
}
|
||||
|
||||
public void performGuardedChange(Runnable change) {
|
||||
performGuardedChange(change, null);
|
||||
}
|
||||
|
||||
public void performGuardedChange(Runnable change, @Nullable final String debug) {
|
||||
checkValid();
|
||||
assert myLookupStartMarker.isValid();
|
||||
assert !myChangeGuard;
|
||||
|
||||
myChangeGuard = true;
|
||||
Document document = myEditor.getDocument();
|
||||
final Document document = myEditor.getDocument();
|
||||
RangeMarkerSpy spy = new RangeMarkerSpy(myLookupStartMarker) {
|
||||
@Override
|
||||
protected void invalidated(DocumentEvent e) {
|
||||
LOG.error("Lookup start marker invalidated, say thanks to the "+ e);
|
||||
LOG.error("Lookup start marker invalidated, say thanks to the " + e +
|
||||
", doc=" + document +
|
||||
", debug=" + debug);
|
||||
}
|
||||
};
|
||||
document.addDocumentListener(spy);
|
||||
|
||||
+16
-1
@@ -36,15 +36,21 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorModificationUtil;
|
||||
import com.intellij.openapi.editor.SelectionModel;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.ex.ScrollingModelEx;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class LookupTypedHandler extends TypedHandlerDelegate {
|
||||
private static boolean inside = false;
|
||||
@@ -165,6 +171,14 @@ public class LookupTypedHandler extends TypedHandlerDelegate {
|
||||
final ScrollingModelEx scrollingModel = (ScrollingModelEx)editor.getScrollingModel();
|
||||
scrollingModel.accumulateViewportChanges();
|
||||
try {
|
||||
final List<Pair<DocumentEvent, String>> events = new ArrayList<Pair<DocumentEvent, String>>();
|
||||
final DocumentAdapter listener = new DocumentAdapter() {
|
||||
@Override
|
||||
public void documentChanged(DocumentEvent e) {
|
||||
events.add(Pair.create(e, DebugUtil.currentStackTrace()));
|
||||
}
|
||||
};
|
||||
editor.getDocument().addDocumentListener(listener);
|
||||
if (smartUndo) {
|
||||
CommandProcessor.getInstance().executeCommand(editor.getProject(), new Runnable() {
|
||||
@Override
|
||||
@@ -173,6 +187,7 @@ public class LookupTypedHandler extends TypedHandlerDelegate {
|
||||
}
|
||||
}, null, "Just insert the completion char");
|
||||
}
|
||||
editor.getDocument().removeDocumentListener(listener);
|
||||
|
||||
CommandProcessor.getInstance().executeCommand(editor.getProject(), new Runnable() {
|
||||
@Override
|
||||
@@ -180,7 +195,7 @@ public class LookupTypedHandler extends TypedHandlerDelegate {
|
||||
if (smartUndo) {
|
||||
AccessToken token = WriteAction.start();
|
||||
try {
|
||||
lookup.performGuardedChange(restore);
|
||||
lookup.performGuardedChange(restore, events.toString());
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
|
||||
Reference in New Issue
Block a user