A convenient VS Code extension for code snippet management, allowing you to easily define and manage code snippets within your project directory and quickly apply them through intelligent code completion suggestions.
While current AI code generation tools can meet certain development needs, the generated code often fails to align with project-specific architectural designs and coding standards. To prevent code quality degradation and technical debt accumulation, we developed this project. SnipHub enables development teams to preset standard-compliant code snippet templates within projects, supports on-demand usage, and can be shared with team members through Git repositories, thus achieving standardized code reuse and management.
- βοΈ Quick Creation: Create code snippets from selected text in editor
- π― Context Menu: Right-click menu for quick operations
- π Auto Organization: Automatically categorize and store in
.vscode/SnipHub - π§ Quick Application: Apply snippets quickly with customizable prefix via code completion
- π·οΈ Rich Metadata: Support for tags and descriptions
- π Multilingual: Support for multiple languages (English, Chinese)
- π Syntax Highlighting: Built-in syntax highlighting for .snip files
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search for "SnipHub"
- Click Install
- Select code in the editor
- Right-click and choose "SnipHub: Create .snip File"
- Configure snippet name, description, and tags
- In the editor, type the preset prefix (default: sh) followed by a colon to see available snippets
- Select the desired snippet to apply it to the current position
- View all snippets and snippet sets in the SnipHub sidebar
- Use the refresh button to update the list
- Configure extension settings via the settings button
- Click the SnipHub icon in the Activity Bar
- Click "Create Snippet Set" and configure name, description, etc.
- Add files to snippet sets via Explorer right-click menu
Support for direct code completion of development language code file content to the target position, or you can use the custom format .snip file for code snippets:
- Code-Configuration Separation:
settag for snippet configuration,codetag for code snippet - Multiple Languages: Automatic language detection
- Custom Completion Names: Trigger with customizable snippet names
- Rich Configuration Options: Name, description, tags, and more
Supported Custom Options
| Option | Required | Description |
|---|---|---|
| name | Yes | Snippet name |
| displayName | No | Snippet display name |
| description | No | Snippet description |
| language | No | Code language |
| tags | No | Code tags |
| updatedAt | No | Update time |
More coming soon...
Example .snip file:
<set>
{
"name": "hello-world",
"displayName": "Hello World",
"description": "Create a simple Hello World JavaScript code",
"language": "javascript",
"tags": ["javascript", "basic", "example"]
}
</set>
<code language="javascript">
function sayHello() {
console.log("Hello, World!");
return "Hello, World!";
}
sayHello();
</code>Access settings via Ctrl+, and search for "SnipHub":
| Setting | Default | Description |
|---|---|---|
sniphub.storageLocation |
.vscode/SnipHub |
Storage location for snippets |
sniphub.prefix |
sh |
Code completion prefix |
- Node.js 16.x or higher
- VS Code 1.74.0 or higher
# Clone the repository
git clone https://github.com/dao404/sniphub.git
cd sniphub
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch# Package
vsce package
# Publish
vsce publishOpen the project in VS Code and press F5 to launch a new Extension Development Host window.
SnipHub supports multiple languages:
- English (Default)
- δΈζ (Chinese Simplified)
The extension automatically detects your VS Code language setting and displays the appropriate language.
.vscode/SnipHub/
βββ snip/ # Individual code snippets (.snip files)
βββ packs/ # Snippet sets (snippet collection configuration files)
- Support for snippet set applications composed of multiple snippets, including application configuration and command execution
- MCP Server to provide project snippet resources for AI tools
- Public code snippet distribution
- Welcome to provide development suggestions through issues
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.

