summaryrefslogtreecommitdiff
path: root/extension/src/continueIdeClient.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/continueIdeClient.ts')
-rw-r--r--extension/src/continueIdeClient.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index 03e5fbc5..a5a1c5dc 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -74,6 +74,12 @@ class IdeProtocolClient {
this.messenger?.send("workspaceDirectory", {
workspaceDirectory: this.getWorkspaceDirectory(),
});
+ break;
+ case "getUserSecret":
+ this.messenger?.send("getUserSecret", {
+ value: await this.getUserSecret(data.key),
+ });
+ break;
case "openFiles":
this.messenger?.send("openFiles", {
openFiles: this.getOpenFiles(),
@@ -130,6 +136,27 @@ class IdeProtocolClient {
openEditorAndRevealRange(filepath, undefined, vscode.ViewColumn.One);
}
+ async getUserSecret(key: string) {
+ // Check if secret already exists in VS Code settings (global)
+ let secret = vscode.workspace.getConfiguration("continue").get(key);
+ if (secret && secret !== "") return secret;
+
+ // If not, ask user for secret
+ while (typeof secret === "undefined" || secret === "") {
+ secret = await vscode.window.showInputBox({
+ prompt: `Enter secret for ${key}`,
+ password: true,
+ });
+ }
+
+ // Add secret to VS Code settings
+ vscode.workspace
+ .getConfiguration("continue")
+ .update(key, secret, vscode.ConfigurationTarget.Global);
+
+ return secret;
+ }
+
// ------------------------------------ //
// Initiate Request