Closed hediet closed 2 years ago
That's a brilliant idea, I want that feature! I'll look into implementing it in the coming weeks.
A first improvement is coming in v1.125.0
- the cursor should not move any more when applying the "convert string to template literal" and "convert template literal to string" code actions.
The Template String Converter extension adds this functionality. It's a little bit different from the existing code assists, so I'll not add this to P42 at this point, especially since it's already available in another extension.
I usually start with a string literal (
"hello world"
) and later want to convert it to`hello ${name}`
.While the code actions are nice, I think the story can be improved.
I'm thinking of automatic conversion from a normal string to a template string once the user types the first
${}
, and the opposite direction once the users removes the last${}
.Also, the conversion code action should keep the cursor at its position in the string (use two edits for the prefix and suffix instead a single one for the entire string).