IDEA-90765 When a completion popup is visible in Python code, typing . does not popup next completion

This commit is contained in:
peter
2012-09-05 18:49:53 +02:00
parent dfd7aa5f31
commit b23b60ae38
2 changed files with 16 additions and 8 deletions
@@ -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);
@@ -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 {