Dynamic Snippets Manager for VS Code
A VS Code extension to manage custom, language-specific snippets with support for placeholders.
Features
- Language-Specific Snippets: Attach snippets to a specific language (e.g.,
javascript, python, markdown).
- Placeholder Support: Use
${1:label}, ${2}, etc., to define tab stops and default values.
- Filtering: Only shows snippets relevant to the current file's language.
- Uniqueness: Ensures only one snippet with the same name exists per language.
- CRUD Operations: Easily add, edit, or delete snippets through the command palette.
How to Use
Add a Snippet:
- Open the Command Palette (
Cmd+Shift+P / Ctrl+Shift+P).
- Run
Snippets: Add New Snippet.
- Provide a Name, Language ID, and Content (e.g.,
console.log(${1:item});).
Use a Snippet:
- Open a file of the target language.
- Start typing the snippet name.
- Select it from the completion list.
- Press
Tab to jump between placeholders.
Edit/Delete Snippets:
- Use
Snippets: Edit Snippet or Snippets: Delete Snippet from the Command Palette.
Development and Testing
Setup
- Run
npm install.
- Run
npm run compile.
Testing
- Press
F5 in VS Code to open a new [Extension Development Host] window.
- In the new window, use the commands above.
- Verify that:
- Snippets only show up in the correct language files.
- Placeholders allow
Tab navigation.
- Duplicate names in the same language are prevented.
- Duplicate names in different languages are allowed.
| |