From de41932452f96ef9a5cb679cb37c13635457b1af Mon Sep 17 00:00:00 2001 From: Taha Basri Date: Mon, 7 Apr 2025 15:00:48 +0100 Subject: [PATCH 1/4] Update changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa1f848..de7c956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,23 @@ # Change Log ### 4.0.0 +- [[#108](https://github.com/tahabasri/snippets/pull/108)] + - Improved logging capabilities + - Updated FAQ documentation + - Fixed security vulnerabilities +- [[#110](https://github.com/tahabasri/snippets/pull/110)] + - Fixed tooltip descriptions + - Enforced value change before updating snippet/folder +- [[#111](https://github.com/tahabasri/snippets/pull/111)] + - Removed duplicate languages in language selector + - Sorted languages by alias for better navigation +- [[#112](https://github.com/tahabasri/snippets/pull/112)] Added action buttons for improved usability +- [[#115](https://github.com/tahabasri/snippets/pull/115)] Added ability to import VS Code snippets to cursor position +- [[#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 + ### 3.1.0 - [[#81](https://github.com/tahabasri/snippets/pull/81)] Added support for language scope with icons and auto-detect ✌. From 594aa6af7f9f2cf733ace151908b28c4e121dbb9 Mon Sep 17 00:00:00 2001 From: Taha Basri Date: Mon, 7 Apr 2025 18:18:49 +0100 Subject: [PATCH 2/4] Add specific intro section for Windsurf --- package.json | 5 +++++ src/extension.ts | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0bc6828..bd41972 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/extension.ts b/src/extension.ts index 9853304..4f32941 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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') From 4572ce7c396c20b63219b366dbcae29311a59590 Mon Sep 17 00:00:00 2001 From: Taha Basri Date: Mon, 7 Apr 2025 18:21:42 +0100 Subject: [PATCH 3/4] Enhance README.md: Improve clarity and add 4.0.0 features --- README.md | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ec2ad86..defe9fe 100644 --- a/README.md +++ b/README.md @@ -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 --- @@ -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 @@ -118,6 +119,10 @@ alt="Reorder Snippets"> 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 @@ -159,6 +164,10 @@ alt="Global Prefix"> 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. @@ -199,6 +208,22 @@ alt="Manually Bind Snippets to Languages"> 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 @@ -207,7 +232,7 @@ 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.** @@ -215,6 +240,12 @@ alt="Open Snippet with Variables"> ### 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 From 8bb2057a1db81c9f00c7cf8c3fc37517e9fe8561 Mon Sep 17 00:00:00 2001 From: Taha Basri Date: Mon, 7 Apr 2025 18:30:04 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md: Reorder and clarify entries for version 4.0.0 --- CHANGELOG.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de7c956..a73a2d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,21 @@ # Change Log ### 4.0.0 -- [[#108](https://github.com/tahabasri/snippets/pull/108)] - - Improved logging capabilities - - Updated FAQ documentation - - Fixed security vulnerabilities -- [[#110](https://github.com/tahabasri/snippets/pull/110)] - - Fixed tooltip descriptions - - Enforced value change before updating snippet/folder -- [[#111](https://github.com/tahabasri/snippets/pull/111)] - - Removed duplicate languages in language selector - - Sorted languages by alias for better navigation -- [[#112](https://github.com/tahabasri/snippets/pull/112)] Added action buttons for improved usability -- [[#115](https://github.com/tahabasri/snippets/pull/115)] Added ability to import VS Code snippets to cursor position - [[#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