Remove surrounded quotes in vscode or toggle between quote and no quote

rahoolm picture rahoolm · Nov 16, 2016 · Viewed 15.2k times · Source

Is there any shortcut or extension for vscode which can help to remove surrounded quotes (single ' or double " ) around a selected text?
See example below

'hello' ==> hello

In other words, is it possible to have a feature which will toggle current selection between quotes and no quotes?

I have tried es quotes for vscode which is very nice while switching the quotes between single and double quotes.

Answer

Superole picture Superole · Oct 16, 2019

Elaborating on Soldeplata's answer:

Before we start: Look up your shortcut for expanding selection by hitting Ctrl+k,Ctrl+s and search for smartselect (as it could differ with keyboard layout and installed keymap-extensions). I have two shortcuts to choose from: Shift+alt+ or Ctrl+w

The steps (not one shortcut but a small series):

  • Your starting point..................................... Some say: "hello";

  1. Put cursor any where in the word hello
    and use shortcut to expand selection....... Some say: "hello";
  2. Cut selection (Ctrl+x)......................... Some say: "";
  3. Hit backspace once
    (this removes both quotes)...................... Some say: ;
  4. Paste (Ctrl+v).................................... Some say: hello;