The open source coding agent.
TypeScript
vscode: bring oc terminal to front if already opened
Frank3eb982c8cd5a
diff --git a/sdks/vscode/src/extension.ts b/sdks/vscode/src/extension.tsindex 49a05f641f1..fa6e5c55f4f 100644--- a/sdks/vscode/src/extension.ts+++ b/sdks/vscode/src/extension.ts@@ -8,6 +8,13 @@ export function activate(context: vscode.ExtensionContext) {// Register command to open terminal in split screen and run opencodelet openTerminalDisposable = vscode.commands.registerCommand("opencode.openTerminal", async () => {+ // An opencode terminal already exists => focus it+ const existingTerminal = vscode.window.terminals.find((t) => t.name === TERMINAL_NAME)+ if (existingTerminal) {+ existingTerminal.show()+ return+ }+// Create a new terminal in split screenconst port = Math.floor(Math.random() * (65535 - 16384 + 1)) + 16384const terminal = vscode.window.createTerminal({