mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-84834 Inconvenient live template completion with different keyword
This commit is contained in:
@@ -295,6 +295,13 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase {
|
||||
assert 'itar' in myFixture.lookupElementStrings
|
||||
}
|
||||
|
||||
public void testListTemplatesSearchesPrefixInDescription() {
|
||||
myFixture.configureByText("a.java", "class A { main<caret> }")
|
||||
|
||||
new ListTemplatesHandler().invoke(project, editor, myFixture.file);
|
||||
assert myFixture.lookupElementStrings == ['psvm']
|
||||
}
|
||||
|
||||
public void testListTemplatesAction() {
|
||||
myFixture.configureByText("a.java", "class A {{ <caret> }}")
|
||||
|
||||
@@ -308,7 +315,6 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase {
|
||||
myFixture.type('\b')
|
||||
new ListTemplatesHandler().invoke(project, editor, myFixture.file);
|
||||
assert myFixture.lookupElementStrings.containsAll(['iter', 'itco'])
|
||||
assert !('toar' in myFixture.lookupElementStrings)
|
||||
LookupManager.getInstance(project).hideActiveLookup()
|
||||
|
||||
myFixture.type('xxxxx')
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class ListTemplatesHandler implements CodeInsightActionHandler {
|
||||
List<TemplateImpl> matchingTemplates = new ArrayList<TemplateImpl>();
|
||||
ArrayList<TemplateImpl> applicableTemplates = SurroundWithTemplateHandler.getApplicableTemplates(editor, file, false);
|
||||
for (TemplateImpl template : applicableTemplates) {
|
||||
if (template.getKey().startsWith(prefix)) {
|
||||
if (template.getKey().startsWith(prefix) || template.getDescription() != null && template.getDescription().contains(prefix)) {
|
||||
matchingTemplates.add(template);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user