Added 'object' synonym for 'anonymous' live template.
This commit is contained in:
+19
@@ -70,6 +70,8 @@ public class JetLiveTemplateCompletionContributor extends CompletionContributor
|
|||||||
for (final TemplateImpl possible : templates) {
|
for (final TemplateImpl possible : templates) {
|
||||||
result.addElement(new LiveTemplateLookupElement(possible, false));
|
result.addElement(new LiveTemplateLookupElement(possible, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addSynonym(templates, result, "anonymous", "object");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,4 +95,21 @@ public class JetLiveTemplateCompletionContributor extends CompletionContributor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* custom code start */
|
||||||
|
private static void addSynonym(List<TemplateImpl> templates, @NotNull CompletionResultSet result, @NotNull String standardName, @NotNull final String synonym) {
|
||||||
|
for (TemplateImpl t : templates) {
|
||||||
|
if (standardName.equals(t.getKey())) {
|
||||||
|
result.addElement(new LiveTemplateLookupElement(t, false) {
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getLookupString() {
|
||||||
|
return synonym;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user