diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/package.json | 50 | ||||
-rw-r--r-- | extension/src/continueIdeClient.ts | 9 | ||||
-rw-r--r-- | extension/src/debugPanel.ts | 18 | ||||
-rw-r--r-- | extension/src/lang-server/codeLens.ts | 7 | ||||
-rw-r--r-- | extension/src/suggestions.ts | 1 |
5 files changed, 76 insertions, 9 deletions
diff --git a/extension/package.json b/extension/package.json index 8c9905dd..9d0ef3ac 100644 --- a/extension/package.json +++ b/extension/package.json @@ -155,7 +155,55 @@ "visibility": "visible" } ] - } + }, + "walkthroughs": [ + { + "id": "continue", + "title": "Getting Started with Continue", + "description": "Learn how to effectively use Continue", + "steps": [ + { + "id": "edit", + "title": "Highlight and Edit", + "description": "This step will run a command and check off once it has been run.\n[Run Command](command:getting-started-sample.runCommand)", + "media": { + "image": "media/image.png", + "altText": "Empty image" + }, + "completionEvents": [ + "onCommand:continue.acceptSuggestion" + ] + }, + { + "id": "explain", + "title": "Ask Questions", + "description": "This step will change a setting and check off when the setting has changed\n[Change Setting](command:getting-started-sample.changeSetting)", + "media": { + "markdown": "media/walkthrough.md" + }, + "completionEvents": [] + }, + { + "id": "generate", + "title": "Generate Files from Scratch", + "description": "Ask Continue to create a file from scratch.", + "media": { + "markdown": "media/walkthrough.md" + }, + "completionEvents": [] + }, + { + "id": "commands", + "title": "Use a Slash Command", + "description": "Highlight some code then type '/explain' followed by a question. Slash commands let you select exactly the function you'd like Continue to perform. Others include '/edit' (to edit code), '/comment' (to comment code), and '/feedback' (to share with us what you think of Continue).", + "media": { + "markdown": "media/walkthrough.md" + }, + "completionEvents": [] + } + ] + } + ] }, "scripts": { "vscode:prepublish": "npm run esbuild-base -- --minify", diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 2e641054..1ccc070c 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -1,5 +1,6 @@ // import { ShowSuggestionRequest } from "../schema/ShowSuggestionRequest"; import { + editorSuggestionsLocked, showSuggestion as showSuggestionInEditor, SuggestionRanges, } from "./suggestions"; @@ -119,6 +120,9 @@ class IdeProtocolClient { this.openFile(data.filepath); // TODO: Close file if False break; + case "setSuggestionsLocked": + this.setSuggestionsLocked(data.filepath, data.locked); + break; case "showSuggestion": this.showSuggestion(data.edit); break; @@ -204,6 +208,11 @@ class IdeProtocolClient { openEditorAndRevealRange(filepath, undefined, vscode.ViewColumn.One); } + setSuggestionsLocked(filepath: string, locked: boolean) { + editorSuggestionsLocked.set(filepath, locked); + // TODO: Rerender? + } + async getUserSecret(key: string) { // Check if secret already exists in VS Code settings (global) let secret = vscode.workspace.getConfiguration("continue").get(key); diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index 4f3d097c..b176eee7 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -113,7 +113,13 @@ class WebsocketConnection { if (typeof message !== "string") { message = JSON.stringify(message); } - this._ws.send(message); + if (this._ws.readyState === WebSocket.OPEN) { + this._ws.send(message); + } else { + this._ws.addEventListener("open", () => { + this._ws.send(message); + }); + } } public close() { @@ -231,7 +237,9 @@ export function setupDebugPanel( apiUrl: getContinueServerUrl(), sessionId, vscMediaUrl, - dataSwitchOn: vscode.workspace.getConfiguration("continue").get<boolean>("dataSwitch") + dataSwitchOn: vscode.workspace + .getConfiguration("continue") + .get<boolean>("dataSwitch"), }); // // Listen for changes to server URL in settings @@ -249,10 +257,10 @@ export function setupDebugPanel( break; } case "toggleDataSwitch": { - // Set the setting in vscode + // Set the setting in vscode await vscode.workspace - .getConfiguration("continue") - .update("dataSwitch", data.on, vscode.ConfigurationTarget.Global); + .getConfiguration("continue") + .update("dataSwitch", data.on, vscode.ConfigurationTarget.Global); break; } case "websocketForwardingOpen": { diff --git a/extension/src/lang-server/codeLens.ts b/extension/src/lang-server/codeLens.ts index 5b55589c..03a9a0a7 100644 --- a/extension/src/lang-server/codeLens.ts +++ b/extension/src/lang-server/codeLens.ts @@ -1,5 +1,5 @@ import * as vscode from "vscode"; -import { editorToSuggestions } from "../suggestions"; +import { editorToSuggestions, editorSuggestionsLocked } from "../suggestions"; class SuggestionsCodeLensProvider implements vscode.CodeLensProvider { public provideCodeLenses( @@ -10,6 +10,7 @@ class SuggestionsCodeLensProvider implements vscode.CodeLensProvider { if (!suggestions) { return []; } + const locked = editorSuggestionsLocked.get(document.uri.fsPath.toString()); const codeLenses: vscode.CodeLens[] = []; for (const suggestion of suggestions) { @@ -20,12 +21,12 @@ class SuggestionsCodeLensProvider implements vscode.CodeLensProvider { codeLenses.push( new vscode.CodeLens(range, { title: "Accept ✅", - command: "continue.acceptSuggestion", + command: locked ? "" : "continue.acceptSuggestion", arguments: [suggestion], }), new vscode.CodeLens(range, { title: "Reject ❌", - command: "continue.rejectSuggestion", + command: locked ? "" : "continue.rejectSuggestion", arguments: [suggestion], }) ); diff --git a/extension/src/suggestions.ts b/extension/src/suggestions.ts index 8bed202c..e269f38a 100644 --- a/extension/src/suggestions.ts +++ b/extension/src/suggestions.ts @@ -17,6 +17,7 @@ export const editorToSuggestions: Map< string, // URI of file SuggestionRanges[] > = new Map(); +export const editorSuggestionsLocked: Map<string, boolean> = new Map(); // Map from editor URI to whether the suggestions are locked export const currentSuggestion: Map<string, number> = new Map(); // Map from editor URI to index of current SuggestionRanges in editorToSuggestions // When tab is reopened, rerender the decorations: |