Execute Live Template from code

Hi

How do I execute a Live Template from code?

I want something like (psuedo):

string liveTemplateName = "templateName";
Dictionary<string, string> parameters = { "variableName", "variableValue" }

LiveTemplateManager.Execute(liveTemplateName, parameters);


This will start the Live Template at the current cursor position. If there
is a variable named "variableName", it should have the value "variableValue".
Otherwise it should work as a normale Live Template.

Thanks.

--Jakob


2 comments
Comment actions Permalink

Hello Jakob,

Yes, there is a family of methods in the LiveTemplatesController shell
component.

WBR,
Oleg Stepanov
Senior Whiteboard Operator
JetBrains, Inc.
"Develop with pleasure!"
mailto:oleg.stepanov@jetbrains.com

Hi

How do I execute a Live Template from code?

I want something like (psuedo):

string liveTemplateName = "templateName";
Dictionary<string, string> parameters = { "variableName",
"variableValue" }
LiveTemplateManager.Execute(liveTemplateName, parameters);

This will start the Live Template at the current cursor position. If
there is a variable named "variableName", it should have the value
"variableValue". Otherwise it should work as a normale Live Template.

Thanks.

--Jakob



0
Comment actions Permalink

Hello Oleg,

Thanks.

--Jakob

Hello Jakob,

Yes, there is a family of methods in the LiveTemplatesController
shell component.

WBR,
Oleg Stepanov
Senior Whiteboard Operator
JetBrains, Inc.
"Develop with pleasure!"
mailto:oleg.stepanov@jetbrains.com

>> Hi
>>
>> How do I execute a Live Template from code?
>>
>> I want something like (psuedo):
>>
>> string liveTemplateName = "templateName"; Dictionary<string, string>
>> parameters = { "variableName", "variableValue" }
>> LiveTemplateManager.Execute(liveTemplateName, parameters);
>>
>> This will start the Live Template at the current cursor position. If
>> there is a variable named "variableName", it should have the value
>> "variableValue". Otherwise it should work as a normale Live Template.
>>
>> Thanks.
>>
>> --Jakob
>>


0

Please sign in to leave a comment.