From 1bba0dc8004e37384038a7731cf0e201d2c1c059 Mon Sep 17 00:00:00 2001 From: BlueBlue <49936395+BlueBlue21@users.noreply.github.com> Date: Tue, 14 Jan 2025 02:22:08 +0900 Subject: [PATCH] support powershell call operator --- src/zigMainCodeLens.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zigMainCodeLens.ts b/src/zigMainCodeLens.ts index 4943778..b8ca644 100644 --- a/src/zigMainCodeLens.ts +++ b/src/zigMainCodeLens.ts @@ -44,13 +44,14 @@ function zigRun() { if (!zigPath) return; const filePath = vscode.window.activeTextEditor.document.uri.fsPath; const terminal = vscode.window.createTerminal("Run Zig Program"); + const callOperator = /(powershell.exe$|powershell$|pwsh.exe$|pwsh$)/.test(vscode.env.shell) ? "& " : ""; terminal.show(); const wsFolder = getWorkspaceFolder(filePath); if (wsFolder && isWorkspaceFile(filePath) && hasBuildFile(wsFolder.uri.fsPath)) { - terminal.sendText(`${escapePath(zigPath)} build run`); + terminal.sendText(`${callOperator}${escapePath(zigPath)} build run`); return; } - terminal.sendText(`${escapePath(zigPath)} run ${escapePath(filePath)}`); + terminal.sendText(`${callOperator}${escapePath(zigPath)} run ${escapePath(filePath)}`); } function escapePath(rawPath: string): string {