From 39a574696469968eaf5c06af6ec8b993051dafa8 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:52:30 -0700 Subject: [PATCH] Find shell integration script for VS Code 1.94+ It got moved. --- src/utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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"), "''");