mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't autopopup or restart completion in dumb mode
This commit is contained in:
+5
@@ -636,6 +636,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
final int offset = myEditor.getCaretModel().getOffset();
|
||||
final long stamp = myEditor.getDocument().getModificationStamp();
|
||||
final Project project = getProject();
|
||||
final boolean wasDumb = DumbService.getInstance(project).isDumb();
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -647,6 +648,10 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wasDumb && DumbService.getInstance(project).isDumb()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (myEditor.getCaretModel().getOffset() != offset || myEditor.getDocument().getModificationStamp() != stamp) {
|
||||
return;
|
||||
}
|
||||
|
||||
+2
@@ -34,6 +34,7 @@ import com.intellij.openapi.fileEditor.FileEditorManagerAdapter;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -98,6 +99,7 @@ public class CompletionAutoPopupHandler extends TypedHandlerDelegate {
|
||||
if (project.isDisposed() || !file.isValid()) return;
|
||||
if (editor.isDisposed() || isMainEditor && FileEditorManager.getInstance(project).getSelectedTextEditor() != editor) return;
|
||||
if (ApplicationManager.getApplication().isWriteAccessAllowed()) return; //it will fail anyway
|
||||
if (DumbService.getInstance(project).isDumb()) return;
|
||||
|
||||
new CodeCompletionHandlerBase(CompletionType.BASIC, false, true).invoke(project, editor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user