mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
better where/from completion (DBE-225)
This commit is contained in:
+12
-1
@@ -1,5 +1,6 @@
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -11,7 +12,14 @@ import com.intellij.psi.PsiDocumentManager;
|
||||
* @author zolotov
|
||||
*/
|
||||
public class AddSpaceInsertHandler implements InsertHandler<LookupElement> {
|
||||
public final static InsertHandler<LookupElement> INSTANCE = new AddSpaceInsertHandler();
|
||||
public final static InsertHandler<LookupElement> INSTANCE = new AddSpaceInsertHandler(false);
|
||||
public final static InsertHandler<LookupElement> INSTANCE_WITH_AUTO_POPUP = new AddSpaceInsertHandler(true);
|
||||
|
||||
private final boolean myTriggerAutoPopup;
|
||||
|
||||
public AddSpaceInsertHandler(boolean triggerAutoPopup) {
|
||||
myTriggerAutoPopup = triggerAutoPopup;
|
||||
}
|
||||
|
||||
public void handleInsert(InsertionContext context, LookupElement item) {
|
||||
Editor editor = context.getEditor();
|
||||
@@ -25,6 +33,9 @@ public class AddSpaceInsertHandler implements InsertHandler<LookupElement> {
|
||||
else {
|
||||
editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + 1);
|
||||
}
|
||||
if (myTriggerAutoPopup) {
|
||||
AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user