Merge pull request #138 from continuedev/remove-terminal
removing captured terminal
This commit is contained in:
commit
a09e8564d6
3 changed files with 9 additions and 49 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
) => {
|
||||
|
|
|
|||
|
|
@ -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,14 @@ class IdeProtocolClient {
|
|||
return rangeInFiles;
|
||||
}
|
||||
|
||||
public continueTerminal: CapturedTerminal | undefined;
|
||||
|
||||
async runCommand(command: string) {
|
||||
if (!this.continueTerminal || this.continueTerminal.isClosed()) {
|
||||
this.continueTerminal = new CapturedTerminal({
|
||||
name: "Continue",
|
||||
});
|
||||
if (vscode.window.terminals.length) {
|
||||
vscode.window.terminals[0].sendText(command);
|
||||
} else {
|
||||
const terminal = vscode.window.createTerminal();
|
||||
terminal.show();
|
||||
terminal.sendText(command);
|
||||
}
|
||||
|
||||
this.continueTerminal.show();
|
||||
return await this.continueTerminal.runCommand(command);
|
||||
}
|
||||
|
||||
sendCommandOutput(output: string) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue