Skip to content

Instantly share code, notes, and snippets.

@Bergiu
Created May 31, 2024 15:40
Show Gist options
  • Save Bergiu/d08a659d6ae655d60ba67712c55bfd4a to your computer and use it in GitHub Desktop.
Save Bergiu/d08a659d6ae655d60ba67712c55bfd4a to your computer and use it in GitHub Desktop.
VS Code Copilot Custom Instructions
  1. Open the folder containing the copilot-chat extension: ~/.vscode-server/extensions/github.copilot-chat-0.15.2
  2. Beautify the dist/extension.js with this tool: https://beautifier.io/
  3. Beautify the package.nls.json with this tool: python3 -m json.tool
  4. Apply patch
diff --git a/dist/extension.js b/dist/extension.js
index 358a505..e27104d 100644
--- a/dist/extension.js
+++ b/dist/extension.js
@@ -1491,6 +1491,9 @@ var yre = P((Xlt, vNe) => {
commands: [{
name: "doc",
description: "%copilot.workspace.doc.description%"
+ }, {
+ name: "improve",
+ description: "%copilot.workspace.improve.description%"
}, {
name: "fix",
description: "%copilot.workspace.fix.description%"
@@ -1519,6 +1522,10 @@ var yre = P((Xlt, vNe) => {
}, {
name: "tests",
description: "%copilot.workspace.tests.description%"
+ }, {
+ name: "improve",
+ description: "%copilot.workspace.improve.description%",
+ sampleRequest: "%copilot.workspace.improve.sampleRequest%"
}, {
name: "fix",
description: "%copilot.workspace.fix.description%",
@@ -1632,6 +1639,11 @@ var yre = P((Xlt, vNe) => {
title: "%github.copilot.command.generateTests%",
enablement: "!github.copilot.interactiveSession.disabled && !editorReadonly",
category: "GitHub Copilot"
+ }, {
+ command: "github.copilot.interactiveEditor.improve",
+ title: "%github.copilot.command.improveThis%",
+ enablement: "!github.copilot.interactiveSession.disabled && !editorReadonly",
+ category: "GitHub Copilot"
}, {
command: "github.copilot.interactiveEditor.fix",
title: "%github.copilot.command.fixThis%",
@@ -1745,6 +1757,10 @@ var yre = P((Xlt, vNe) => {
command: "github.copilot.interactiveEditor.explain",
when: "!github.copilot.interactiveSession.disabled && !editorReadonly",
group: "copilotAction@1"
+ }, {
+ command: "github.copilot.interactiveEditor.improve",
+ when: "!github.copilot.interactiveSession.disabled && !editorReadonly",
+ group: "copilotAction@6"
}, {
command: "github.copilot.interactiveEditor.fix",
when: "!github.copilot.interactiveSession.disabled && !editorReadonly",
@@ -84004,6 +84020,10 @@ function SCe(t) {
message: "/tests ",
autoSend: !0,
initialRange: en.window.activeTextEditor?.selection
+ }), cImprove = () => en.commands.executeCommand("vscode.editorChat.start", {
+ message: "/refactor Replace this with a more idiomatic or efficient solution.",
+ autoSend: !0,
+ initialRange: en.window.activeTextEditor?.selection
}), c = () => {
let u = en.window.activeTextEditor;
if (!u) return;
@@ -84015,7 +84035,7 @@ function SCe(t) {
initialRange: en.window.activeTextEditor?.selection
})
};
- return e.add(en.commands.registerCommand("github.copilot.interactiveEditor.explain", r)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.explain.palette", () => r(void 0, !0))), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.review", () => n(void 0, !1))), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.review.palette", () => n(void 0, !0))), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.discardReviews", i)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.generate", o)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.generateDocs", s)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.generateTests", a)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.fix", c)), e.add(en.languages.registerCodeActionsProvider("*", new Zy(t), {
+ return e.add(en.commands.registerCommand("github.copilot.interactiveEditor.explain", r)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.explain.palette", () => r(void 0, !0))), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.review", () => n(void 0, !1))), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.review.palette", () => n(void 0, !0))), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.discardReviews", i)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.generate", o)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.generateDocs", s)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.generateTests", a)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.improve", cImprove)), e.add(en.commands.registerCommand("github.copilot.interactiveEditor.fix", c)), e.add(en.languages.registerCodeActionsProvider("*", new Zy(t), {
providedCodeActionKinds: Zy.providedCodeActionKinds
})), e.add(en.languages.registerCodeActionsProvider("*", new L2(t), {
providedCodeActionKinds: L2.providedCodeActionKinds
diff --git a/package.json b/package.json
index 444b87c..8c2902a 100644
--- a/package.json
+++ b/package.json
@@ -135,6 +135,10 @@
"name": "doc",
"description": "%copilot.workspace.doc.description%"
},
+ {
+ "name": "improve",
+ "description": "%copilot.workspace.improve.description%"
+ },
{
"name": "fix",
"description": "%copilot.workspace.fix.description%"
@@ -172,6 +176,11 @@
"name": "tests",
"description": "%copilot.workspace.tests.description%"
},
+ {
+ "name": "improve",
+ "description": "%copilot.workspace.improve.description%",
+ "sampleRequest": "%copilot.workspace.improve.sampleRequest%"
+ },
{
"name": "fix",
"description": "%copilot.workspace.fix.description%",
@@ -318,6 +327,12 @@
"enablement": "!github.copilot.interactiveSession.disabled && !editorReadonly",
"category": "GitHub Copilot"
},
+ {
+ "command": "github.copilot.interactiveEditor.improve",
+ "title": "%github.copilot.command.improveThis%",
+ "enablement": "!github.copilot.interactiveSession.disabled && !editorReadonly",
+ "category": "GitHub Copilot"
+ },
{
"command": "github.copilot.interactiveEditor.fix",
"title": "%github.copilot.command.fixThis%",
@@ -499,6 +514,11 @@
"when": "!github.copilot.interactiveSession.disabled && !editorReadonly",
"group": "copilotAction@1"
},
+ {
+ "command": "github.copilot.interactiveEditor.improve",
+ "when": "!github.copilot.interactiveSession.disabled && !editorReadonly",
+ "group": "copilotAction@6"
+ },
{
"command": "github.copilot.interactiveEditor.fix",
"when": "!github.copilot.interactiveSession.disabled && !editorReadonly",
diff --git a/package.nls.json b/package.nls.json
index 17bfa20..24d051a 100644
--- a/package.nls.json
+++ b/package.nls.json
@@ -7,6 +7,7 @@
"github.copilot.command.explainThis": "Explain This",
"github.copilot.command.reviewThis": "Review This",
"github.copilot.command.fixThis": "Fix This",
+ "github.copilot.command.improveThis": "Refactor This",
"github.copilot.command.generateThis": "Generate This",
"github.copilot.command.generateDocs": "Generate Docs",
"github.copilot.command.generateTests": "Generate Tests",
@@ -55,7 +56,9 @@
"copilot.workspace.review.description": "Review the selected code in your active editor",
"copilot.workspace.doc.description": "Add documentation comment for this symbol",
"copilot.workspace.tests.description": "Generate unit tests for the selected code",
+ "copilot.workspace.improve.description": "Replace this code with a more ideocratic solution",
"copilot.workspace.fix.description": "Propose a fix for the problems in the selected code",
+ "copilot.workspace.improve.sampleRequest": "Replace this code with a more ideocratic solution.",
"copilot.workspace.fix.sampleRequest": "There is a problem in this code. Rewrite the code to show it with the bug fixed.",
"copilot.workspace.new.description": "Scaffold code for a new workspace",
"copilot.workspace.new.sampleRequest": "Create a RESTful API server using typescript",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment