diff --git a/src/utils.ts b/src/utils.ts index 9ae6e8f03a..7ea266e9c7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -4,10 +4,17 @@ import os = require("os"); import path = require("path"); import vscode = require("vscode"); +import { satisfies } from "semver"; export const PowerShellLanguageId = "powershell"; -export const ShellIntegrationScript = path.join(vscode.env.appRoot, "out", "vs", "workbench", "contrib", "terminal", "browser", "media", "shellIntegration.ps1"); +// Path to the shell integration script in the VS Code installation +// See https://github.com/microsoft/vscode/pull/227244 +const shellIntegrationMoved = satisfies(vscode.version, ">=1.94", { includePrerelease: true }); +export const ShellIntegrationScript = path.join(vscode.env.appRoot, "out", "vs", "workbench", "contrib", "terminal", + shellIntegrationMoved ? "common" : "browser", + shellIntegrationMoved ? "scripts" : "media", + "shellIntegration.ps1"); export function escapeSingleQuotes(p: string): string { return p.replace(new RegExp("'", "g"), "''");