chore: format code

This commit is contained in:
GitHub Action
2025-11-08 01:59:02 +00:00
parent 16357e8041
commit 34ff87d504
182 changed files with 940 additions and 3646 deletions

View File

@@ -6,48 +6,39 @@ import * as vscode from "vscode"
const TERMINAL_NAME = "opencode"
export function activate(context: vscode.ExtensionContext) {
let openNewTerminalDisposable = vscode.commands.registerCommand(
"opencode.openNewTerminal",
async () => {
await openTerminal()
},
)
let openNewTerminalDisposable = vscode.commands.registerCommand("opencode.openNewTerminal", async () => {
await openTerminal()
})
let 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
}
let 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
}
await openTerminal()
},
)
await openTerminal()
})
let addFilepathDisposable = vscode.commands.registerCommand(
"opencode.addFilepathToTerminal",
async () => {
const fileRef = getActiveFile()
if (!fileRef) {
return
}
let addFilepathDisposable = vscode.commands.registerCommand("opencode.addFilepathToTerminal", async () => {
const fileRef = getActiveFile()
if (!fileRef) {
return
}
const terminal = vscode.window.activeTerminal
if (!terminal) {
return
}
const terminal = vscode.window.activeTerminal
if (!terminal) {
return
}
if (terminal.name === TERMINAL_NAME) {
// @ts-ignore
const port = terminal.creationOptions.env?.["_EXTENSION_OPENCODE_PORT"]
port ? await appendPrompt(parseInt(port), fileRef) : terminal.sendText(fileRef)
terminal.show()
}
},
)
if (terminal.name === TERMINAL_NAME) {
// @ts-ignore
const port = terminal.creationOptions.env?.["_EXTENSION_OPENCODE_PORT"]
port ? await appendPrompt(parseInt(port), fileRef) : terminal.sendText(fileRef)
terminal.show()
}
})
context.subscriptions.push(openTerminalDisposable, addFilepathDisposable)