From f8bc06261464cd46c31a23cc8cbc0e76fb642d18 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 21 Jun 2023 08:47:06 -0700 Subject: purging old extension code --- extension/src/commands.ts | 91 ++--------------------------------------------- 1 file changed, 2 insertions(+), 89 deletions(-) (limited to 'extension/src/commands.ts') diff --git a/extension/src/commands.ts b/extension/src/commands.ts index 22e15c43..13357c99 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -3,7 +3,6 @@ import { decorationManager, showAnswerInTextEditor, showGutterSpinner, - writeAndShowUnitTest, } from "./decorations"; import { acceptSuggestionCommand, @@ -12,19 +11,9 @@ import { suggestionUpCommand, } from "./suggestions"; import * as bridge from "./bridge"; -import { debugPanelWebview, setupDebugPanel } from "./debugPanel"; -// import { openCapturedTerminal } from "./terminal/terminalEmulator"; -import { getRightViewColumn } from "./util/vscode"; -import { - findSuspiciousCode, - runPythonScript, - writeUnitTestForFunction, -} from "./bridge"; +import { debugPanelWebview } from "./debugPanel"; +import { writeUnitTestForFunction } from "./bridge"; import { sendTelemetryEvent, TelemetryEvent } from "./telemetry"; -import { getLanguageLibrary } from "./languages"; -import { SerializedDebugContext } from "./client"; -import { addFileSystemToDebugContext } from "./util/util"; -import { ideProtocolClient } from "./activation/activate"; // Copy everything over from extension.ts const commandsMap: { [command: string]: (...args: any) => any } = { @@ -71,68 +60,9 @@ const commandsMap: { [command: string]: (...args: any) => any } = { // Happens in webview resolution function // openCapturedTerminal(); }, - "continue.findSuspiciousCode": async ( - debugContext: SerializedDebugContext - ) => { - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: "Finding suspicious code", - cancellable: false, - }, - async (progress, token) => { - let suspiciousCode = await findSuspiciousCode(debugContext); - debugContext.rangesInFiles = suspiciousCode; - let { filesystem } = addFileSystemToDebugContext(debugContext); - debugPanelWebview?.postMessage({ - type: "findSuspiciousCode", - codeLocations: suspiciousCode, - filesystem, - }); - } - ); - }, - "continue.debugTest": async (fileAndFunctionSpecifier: string) => { - sendTelemetryEvent(TelemetryEvent.AutoDebugThisTest); - let editor = vscode.window.activeTextEditor; - if (editor) editor.document.save(); - let { stdout } = await runPythonScript("run_unit_test.py", [ - fileAndFunctionSpecifier, - ]); - let traceback = getLanguageLibrary( - fileAndFunctionSpecifier.split("::")[0] - ).parseFirstStacktrace(stdout); - if (!traceback) { - vscode.window.showInformationMessage("The test passes!"); - return; - } - vscode.commands.executeCommand("continue.openContinueGUI").then(() => { - setTimeout(() => { - debugPanelWebview?.postMessage({ - type: "traceback", - value: traceback, - }); - }, 500); - }); - }, }; const textEditorCommandsMap: { [command: string]: (...args: any) => {} } = { - "continue.writeUnitTest": async (editor: vscode.TextEditor) => { - let position = editor.selection.active; - - let gutterSpinnerKey = showGutterSpinner(editor, position.line); - try { - let test = await writeUnitTestForFunction( - editor.document.fileName, - position - ); - writeAndShowUnitTest(editor.document.fileName, test); - } catch { - } finally { - decorationManager.deleteDecoration(gutterSpinnerKey); - } - }, "continue.writeDocstring": async (editor: vscode.TextEditor, _) => { sendTelemetryEvent(TelemetryEvent.GenerateDocstring); let gutterSpinnerKey = showGutterSpinner( @@ -199,20 +129,3 @@ async function answerQuestion( } ); } - -// async function suggestFixForAllWorkspaceProblems() { -// Something like this, just figure out the loops for diagnostics vs problems -// let problems = vscode.languages.getDiagnostics(); -// let codeSuggestions = await Promise.all(problems.map((problem) => { -// return bridge.suggestFixForProblem(problem[0].fsPath, problem[1]); -// })); -// for (const [uri, diagnostics] of problems) { -// for (let i = 0; i < diagnostics.length; i++) { -// let diagnostic = diagnostics[i]; -// let suggestedCode = codeSuggestions[i]; -// // If you're going to do this for a bunch of files at once, it will show the unsaved icon in the tab -// // BUT it would be better to have a single window to review all edits -// showSuggestion(uri.fsPath, diagnostic.range, suggestedCode) -// } -// } -// } -- cgit v1.2.3-70-g09d2 From cc7ef4631f8f1bd141788c8e3117df1aca16b308 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 21 Jun 2023 15:02:20 -0700 Subject: removing captured terminal --- extension/src/activation/activate.ts | 37 +++--------------------------------- extension/src/commands.ts | 5 ----- extension/src/continueIdeClient.ts | 14 +++----------- 3 files changed, 6 insertions(+), 50 deletions(-) (limited to 'extension/src/commands.ts') diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index 32726c86..34abdff7 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -8,7 +8,7 @@ import * as path from "path"; import IdeProtocolClient from "../continueIdeClient"; import { getContinueServerUrl } from "../bridge"; import { setupDebugPanel, ContinueGUIWebviewViewProvider } from "../debugPanel"; -import { CapturedTerminal } from "../terminal/terminalEmulator"; +// import { CapturedTerminal } from "../terminal/terminalEmulator"; export let extensionContext: vscode.ExtensionContext | undefined = undefined; @@ -49,41 +49,10 @@ export function activateExtension( })(); // All opened terminals should be replaced by our own terminal - vscode.window.onDidOpenTerminal((terminal) => { - if (terminal.name === "Continue") { - return; - } - const options = terminal.creationOptions; - const capturedTerminal = new CapturedTerminal({ - ...options, - name: "Continue", - }); - terminal.dispose(); - if (!ideProtocolClient.continueTerminal) { - ideProtocolClient.continueTerminal = capturedTerminal; - } - }); + // vscode.window.onDidOpenTerminal((terminal) => {}); // If any terminals are open to start, replace them - vscode.window.terminals.forEach((terminal) => { - if (terminal.name === "Continue") { - return; - } - const options = terminal.creationOptions; - const capturedTerminal = new CapturedTerminal( - { - ...options, - name: "Continue", - }, - (commandOutput: string) => { - ideProtocolClient.sendCommandOutput(commandOutput); - } - ); - terminal.dispose(); - if (!ideProtocolClient.continueTerminal) { - ideProtocolClient.continueTerminal = capturedTerminal; - } - }); + // vscode.window.terminals.forEach((terminal) => {} extensionContext = context; } diff --git a/extension/src/commands.ts b/extension/src/commands.ts index 22e15c43..291a3ceb 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -13,7 +13,6 @@ import { } from "./suggestions"; import * as bridge from "./bridge"; import { debugPanelWebview, setupDebugPanel } from "./debugPanel"; -// import { openCapturedTerminal } from "./terminal/terminalEmulator"; import { getRightViewColumn } from "./util/vscode"; import { findSuspiciousCode, @@ -67,10 +66,6 @@ const commandsMap: { [command: string]: (...args: any) => any } = { type: "focusContinueInput", }); }, - "continue.openCapturedTerminal": () => { - // Happens in webview resolution function - // openCapturedTerminal(); - }, "continue.findSuspiciousCode": async ( debugContext: SerializedDebugContext ) => { diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index fbad5f5d..202077de 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -12,7 +12,6 @@ import { debugPanelWebview, setupDebugPanel } from "./debugPanel"; import { FileEditWithFullContents } from "../schema/FileEditWithFullContents"; import fs = require("fs"); import { WebsocketMessenger } from "./util/messenger"; -import { CapturedTerminal } from "./terminal/terminalEmulator"; import { decorationManager } from "./decorations"; class IdeProtocolClient { @@ -326,17 +325,10 @@ class IdeProtocolClient { return rangeInFiles; } - public continueTerminal: CapturedTerminal | undefined; - async runCommand(command: string) { - if (!this.continueTerminal || this.continueTerminal.isClosed()) { - this.continueTerminal = new CapturedTerminal({ - name: "Continue", - }); - } - - this.continueTerminal.show(); - return await this.continueTerminal.runCommand(command); + const terminal = vscode.window.createTerminal(); + terminal.show(); + terminal.sendText(command); } sendCommandOutput(output: string) { -- cgit v1.2.3-70-g09d2