mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-80749 Make it possible to enable live templates for specific language in custom language plugin
This commit is contained in:
+6
-1
@@ -47,7 +47,7 @@ public class LiveTemplateCompletionContributor extends CompletionContributor {
|
||||
final PsiFile file = parameters.getPosition().getContainingFile();
|
||||
final int offset = parameters.getOffset();
|
||||
final List<TemplateImpl> templates = listApplicableTemplates(file, offset);
|
||||
if (Registry.is("show.live.templates.in.completion")) {
|
||||
if (showAllTemplates()) {
|
||||
final Ref<Boolean> templatesShown = Ref.create(false);
|
||||
|
||||
result.runRemainingContributors(parameters, new Consumer<CompletionResult>() {
|
||||
@@ -78,6 +78,11 @@ public class LiveTemplateCompletionContributor extends CompletionContributor {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("MethodMayBeStatic") //for Kotlin
|
||||
protected boolean showAllTemplates() {
|
||||
return Registry.is("show.live.templates.in.completion");
|
||||
}
|
||||
|
||||
private static void ensureTemplatesShown(Ref<Boolean> templatesShown, List<TemplateImpl> templates, CompletionResultSet result) {
|
||||
if (!templatesShown.get()) {
|
||||
templatesShown.set(true);
|
||||
|
||||
Reference in New Issue
Block a user