Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code action to convert JS string to template literal #31799

Closed
adelphes opened this issue Jun 6, 2019 · 1 comment
Closed

Code action to convert JS string to template literal #31799

adelphes opened this issue Jun 6, 2019 · 1 comment

Comments

@adelphes
Copy link

adelphes commented Jun 6, 2019

Something small which I find myself constantly doing while editing javascript...

Having typed a literal string using single/double-quotes, I then find I need to embed an expression and so need to manually navigate to convert the start and end quotes to backticks.

It would be super useful to have a code action which either:

  • shows a refactoring option to "convert to template string". This would simply replace the start and end quotes with backticks (and probably auto-escape any existing backticks within the string).
  • automagically converts to a template string if any instances of ${ are typed in the string.

I'd be happy to look into creating a PR for this, but just wondering if anyone else has this issue or if a better solution already exists.

@mjbvz mjbvz self-assigned this Jun 6, 2019
@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 6, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Jun 6, 2019

Similar to #18267

@mjbvz mjbvz removed their assignment Jun 6, 2019
@adelphes adelphes closed this as completed Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants