Is there a way I can define a custom refactoring in Visual Studio Code?

545 Views Asked by At

It is possible to define custom snippets of code that VS Code can auto complete. These can even use place-holders so that one can fill in the blanks as required.

/* Before */

//=

/* After (for example) */

// [title]
//===============================

What I'm looking for is somewhat the next step up from that, where it can take a selection and replace it with a place-holder that contains that original code (having embedded place-holders is a plus too).

/* Before */
some.code();
where.I = am;
doing = stuff;

/* After (for example) */
some('surrounding code which contains the original code', () => {
  some.code();
  where.I = am;
  doing = stuff;
});

The above is just an example of what I want to achieve - the surrounding code could take any form.

0

There are 0 best solutions below