From b23b60ae381f66d9d2cdba04b346d2ab8ea6bc6b Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 5 Sep 2012 16:29:16 +0200 Subject: [PATCH] IDEA-90765 When a completion popup is visible in Python code, typing . does not popup next completion --- .../editorActions/TypedHandler.java | 22 ++++++++++++------- .../lookup/impl/LookupTypedHandler.java | 2 ++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java index 11aafcca23f3..52939e4ec0c1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java @@ -162,7 +162,6 @@ public class TypedHandler extends TypedActionHandlerBase { } final TypedHandlerDelegate[] delegates = Extensions.getExtensions(TypedHandlerDelegate.EP_NAME); - AutoPopupController autoPopupController = AutoPopupController.getInstance(project); boolean handled = false; for(TypedHandlerDelegate delegate: delegates) { @@ -174,13 +173,8 @@ public class TypedHandler extends TypedActionHandlerBase { } if (!handled) { - if (charTyped == '.') { - autoPopupController.autoPopupMemberLookup(editor, null); - } - - if ((charTyped == '(' || charTyped == ',') && !isInsideStringLiteral(editor, file)) { - autoPopupController.autoPopupParameterInfo(editor, null); - } + autoPopupCompletion(editor, charTyped, project); + autoPopupParameterInfo(editor, charTyped, project, file); } if (!editor.isInsertMode()){ @@ -242,6 +236,18 @@ public class TypedHandler extends TypedActionHandlerBase { } } + private static void autoPopupParameterInfo(Editor editor, char charTyped, Project project, PsiFile file) { + if ((charTyped == '(' || charTyped == ',') && !isInsideStringLiteral(editor, file)) { + AutoPopupController.getInstance(project).autoPopupParameterInfo(editor, null); + } + } + + public static void autoPopupCompletion(Editor editor, char charTyped, Project project) { + if (charTyped == '.') { + AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); + } + } + private static boolean isInsideStringLiteral(final Editor editor, final PsiFile file) { int offset = editor.getCaretModel().getOffset(); PsiElement element = file.findElementAt(offset); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java index 6d9af2be8403..f3280579fc30 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java @@ -20,6 +20,7 @@ import com.intellij.codeInsight.AutoPopupController; import com.intellij.codeInsight.completion.*; import com.intellij.codeInsight.completion.impl.CompletionServiceImpl; import com.intellij.codeInsight.editorActions.AutoHardWrapHandler; +import com.intellij.codeInsight.editorActions.TypedHandler; import com.intellij.codeInsight.editorActions.TypedHandlerDelegate; import com.intellij.codeInsight.lookup.CharFilter; import com.intellij.codeInsight.lookup.LookupElement; @@ -137,6 +138,7 @@ public class LookupTypedHandler extends TypedHandlerDelegate { } lookup.hide(); + TypedHandler.autoPopupCompletion(editor, charTyped, project); return Result.CONTINUE; } finally {