Skip to content

🗜VS Code extension that allows to run Javascript macros to transform the content of documents.

Notifications You must be signed in to change notification settings

eduardoportilho/jsmacros

Repository files navigation

JS Macros

Run Javascript macros to transform the content of documents in VS Code.

Installing (lazy dev version)

cd ~/.vscode/extensions
git clone [email protected]:eduardoportilho/jsmacros.git

Creating a macro

Macros can be created by adding javascript files to the folder macros inside of the extension folder. Depending on your platform it is located:

  • Windows %USERPROFILE%\.vscode\extensions\jsmacro
  • Mac $HOME/.vscode/extensions/jsmacro
  • Linux $HOME/.vscode/extensions/jsmacro

Your JS macro should contain the body of a function that recieves the current document content through the documentContent parameter and should return the modifyed content, like in the following example:

// Macro short description
return documentContent.replace(/\s/g, "");

The file name will be used as the macro name and a comment on the first line will be used as the description.

Running

  • Command+shift+P
  • Type "jsmacro", hit enter
  • Chosse a macro, hit enter
  • Boom, done

Debugging

  • Set breakpoints
  • F5 (Run > Start Debugging)
    • Debug configuration on .vscode/launch.json
  • A new VSCode instance will open where you can execute the macros

License

MIT

About

🗜VS Code extension that allows to run Javascript macros to transform the content of documents.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published