Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.13 KB

README.md

File metadata and controls

62 lines (45 loc) · 1.13 KB

map-replace.js for VSCode

Replace selected string with custom JavaScript function.

Visual Studio Marketplace VS Installs VS Rating

Features

gif

Examples

const things = [
  'Thing',
  'Thing',
  'Thing',
  'Thing',
  'Thing',
  'Thing',
  'Thing',
]

Make selections on all Thing strings, call the command and enter custom transform function:

(value, index) => `${value} #${index}`

Then generates:

const things = [
  'Thing #0',
  'Thing #1',
  'Thing #2',
  'Thing #3',
  'Thing #4',
  'Thing #5',
  'Thing #6',
]

Credits

Idea from @zetavg

License

MIT