embedded live templates: support default values

This commit is contained in:
Dmitry Avdeev
2015-09-18 13:48:54 +03:00
parent 0412d3fe71
commit f1c9933bad
2 changed files with 4 additions and 4 deletions
@@ -39,7 +39,7 @@ public class EmbeddedLiveTemplatesTest extends LightPlatformCodeInsightFixtureTe
public void testSupportVariables() throws Exception {
doTest("First: #[[$Var$]]# Second: #[[$Var$]]#",
"First: <caret> Second: ");
"First: Var Second: Var");
}
protected void doTest(String text, String result) {
@@ -93,11 +93,11 @@ public abstract class CreateFromTemplateActionBase extends AnAction {
Set<String> variables = new HashSet<String>();
for (int i = 0; i < count; i++) {
String name = template.getSegmentName(i);
variables.add(name);
variables.add(template.getSegmentName(i));
}
variables.removeAll(TemplateImpl.INTERNAL_VARS_SET);
for (String variable : variables) {
template.addVariable(variable, null, variable, true);
template.addVariable(variable, null, "\"" + variable + "\"", true);
}
WriteCommandAction.runWriteCommandAction(project, new Runnable() {
@Override