This is a migrated thread and some comments may be shown as answers.

Surround with selection only

2 Answers 32 Views
Code Templates
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
deesnider
Top achievements
Rank 1
deesnider asked on 15 Nov 2012, 07:48 PM
Is there a way to have Surround with templates apply only to the selected text, and not the entire statement?

E.g. I needed to clean up some non-validating JSON, and essentially add double-quotes around the names. Here is my sample JSON:
var s = { one: 1, two: 2, three: 3}

And my template def:
"$STATEMENT_SELECTION$|"

If I highlight the word 'one' above and run the template, it puts quotes around the entire statement. 
"var s = { one: 1, two: 2, three: 3}"

what I want is:
var s = { "one": 1, two: 2, three: 3}

Is there a way to do this with the current templating language? Otherwise I think it'd be helpful to add such capability to a future release, e.g. apply template to selection only.

2 Answers, 1 is accepted

Sort by
0
Accepted
Zdravko
Telerik team
answered on 20 Nov 2012, 12:22 PM
Hello,

 Thanks for contacting us.
Unfortunately, there isn't a way to do this so far. But you can post a feature request at our our new feedback portal and vote for it. The most popular and important requests will be targeted for implementation.

Thanks.

Greetings,
Zdravko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
deesnider
Top achievements
Rank 1
answered on 25 Nov 2012, 12:39 AM
Tags
Code Templates
Asked by
deesnider
Top achievements
Rank 1
Answers by
Zdravko
Telerik team
deesnider
Top achievements
Rank 1
Share this question
or