1

I'm trying to write code-snippet for Visual Studio Code and TypeScript. So far I managed to mirror typed word like this:

import { ${1:Name}Component } from './${1:name}.component';

When I type the word in place #1 it is mirrored to place #2 like this:

import { MynameComponent } from './Myname.component';

Is it possible to change snippet so the place #2 is in lower case like this:

import { MynameComponent } from './myname.component';
Joe Belladonna
  • 1,349
  • 14
  • 20

1 Answers1

1

The ability to transform snippets has been more recently added in vscode v.1.25. In your case try this snippet:

"import components": {
    "prefix": "isml",
    "body": [
      "import { ${1/(.*)/$1Component } from '.\\/${1:/downcase}/}.component'",
    ],
    "description": "small"
  },

Trigger the prefix. Then hit tab after you enter your component name (Myname in this example) and it will complete the snippet as you wanted.

import { MynameComponent } from './myname.component';
Mark
  • 143,421
  • 24
  • 428
  • 436