Skip to content

Commit

Permalink
support powershell call operator
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueBlue21 authored Jan 13, 2025
1 parent 56e39b9 commit 1bba0dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/zigMainCodeLens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1bba0dc

Please sign in to comment.