mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
again, correct the typed handlers order
This commit is contained in:
+13
-1
@@ -21,10 +21,12 @@ import com.intellij.codeInsight.completion.CompletionPhase;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorModificationUtil;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -63,11 +65,21 @@ public class CompletionAutoPopupHandler extends TypedHandlerDelegate {
|
||||
CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion);
|
||||
}
|
||||
|
||||
|
||||
if (oldPhase instanceof CompletionPhase.CommittingDocuments && ((CompletionPhase.CommittingDocuments)oldPhase).restartCompletion()) {
|
||||
return Result.STOP;
|
||||
}
|
||||
|
||||
if (LookupManager.getInstance(project).getActiveLookup() != null) {
|
||||
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
|
||||
if (lookup != null) {
|
||||
if (editor.getSelectionModel().hasSelection()) {
|
||||
lookup.performGuardedChange(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EditorModificationUtil.deleteSelectedText(editor);
|
||||
}
|
||||
});
|
||||
}
|
||||
return Result.STOP;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,21 +46,6 @@ import java.util.Arrays;
|
||||
public class LookupTypedHandler extends TypedHandlerDelegate {
|
||||
private static boolean inside = false;
|
||||
|
||||
@Override
|
||||
public Result checkAutoPopup(char charTyped, Project project, final Editor editor, PsiFile file) {
|
||||
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
|
||||
if (lookup != null && editor.getSelectionModel().hasSelection()) {
|
||||
lookup.performGuardedChange(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EditorModificationUtil.deleteSelectedText(editor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return lookup != null ? Result.STOP : Result.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result beforeCharTyped(final char charTyped,
|
||||
Project project,
|
||||
|
||||
@@ -529,7 +529,7 @@
|
||||
<editorActionHandler action="EditorEscape" implementationClass="com.intellij.codeInsight.highlighting.EscapeHandler" order="after hide-hints"/>
|
||||
|
||||
<typedHandler implementation="com.intellij.codeInsight.lookup.impl.LookupTypedHandler" id="lookup" order="first"/>
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler" id="completionAutoPopup" order="first, before lookup"/>
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler" id="completionAutoPopup"/>
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.SelectionQuotingTypedHandler"/>
|
||||
|
||||
<templateCompletionProcessor implementation="com.intellij.codeInsight.template.macro.DirectoryTemplateCompletionProcessor"/>
|
||||
|
||||
Reference in New Issue
Block a user