I have enough! My VSCode always autocomplete command that I don't need when I'm about to export CommonJS module (or module.exports).
And I'm too lazy to manually type module.exports to export module in CommonJS.
To fix this, just add user snippet!
- Open command pallete (cmd + Shift + p)
- Type "user snippet" ... it should suggest "Snippets: Configure User Snippets" then hit Enter!
- The pallete should display a list of snippet, then choose "New Global Snippet file..." VSCode will open a new file
- Add this code
{
"CommonJS export": {
"scope": "javascript,typescript",
"prefix": "mdep",
"body": [
"module.exports = {$1}"
],
"description": "Export module as CommonJS"
}
}
What does it mean?
-
"CommonJS export"-- the name of this snippet -
"scope": "javascript,typescript"-- this snippet will be use on JS and TS -
"prefix": "mdep"-- I will just typemdepand got mymodule.exports -
"body"-- this is the template it will generate my expected code
That's it!
Top comments (0)