diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa1f848..a73a2d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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 ✌.
diff --git a/README.md b/README.md
index ec2ad86..d2c0c6f 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,15 @@ 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.
+
+> When Action Buttons are enabled, they become the primary method for interacting with Snippets in the Tree view, replacing the default click behavior.
+
+
+
## Customize
### Set icons for your folders
@@ -159,6 +169,10 @@ alt="Global Prefix">
+### 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 +213,38 @@ alt="Manually Bind Snippets to Languages">
+## 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.
+
+- Save prompts as snippets and use them directly in Github Copilot.
+
+
+
+- Use code snippets directly in Github Copilot
+
+
+
+### 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 +253,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 +261,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
diff --git a/images/features/14-ai-ask-copilot.gif b/images/features/14-ai-ask-copilot.gif
new file mode 100644
index 0000000..567ad29
Binary files /dev/null and b/images/features/14-ai-ask-copilot.gif differ
diff --git a/images/features/15-add-to-copilot-snippet.gif b/images/features/15-add-to-copilot-snippet.gif
new file mode 100644
index 0000000..5c2538f
Binary files /dev/null and b/images/features/15-add-to-copilot-snippet.gif differ
diff --git a/images/features/16-ai-gemini.gif b/images/features/16-ai-gemini.gif
new file mode 100644
index 0000000..60c3628
Binary files /dev/null and b/images/features/16-ai-gemini.gif differ
diff --git a/images/features/17-ai-cursor.gif b/images/features/17-ai-cursor.gif
new file mode 100644
index 0000000..58e3322
Binary files /dev/null and b/images/features/17-ai-cursor.gif differ
diff --git a/images/features/18-action-buttons.png b/images/features/18-action-buttons.png
new file mode 100644
index 0000000..3357306
Binary files /dev/null and b/images/features/18-action-buttons.png differ
diff --git a/images/release/release-cover.gif b/images/release/release-cover.gif
index 4bcccfc..b10b956 100644
Binary files a/images/release/release-cover.gif and b/images/release/release-cover.gif differ
diff --git a/package.json b/package.json
index 0bc6828..05766a4 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",
@@ -608,12 +613,12 @@
{
"command": "globalSnippetsCmd.addToCursorAIPane",
"when": "view == snippetsExplorer && viewItem =~ /^snippet(:\\S+)?$/ && snippets.host == cursor",
- "group": "5_copilot@1"
+ "group": "5_cursor@1"
},
{
"command": "globalSnippetsCmd.addAsCodeSnippetToCursorAIPane",
"when": "view == snippetsExplorer && viewItem =~ /^snippet(:\\S+)?$/ && snippets.host == cursor",
- "group": "5_copilot@2"
+ "group": "5_cursor@2"
},
{
"command": "globalSnippetsCmd.addToGeminiCodeAssist",
@@ -708,12 +713,12 @@
{
"command": "globalSnippetsCmd.addToCursorAIPane",
"when": "view == wsSnippetsExplorer && viewItem =~ /^snippet(:\\S+)?$/ && snippets.host == cursor",
- "group": "5_copilot@1"
+ "group": "5_cursor@1"
},
{
"command": "globalSnippetsCmd.addAsCodeSnippetToCursorAIPane",
"when": "view == wsSnippetsExplorer && viewItem =~ /^snippet(:\\S+)?$/ && snippets.host == cursor",
- "group": "5_copilot@2"
+ "group": "5_cursor@2"
},
{
"command": "globalSnippetsCmd.addToGeminiCodeAssist",
diff --git a/src/config/commands.ts b/src/config/commands.ts
index e705f7e..0d72fbd 100644
--- a/src/config/commands.ts
+++ b/src/config/commands.ts
@@ -434,9 +434,11 @@ export async function addToChat(snippet: Snippet | undefined, snippetService: Sn
try {
await vscode.commands.executeCommand(chatCommand);
const oldContent = await vscode.env.clipboard.readText();
- vscode.env.clipboard.writeText(snippet.value);
- vscode.commands.executeCommand('editor.action.clipboardPasteAction');
- vscode.env.clipboard.writeText(oldContent);
+ vscode.env.clipboard.writeText(snippet.value).then(() => {
+ vscode.commands.executeCommand('editor.action.clipboardPasteAction').then(() => {
+ setTimeout(() => vscode.env.clipboard.writeText(oldContent), 100);
+ });
+ });
} catch (error) {
LoggingUtility.getInstance().error('' + error);
}
@@ -457,9 +459,11 @@ export async function addAsCodeSnippetToChat(snippet: Snippet | undefined, snipp
try {
await vscode.commands.executeCommand(chatCommand);
const oldContent = await vscode.env.clipboard.readText();
- vscode.env.clipboard.writeText(`\n\`\`\`\n${snippet.value}\n\`\`\`\n`);
- vscode.commands.executeCommand('editor.action.clipboardPasteAction');
- vscode.env.clipboard.writeText(oldContent);
+ vscode.env.clipboard.writeText(`\n\`\`\`\n${snippet.value}\n\`\`\`\n`).then(() => {
+ vscode.commands.executeCommand('editor.action.clipboardPasteAction').then(() => {
+ setTimeout(() => vscode.env.clipboard.writeText(oldContent), 100);
+ });
+ });
} catch (error) {
LoggingUtility.getInstance().error('' + error);
}
diff --git a/src/extension.ts b/src/extension.ts
index 9853304..f30ac9c 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -20,7 +20,7 @@ import { LoggingUtility } from './utility/loggingUtility';
*/
export function activate(context: vscode.ExtensionContext) {
// exact version for which show Changelog panel
- const changelogVersion = '3.1.0';
+ const changelogVersion = '4.0.0';
//** variables **//
// global settings
@@ -87,8 +87,18 @@ 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
+ if (vscode.hasOwnProperty('cursor')) {
+ vscode.commands.executeCommand(
+ setContextCmd, contextHostStateKey, 'cursor'
+ );
+ } else {
+ 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')
diff --git a/views/editSnippet.html b/views/editSnippet.html
index 5a27c48..6480fbf 100644
--- a/views/editSnippet.html
+++ b/views/editSnippet.html
@@ -26,7 +26,7 @@
-