diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-05 16:28:58 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-05 16:28:58 -0700 |
commit | ec408c7654cb74398a78a7348609635760926114 (patch) | |
tree | 42550544bfc62966cb4e77b44858852999354c65 | |
parent | dd5214994f167e4aa9ee986c6b441bc21ffadf42 (diff) | |
download | sncontinue-ec408c7654cb74398a78a7348609635760926114.tar.gz sncontinue-ec408c7654cb74398a78a7348609635760926114.tar.bz2 sncontinue-ec408c7654cb74398a78a7348609635760926114.zip |
setting to show codelens in diff editor
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 3 | ||||
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 2 | ||||
-rw-r--r-- | extension/react-app/src/main.tsx | 4 | ||||
-rw-r--r-- | extension/src/diffs.ts | 6 | ||||
-rw-r--r-- | extension/src/lang-server/codeLens.ts | 24 |
6 files changed, 35 insertions, 8 deletions
diff --git a/extension/package-lock.json b/extension/package-lock.json index 169b13b5..6e527583 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.111", + "version": "0.0.112", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.111", + "version": "0.0.112", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 6a0f9eb3..413e5b89 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "The open-source coding autopilot", - "version": "0.0.111", + "version": "0.0.112", "publisher": "Continue", "engines": { "vscode": "^1.67.0" @@ -39,6 +39,7 @@ "onView:continueGUIView" ], "main": "./out/extension.js", + "browser": "./out/extension.js", "contributes": { "configuration": { "title": "Continue", diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 545be32a..61c9ab1e 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -198,7 +198,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { // cmd+enter to /edit if (event.metaKey) { - event.currentTarget.value = `/edit ${event.currentTarget}`; + event.currentTarget.value = `/edit ${event.currentTarget.value}`; } if (props.onEnter) props.onEnter(event); setInputValue(""); diff --git a/extension/react-app/src/main.tsx b/extension/react-app/src/main.tsx index 1b94dc82..0b02575c 100644 --- a/extension/react-app/src/main.tsx +++ b/extension/react-app/src/main.tsx @@ -8,6 +8,10 @@ import { PostHogProvider } from "posthog-js/react"; posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", { api_host: "https://app.posthog.com", + session_recording: { + // WARNING: Only enable this if you understand the security implications + recordCrossOriginIframes: true, + } as any, }); ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index b70c3b59..178b1a9d 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -47,6 +47,12 @@ class DiffManager { if (!editor) { throw new Error("No active text editor found for Continue Diff"); } + + // Change the vscode setting to allow codeLens in diff editor + vscode.workspace + .getConfiguration("diffEditor", editor.document.uri) + .update("codeLens", true, vscode.ConfigurationTarget.Global); + return editor; } diff --git a/extension/src/lang-server/codeLens.ts b/extension/src/lang-server/codeLens.ts index 08435a3b..381a0084 100644 --- a/extension/src/lang-server/codeLens.ts +++ b/extension/src/lang-server/codeLens.ts @@ -67,11 +67,9 @@ class DiffViewerCodeLensProvider implements vscode.CodeLensProvider { document: vscode.TextDocument, token: vscode.CancellationToken ): vscode.CodeLens[] | Thenable<vscode.CodeLens[]> { - if (path.dirname(document.uri.fsPath) !== DIFF_DIRECTORY) { - return []; - } else { + if (path.dirname(document.uri.fsPath) === DIFF_DIRECTORY) { const codeLenses: vscode.CodeLens[] = []; - const range = new vscode.Range(0, 0, 0, 0); + const range = new vscode.Range(0, 0, 1, 0); codeLenses.push( new vscode.CodeLens(range, { title: "Accept ✅", @@ -85,6 +83,24 @@ class DiffViewerCodeLensProvider implements vscode.CodeLensProvider { }) ); return codeLenses; + } else { + return []; + } + } + + onDidChangeCodeLenses?: vscode.Event<void> | undefined; + + constructor(emitter?: vscode.EventEmitter<void>) { + if (emitter) { + this.onDidChangeCodeLenses = emitter.event; + this.onDidChangeCodeLenses(() => { + if (vscode.window.activeTextEditor) { + this.provideCodeLenses( + vscode.window.activeTextEditor.document, + new vscode.CancellationTokenSource().token + ); + } + }); } } } |