Search in sources :

Example 6 with ListTemplatesAction

use of com.intellij.codeInsight.template.impl.actions.ListTemplatesAction in project intellij-community by JetBrains.

the class JsonLiveTemplateTest method testCustomTemplateExpansion.

public void testCustomTemplateExpansion() {
    final String templateContent = "{\n" + "  \"foo\": \"$1$\"\n" + "}";
    createJsonTemplate("foo", "foo", templateContent);
    myFixture.configureByText(JsonFileType.INSTANCE, "foo<caret>");
    final Editor editor = myFixture.getEditor();
    new ListTemplatesAction().actionPerformedImpl(getProject(), editor);
    final LookupImpl lookup = (LookupImpl) LookupManager.getActiveLookup(editor);
    assertNotNull(lookup);
    lookup.finishLookup(Lookup.NORMAL_SELECT_CHAR);
    myFixture.checkResult(templateContent.replaceAll("\\$.*?\\$", ""));
}
Also used : LookupImpl(com.intellij.codeInsight.lookup.impl.LookupImpl) Editor(com.intellij.openapi.editor.Editor) ListTemplatesAction(com.intellij.codeInsight.template.impl.actions.ListTemplatesAction)

Example 7 with ListTemplatesAction

use of com.intellij.codeInsight.template.impl.actions.ListTemplatesAction in project intellij-plugins by JetBrains.

the class OgnlLiveTemplatesTest method expandLiveTemplate.

private void expandLiveTemplate() {
    new ListTemplatesAction().actionPerformedImpl(myFixture.getProject(), myFixture.getEditor());
    LookupImpl lookup = (LookupImpl) LookupManager.getActiveLookup(myFixture.getEditor());
    assertNotNull(lookup);
    lookup.finishLookup(Lookup.NORMAL_SELECT_CHAR);
}
Also used : LookupImpl(com.intellij.codeInsight.lookup.impl.LookupImpl) ListTemplatesAction(com.intellij.codeInsight.template.impl.actions.ListTemplatesAction)

Aggregations

ListTemplatesAction (com.intellij.codeInsight.template.impl.actions.ListTemplatesAction)7 LookupImpl (com.intellij.codeInsight.lookup.impl.LookupImpl)5 Editor (com.intellij.openapi.editor.Editor)2 Project (com.intellij.openapi.project.Project)2 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 TemplateState (com.intellij.codeInsight.template.impl.TemplateState)1