Skip to content

Release 4.0.0 #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Change Log
### 4.0.0

- [[#116](https://github.com/tahabasri/snippets/pull/116)]
- Added integration with GitHub Copilot Chat
- Added integration with Cursor AI Pane
- Added integration with Gemini Code Assist
- [[#112](https://github.com/tahabasri/snippets/pull/112)] Added action buttons for improved usability
- [[#111](https://github.com/tahabasri/snippets/pull/111)]
- Removed duplicate languages in language selector
- Sorted languages by alias for better navigation
- [[#110](https://github.com/tahabasri/snippets/pull/110)]
- Fixed tooltip descriptions
- Enforced value change before updating snippet/folder
- [[#108](https://github.com/tahabasri/snippets/pull/108)]
- Improved logging capabilities
- Updated FAQ documentation
- Fixed security vulnerabilities

### 3.1.0

- [[#81](https://github.com/tahabasri/snippets/pull/81)] Added support for language scope with icons and auto-detect ✌.
Expand Down
47 changes: 39 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

# Snippets — Supercharge Snippets in VS Code

Code snippets are valuable additions for anyone looking to save time during development. They simplify the process of entering repetitive code, such as loops, complex HTML structures or reusable methods.
Code snippets are valuable additions for anyone looking to save time during development. They simplify the process of entering repetitive code, such as loops, complex HTML structures, or reusable methods.

Visual Studio Code already provides robust support for snippets, including their appearance in IntelliSense, tab-completion, and a dedicated snippet picker `(Insert Snippet in the Command Palette)`. This extension takes snippets to another level by introducing new features that enhance code snippet management.
Visual Studio Code already provides robust support for snippets, including their appearance in IntelliSense, tab-completion, and a dedicated snippet picker (`Insert Snippet` in the Command Palette). This extension takes snippets to another level by introducing new features that enhance code snippet management.

## Getting Started

Install **Snippets** by one of the following options:
- clicking `Install` on the banner above
- searching for `Snippets` from the Extensions side bar in VS Code
- typing `ext install tahabasri.snippets` from the Command Palette in VS Code
- Clicking `Install` on the banner above
- Searching for `Snippets` from the Extensions side bar in VS Code
- Typing `ext install tahabasri.snippets` from the Command Palette in VS Code

---

Expand All @@ -27,13 +27,14 @@ Install **Snippets** by one of the following options:

Boost your productivity with a set of powerful features that enhance snippet management:

- [Create](#create) — Create Snippets easily with few clicks.
- [Create](#create) — Create Snippets easily with a few clicks.
- [Open](#open) — Open Snippets quickly from anywhere in VS Code.
- [Search](#search) — Find your Snippet in 2 seconds, or less...
- [Search](#search) — Find your Snippet in 2 seconds or less.
- [Manage](#manage) — Organize your snippets freely, with no forced order, beyond editing and deleting.
- [Customize](#customize) — Personalize your Snippets to match your style.
- [Sync](#sync) — Various options for synchronizing your snippets across multiple devices and users.
- [Boost](#boost) — Supercharge your snippets to make them more developer-friendly.
- [AI Integration](#ai-integration) — Seamlessly work with AI assistants in VS Code.

## Create

Expand Down Expand Up @@ -118,6 +119,10 @@ alt="Reorder Snippets">
<img src="https://raw.githubusercontent.com/tahabasri/snippets/main/images/features/047-sort-snippets.gif"
alt="Reorder Snippets">

### Action Buttons

The extension now features enhanced action buttons throughout the interface for improved usability, making it easier to perform common operations with fewer clicks.

## Customize
### Set icons for your folders

Expand Down Expand Up @@ -159,6 +164,10 @@ alt="Global Prefix">
<img src="https://raw.githubusercontent.com/tahabasri/snippets/main/images/features/13-import-export.jpg"
alt="Import and Export Snippets">

### Import VS Code Snippets to Cursor or Windsurf

You can import your existing VS Code snippets directly to Cursor or Windsurf combining the best snippets you collected for both editors.

### Sync Snippets between multiple devices

> **⚠ Experimental feature:** feel free to [file a bug](https://github.com/tahabasri/snippets/issues/new?labels=bug) as this is still an experimental change.
Expand Down Expand Up @@ -199,6 +208,22 @@ alt="Manually Bind Snippets to Languages">
<img src="https://raw.githubusercontent.com/tahabasri/snippets/main/images/features/06-open-intelligent-snippet.gif"
alt="Open Snippet with Variables">

## AI Integration

Seamlessly integrate your snippets with AI assistants in VS Code:

### GitHub Copilot Chat

Use your snippets directly with GitHub Copilot Chat for enhanced productivity and context-aware code generation.

### Cursor AI Pane

Integrate with Cursor's AI capabilities to get intelligent suggestions based on your snippets library.

### Gemini Code Assist

Leverage Google's Gemini Code Assist alongside your snippets for more powerful code completion and generation.

**Enjoy!**

## FAQ
Expand All @@ -207,14 +232,20 @@ alt="Open Snippet with Variables">
**A: There is no limit; your disk space is the only limitation.**

### Q: I'm feeling overwhelmed by multiple snippets. How can I better organize them?
**A: Check this [section](#manage) for available organizational features**
**A: Check the [Manage](#manage) section for available organizational features including folders, drag-and-drop, reordering, and alphabetical sorting.**

### Q: Clicking "Request to Initialize File" does nothing. What should I do?
**A: If you're attempting to initialize the snippets file for a new [workspace](#sync-your-snippets-with-a-version-control-system) and nothing happens, ensure that the path to your current folder open in VS Code has the correct file permissions.**

### Q: Can I specify the cursor position so that, when the snippet is added, the cursor is moved to a particular position?
**A: Yes, you can enable `Resolve Snippet Syntax` for a particular snippet and use [VS Code Tab Stops](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_tabstops).**

### Q: How do I use snippets with AI assistants?
**A: The extension now integrates with GitHub Copilot Chat, Cursor AI Pane, and Gemini Code Assist. Check the [AI Integration](#ai-integration) section for details.**

### Q: I'm switching to Cursor/Windsurf. How do I import my existing VS Code snippets?
**A: You can import your VS Code snippets directly to Cursor/Windsurf using the import feature. See the [Import VS Code Snippets to Cursor Position](#import-vs-code-snippets-to-cursor-or-windsurf) section.**

## Known Issues

### Troubleshoot Snippets
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
"contents": "In order to use snippets, save some code here.\n[Add Snippet](command:globalSnippetsCmd.addSnippet)\n[Add Snippet Folder](command:globalSnippetsCmd.addSnippetFolder)\n[Import Snippets](command:globalSnippetsCmd.importSnippets)\nTo import Snippets from VS Code, you can export them from an open VS Code window, and then, use the Import Snippets command in Cursor.\nTo learn more about how to use snippets [read the docs](https://github.com/tahabasri/snippets/blob/main/README.md#features).",
"when": "snippets.host == cursor"
},
{
"view": "snippetsExplorer",
"contents": "In order to use snippets, save some code here.\n[Add Snippet](command:globalSnippetsCmd.addSnippet)\n[Add Snippet Folder](command:globalSnippetsCmd.addSnippetFolder)\n[Import Snippets](command:globalSnippetsCmd.importSnippets)\nTo import Snippets from VS Code, you can export them from an open VS Code window, and then, use the Import Snippets command in Windsurf.\nTo learn more about how to use snippets [read the docs](https://github.com/tahabasri/snippets/blob/main/README.md#features).",
"when": "snippets.host == windsurf"
},
{
"view": "wsSnippetsExplorer",
"when": "config.snippets.useWorkspaceFolder && snippets.workspaceState != fileAvailable",
Expand Down
13 changes: 11 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,17 @@ export function activate(context: vscode.ExtensionContext) {
context.globalState.update(releaseChangelogId, true);
}

// check if host is vscode or cursor
vscode.commands.executeCommand(setContextCmd, contextHostStateKey, vscode.hasOwnProperty('cursor') ? 'cursor' : 'vscode');
// check if host is vscode, cursor or windsurf
vscode.commands.executeCommand(
setContextCmd,
contextHostStateKey,
vscode.hasOwnProperty('cursor') ? 'cursor' : 'vscode'
);
vscode.commands.executeCommand(
setContextCmd,
contextHostStateKey,
context.globalStorageUri.fsPath.toLowerCase().includes('windsurf') ? 'windsurf' : 'vscode'
);

//** upgrade from 1.x to 2.x **//
let oldSnippetsPath: string = vscode.workspace.getConfiguration('snippets').get('snippetsLocation')
Expand Down