diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java index 66a34cc88e87..10b307431909 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java @@ -22,7 +22,6 @@ import com.intellij.codeInsight.template.CustomTemplateCallback; import com.intellij.codeInsight.template.postfix.settings.PostfixTemplatesSettings; import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate; import com.intellij.codeInsight.template.postfix.templates.PostfixTemplate; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.patterns.StandardPatterns; import com.intellij.psi.PsiFile; import com.intellij.util.ProcessingContext; @@ -52,9 +51,9 @@ class PostfixTemplatesCompletionProvider extends CompletionProvider getAllTemplateKeys() { + return myTemplates.keySet(); + } + @Nullable public PostfixTemplate getTemplateByKey(@NotNull String key) { return myTemplates.get(key); diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/restartCompletionForExactMatchOnly.java b/java/java-tests/testData/codeInsight/template/postfix/completion/restartCompletionForExactMatchOnly.java new file mode 100644 index 000000000000..902e20e9e628 --- /dev/null +++ b/java/java-tests/testData/codeInsight/template/postfix/completion/restartCompletionForExactMatchOnly.java @@ -0,0 +1,11 @@ +public class Test { + public static void main(String[] args) { + Gray + } + + private static class Gray { + public static void _2() { + + } + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/restartCompletionForExactMatchOnly_after.java b/java/java-tests/testData/codeInsight/template/postfix/completion/restartCompletionForExactMatchOnly_after.java new file mode 100644 index 000000000000..ff7a720d0429 --- /dev/null +++ b/java/java-tests/testData/codeInsight/template/postfix/completion/restartCompletionForExactMatchOnly_after.java @@ -0,0 +1,11 @@ +public class Test { + public static void main(String[] args) { + Gray._2(); + } + + private static class Gray { + public static void _2() { + + } + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java index 529c192066e5..e2ef4425010c 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java @@ -30,6 +30,11 @@ public class TemplatesCompletionTest extends CompletionAutoPopupTestCase { doAutoPopupTest("instanceof", null); } + // IDEA-119910 Middle matching doesn't work if pattern starts with a digit + public void testRestartCompletionForExactMatchOnly() { + doCompleteTest(".2", '\n'); + } + public void testShowTemplateInAutoPopup() { doAutoPopupTest("instanceof", InstanceofExpressionPostfixTemplate.class); }