use of com.intellij.codeInsight.template.CustomLiveTemplateBase in project intellij-community by JetBrains.
the class ListTemplatesHandler method getCustomTemplatesLookupItems.
public static MultiMap<String, CustomLiveTemplateLookupElement> getCustomTemplatesLookupItems(@NotNull Editor editor, @NotNull PsiFile file, int offset) {
final MultiMap<String, CustomLiveTemplateLookupElement> result = MultiMap.create();
CustomTemplateCallback customTemplateCallback = new CustomTemplateCallback(editor, file);
for (CustomLiveTemplate customLiveTemplate : TemplateManagerImpl.listApplicableCustomTemplates(editor, file, false)) {
if (customLiveTemplate instanceof CustomLiveTemplateBase) {
String customTemplatePrefix = ((CustomLiveTemplateBase) customLiveTemplate).computeTemplateKeyWithoutContextChecking(customTemplateCallback);
if (customTemplatePrefix != null) {
result.putValues(customTemplatePrefix, ((CustomLiveTemplateBase) customLiveTemplate).getLookupElements(file, editor, offset));
}
}
}
return result;
}
use of com.intellij.codeInsight.template.CustomLiveTemplateBase in project intellij-community by JetBrains.
the class LiveTemplateCompletionContributor method showCustomLiveTemplates.
private static void showCustomLiveTemplates(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
PsiFile file = parameters.getPosition().getContainingFile();
Editor editor = parameters.getEditor();
for (CustomLiveTemplate customLiveTemplate : TemplateManagerImpl.listApplicableCustomTemplates(editor, file, false)) {
if (customLiveTemplate instanceof CustomLiveTemplateBase) {
((CustomLiveTemplateBase) customLiveTemplate).addCompletions(parameters, result);
}
}
}
Aggregations