mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
WI-10192 do not expand live template if there is selection in editor
This commit is contained in:
@@ -394,4 +394,24 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase {
|
||||
myFixture.checkResult 'O var = <selection>239</selection>;'
|
||||
}
|
||||
|
||||
public void testTemplateExpandingWithSelection() {
|
||||
final TemplateManager manager = TemplateManager.getInstance(getProject());
|
||||
final Template template = manager.createTemplate("tpl", "user", 'expanded');
|
||||
final JavaStringContextType contextType =
|
||||
ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaStringContextType.class);
|
||||
((TemplateImpl)template).getTemplateContext().setEnabled(contextType, true);
|
||||
|
||||
myFixture.configureByText("a.java", "class A { void f() { Stri<selection>ng s = \"tpl</selection><caret>\"; } }")
|
||||
|
||||
def settings = TemplateSettings.getInstance()
|
||||
settings.addTemplate(template);
|
||||
try {
|
||||
myFixture.type '\t'
|
||||
myFixture.checkResult 'class A { void f() { Stri "; } }'
|
||||
}
|
||||
finally {
|
||||
settings.removeTemplate(template);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user