diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-27 11:23:55 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-27 11:23:55 -0700 |
commit | 5d973490687c40922f2b7a2ddf2a3e19c207eb0f (patch) | |
tree | fab63009bd6014cd8ded1bd0a536727e0228b055 /extension/src | |
parent | 4e47da8398ac1cecb6f7100568f0f7296baaeac9 (diff) | |
download | sncontinue-5d973490687c40922f2b7a2ddf2a3e19c207eb0f.tar.gz sncontinue-5d973490687c40922f2b7a2ddf2a3e19c207eb0f.tar.bz2 sncontinue-5d973490687c40922f2b7a2ddf2a3e19c207eb0f.zip |
feat: :loud_sound: give users access to Continue server logs
can see logs in ~/.continue/continue.log
Diffstat (limited to 'extension/src')
-rw-r--r-- | extension/src/activation/activate.ts | 4 | ||||
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 11 | ||||
-rw-r--r-- | extension/src/commands.ts | 13 | ||||
-rw-r--r-- | extension/src/continueIdeClient.ts | 13 | ||||
-rw-r--r-- | extension/src/extension.ts | 17 |
5 files changed, 46 insertions, 12 deletions
diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index 430f9f4a..40f1bbd5 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -22,6 +22,10 @@ function getExtensionVersionInt(versionString: string): number { export async function activateExtension(context: vscode.ExtensionContext) { extensionContext = context; console.log("Using Continue version: ", getExtensionVersion()); + console.log( + "In workspace: ", + vscode.workspace.workspaceFolders?.[0].uri.fsPath + ); // Before anything else, check whether this is an out-of-date version of the extension // Do so by grabbing the package.json off of the GitHub respository for now. fetch(PACKAGE_JSON_RAW_GITHUB_URL) diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 5a9345a6..c8998bee 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -53,7 +53,16 @@ async function retryThenFail( } } finally { console.log("After retries, failed to set up Continue extension", msg); - vscode.window.showErrorMessage(msg); + vscode.window + .showErrorMessage(msg, "View Logs", "Retry") + .then((selection) => { + if (selection === "View Logs") { + vscode.commands.executeCommand("continue.viewLogs"); + } else if (selection === "Retry") { + // Reload VS Code window + vscode.commands.executeCommand("workbench.action.reloadWindow"); + } + }); } throw e; diff --git a/extension/src/commands.ts b/extension/src/commands.ts index 1da2f04e..35d466e8 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -1,9 +1,6 @@ import * as vscode from "vscode"; -import { - decorationManager, - showAnswerInTextEditor, - showGutterSpinner, -} from "./decorations"; +import * as path from "path"; +import * as os from "os"; import { acceptSuggestionCommand, rejectSuggestionCommand, @@ -65,6 +62,12 @@ const commandsMap: { [command: string]: (...args: any) => any } = { ideProtocolClient.sendMainUserInput(text); } }, + "continue.viewLogs": async () => { + // Open ~/.continue/continue.log + const logFile = path.join(os.homedir(), ".continue", "continue.log"); + const uri = vscode.Uri.file(logFile); + await vscode.window.showTextDocument(uri); + }, }; export function registerAllCommands(context: vscode.ExtensionContext) { diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 4e6f0494..157b59cb 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -72,9 +72,16 @@ class IdeProtocolClient { }); messenger.onMessage((messageType, data, messenger) => { this.handleMessage(messageType, data, messenger).catch((err) => { - vscode.window.showErrorMessage( - "Error handling message from Continue server: " + err.message - ); + vscode.window + .showErrorMessage( + "Error handling message from Continue server: " + err.message, + "View Logs" + ) + .then((selection) => { + if (selection === "View Logs") { + vscode.commands.executeCommand("continue.viewLogs"); + } + }); }); }); } diff --git a/extension/src/extension.ts b/extension/src/extension.ts index f2e580a1..802b12bc 100644 --- a/extension/src/extension.ts +++ b/extension/src/extension.ts @@ -10,9 +10,20 @@ async function dynamicImportAndActivate(context: vscode.ExtensionContext) { await activateExtension(context); } catch (e) { console.log("Error activating extension: ", e); - vscode.window.showInformationMessage( - "Error activating the Continue extension." - ); + vscode.window + .showInformationMessage( + "Error activating the Continue extension.", + "View Logs", + "Retry" + ) + .then((selection) => { + if (selection === "View Logs") { + vscode.commands.executeCommand("continue.viewLogs"); + } else if (selection === "Retry") { + // Reload VS Code window + vscode.commands.executeCommand("workbench.action.reloadWindow"); + } + }); } } |