From c31d7169e651d9fd37cdcaf4d69859d55c5a5e49 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 12 Jul 2023 15:19:57 -0700 Subject: purging more --- extension/src/commands.ts | 92 +---------------------------------------------- 1 file changed, 1 insertion(+), 91 deletions(-) (limited to 'extension/src') diff --git a/extension/src/commands.ts b/extension/src/commands.ts index ffb67ab5..0b002549 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -21,35 +21,6 @@ import { ideProtocolClient } from "./activation/activate"; // Copy everything over from extension.ts const commandsMap: { [command: string]: (...args: any) => any } = { - "continue.askQuestion": (data: any, webviewView: vscode.WebviewView) => { - if (!vscode.workspace.workspaceFolders) { - return; - } - - answerQuestion( - data.question, - vscode.workspace.workspaceFolders[0].uri.fsPath, - webviewView.webview - ); - }, - "continue.askQuestionFromInput": () => { - vscode.window - .showInputBox({ placeHolder: "Ask away!" }) - .then((question) => { - if (!question || !vscode.workspace.workspaceFolders) { - return; - } - - sendTelemetryEvent(TelemetryEvent.UniversalPromptQuery, { - query: question, - }); - - answerQuestion( - question, - vscode.workspace.workspaceFolders[0].uri.fsPath - ); - }); - }, "continue.suggestionDown": suggestionDownCommand, "continue.suggestionUp": suggestionUpCommand, "continue.acceptSuggestion": acceptSuggestionCommand, @@ -73,27 +44,6 @@ const commandsMap: { [command: string]: (...args: any) => any } = { if (text) { ideProtocolClient.sendMainUserInput(text); } - vscode.commands.executeCommand("continue.continueGUIView.focus"); - }, -}; - -const textEditorCommandsMap: { [command: string]: (...args: any) => {} } = { - "continue.writeDocstring": async (editor: vscode.TextEditor, _) => { - sendTelemetryEvent(TelemetryEvent.GenerateDocstring); - let gutterSpinnerKey = showGutterSpinner( - editor, - editor.selection.active.line - ); - - const { lineno, docstring } = await bridge.writeDocstringForFunction( - editor.document.fileName, - editor.selection.active - ); - // Can't use the edit given above after an async call - editor.edit((edit) => { - edit.insert(new vscode.Position(lineno, 0), docstring); - decorationManager.deleteDecoration(gutterSpinnerKey); - }); }, }; @@ -103,44 +53,4 @@ export function registerAllCommands(context: vscode.ExtensionContext) { vscode.commands.registerCommand(command, callback) ); } - - for (const [command, callback] of Object.entries(textEditorCommandsMap)) { - context.subscriptions.push( - vscode.commands.registerTextEditorCommand(command, callback) - ); - } -} - -async function answerQuestion( - question: string, - workspacePath: string, - webview: vscode.Webview | undefined = undefined -) { - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: "Anwering question...", - cancellable: false, - }, - async (progress, token) => { - try { - let resp = await bridge.askQuestion(question, workspacePath); - // Send the answer back to the webview - if (webview) { - webview.postMessage({ - type: "answerQuestion", - answer: resp.answer, - }); - } - showAnswerInTextEditor(resp.filename, resp.range, resp.answer); - } catch (error: any) { - if (webview) { - webview.postMessage({ - type: "answerQuestion", - answer: error, - }); - } - } - } - ); -} +} \ No newline at end of file -- cgit v1.2.3-70-g09d2