How to add default live template byTemplateManager?

Hello,

I have some live templates by using DefaultLiveTemplatesProvider and templateSet xml files,

 I register a defaultLiveTemplatesProvider in plugin.xml,

<extensions defaultExtensionNs="com.intellij">
<defaultLiveTemplatesProvider implementation="com.lianjia.ide.liveTemplate.MyTemplateProvider"/>
</extensions>

and code fo MyTemplateProvider is:

public class MyTemplateProvider implements DefaultLiveTemplatesProvider {

@Override
public String[] getDefaultLiveTemplateFiles() {
return new String[]{
"templates/flutter_template_file",
};
}

@Nullable
@Override
public String[] getHiddenLiveTemplateFiles() {
return new String[0];
}
}

 Now I need to post a http request when templates code completion. But I can't find a way to do this http request.

TemplateManager has a listener(com.intellij.codeInsight.template.TemplateManager#startTemplate(com.intellij.openapi.editor.Editor, com.intellij.codeInsight.template.Template, com.intellij.codeInsight.template.TemplateEditingListener)), but TemplateManager seems to need an action or project, I don't know how to create default live templates by using TemplateManager.Can anyone help?

Sincerely,

Lianjia Ide

请先登录再写评论。