I want to do auto-completion with string literal expressions. This can be useful when I want to automatically insert some extra literals, for example, system file paths.
I tried to write my own CompletionContributor, but found it difficult to trigger the completion action. Here's the extend() statement:
extend(CompletionType.BASIC, PlatformPatterns.psiElement(PsiLiteralExpression.class), new MyCompletionProvider());
extend(CompletionType.BASIC, PsiJavaPatterns.literalExpression(), new MyCompletionProvider());
All of the above didn't work. No popup window showed up. Any ideas?