From 7a42c84eacc5be863b281d818ce38242abc5f258 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:01:11 -0800 Subject: [PATCH 1/8] Improve warning when additional PowerShell isn't found Since we added logic which searches for possible intended permutations of the given additional PowerShell path, we needed to make the warning show only if none of the permutations were found. This was accomplished by suppressing it in the first iterator and then yielding it again after the permutations were exhausted with the warning unsuppressed. --- src/platform.ts | 18 +++++---- test/core/platform.test.ts | 77 +++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 8 deletions(-) diff --git a/src/platform.ts b/src/platform.ts index 5e63dca6bd..706c9f56e2 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -239,17 +239,17 @@ export class PowerShellExeFinder { } exePath = untildify(exePath); - - // Always search for what the user gave us first - yield new PossiblePowerShellExe(exePath, versionName); - - // Also search for `pwsh[.exe]` and `powershell[.exe]` if missing const args: [string, undefined, boolean, boolean] // Must be a tuple type and is suppressing the warning = [versionName, undefined, true, true]; - // Handle Windows where '.exe' and 'powershell' are things + // Always search for what the user gave us first, but with the warning + // suppressed so we can display it after all possibilities are exhausted + yield new PossiblePowerShellExe(exePath, ...args); + + // Also search for `pwsh[.exe]` and `powershell[.exe]` if missing if (this.platformDetails.operatingSystem === OperatingSystem.Windows) { + // Handle Windows where '.exe' and 'powershell' are things if (!exePath.endsWith("pwsh.exe") && !exePath.endsWith("powershell.exe")) { if (exePath.endsWith("pwsh") || exePath.endsWith("powershell")) { // Add extension if that was missing @@ -260,9 +260,13 @@ export class PowerShellExeFinder { yield new PossiblePowerShellExe(path.join(exePath, "pwsh.exe"), ...args); yield new PossiblePowerShellExe(path.join(exePath, "powershell.exe"), ...args); } - } else if (!exePath.endsWith("pwsh")) { // Always just 'pwsh' on non-Windows + } else if (!exePath.endsWith("pwsh")) { + // Always just 'pwsh' on non-Windows yield new PossiblePowerShellExe(path.join(exePath, "pwsh"), ...args); } + + // If we're still being iterated over, no permutation of the given path existed so yield an object with the warning unsuppressed + yield new PossiblePowerShellExe(exePath, versionName, false, undefined, false); } } } diff --git a/test/core/platform.test.ts b/test/core/platform.test.ts index 853b550685..299e125626 100644 --- a/test/core/platform.test.ts +++ b/test/core/platform.test.ts @@ -468,7 +468,17 @@ if (process.platform === "win32") { isProcess64Bit: true, }, environmentVars: {}, + // Note that for each given path, we expect: + // 1. The path as-is. + // 2. Any expected permutations of the path (for example, with a tilde or folder expanded, and/or '.exe' added). + // 3. The path as-is again (in order for a warning to be displayed at the correct time). + // An improvement here would be to check the suppressWarning field, but it's not currently exposed. expectedPowerShellSequence: [ + { + exePath: "C:\\Users\\test\\pwsh\\pwsh.exe", + displayName: "pwsh", + supportsProperArguments: true + }, { exePath: "C:\\Users\\test\\pwsh\\pwsh.exe", displayName: "pwsh", @@ -479,6 +489,11 @@ if (process.platform === "win32") { displayName: "pwsh-tilde", supportsProperArguments: true }, + { + exePath: path.join(os.homedir(), "pwsh", "pwsh.exe"), + displayName: "pwsh-tilde", + supportsProperArguments: true + }, { exePath: "C:\\Users\\test\\pwsh\\pwsh", displayName: "pwsh-no-exe", @@ -499,6 +514,11 @@ if (process.platform === "win32") { displayName: "pwsh-no-exe", supportsProperArguments: true }, + { + exePath: "C:\\Users\\test\\pwsh\\pwsh", + displayName: "pwsh-no-exe", + supportsProperArguments: true + }, { exePath: "C:\\Users\\test\\pwsh\\", displayName: "pwsh-folder", @@ -514,6 +534,11 @@ if (process.platform === "win32") { displayName: "pwsh-folder", supportsProperArguments: true }, + { + exePath: "C:\\Users\\test\\pwsh\\", + displayName: "pwsh-folder", + supportsProperArguments: true + }, { exePath: "C:\\Users\\test\\pwsh", displayName: "pwsh-folder-no-slash", @@ -534,6 +559,16 @@ if (process.platform === "win32") { displayName: "pwsh-folder-no-slash", supportsProperArguments: true }, + { + exePath: "C:\\Users\\test\\pwsh", + displayName: "pwsh-folder-no-slash", + supportsProperArguments: true + }, + { + exePath: "C:\\Users\\test\\pwsh\\pwsh.exe", + displayName: "pwsh-single-quotes", + supportsProperArguments: true + }, { exePath: "C:\\Users\\test\\pwsh\\pwsh.exe", displayName: "pwsh-single-quotes", @@ -544,6 +579,11 @@ if (process.platform === "win32") { displayName: "pwsh-double-quotes", supportsProperArguments: true }, + { + exePath: "C:\\Users\\test\\pwsh\\pwsh.exe", + displayName: "pwsh-double-quotes", + supportsProperArguments: true + }, ], filesystem: {}, } @@ -760,19 +800,34 @@ if (process.platform === "win32") { successAdditionalTestCases = [ { // Also sufficient for macOS as the behavior is the same - name: "Linux (Additional PowerShell Executables)", + name: "Linux/macOS (Additional PowerShell Executables)", platformDetails: { operatingSystem: platform.OperatingSystem.Linux, isOS64Bit: true, isProcess64Bit: true, }, environmentVars: {}, + // Note that for each given path, we expect: + // 1. The path as-is. + // 2. Any expected permutations of the path (for example, with a tilde or folder expanded). + // 3. The path as-is again (in order for a warning to be displayed at the correct time). + // An improvement here would be to check the suppressWarning field, but it's not currently exposed. expectedPowerShellSequence: [ { exePath: "/home/bin/pwsh", displayName: "pwsh", supportsProperArguments: true }, + { + exePath: "/home/bin/pwsh", + displayName: "pwsh", + supportsProperArguments: true + }, + { + exePath: path.join(os.homedir(), "bin", "pwsh"), + displayName: "pwsh-tilde", + supportsProperArguments: true + }, { exePath: path.join(os.homedir(), "bin", "pwsh"), displayName: "pwsh-tilde", @@ -788,6 +843,11 @@ if (process.platform === "win32") { displayName: "pwsh-folder", supportsProperArguments: true }, + { + exePath: "/home/bin/", + displayName: "pwsh-folder", + supportsProperArguments: true + }, { exePath: "/home/bin", displayName: "pwsh-folder-no-slash", @@ -798,6 +858,16 @@ if (process.platform === "win32") { displayName: "pwsh-folder-no-slash", supportsProperArguments: true }, + { + exePath: "/home/bin", + displayName: "pwsh-folder-no-slash", + supportsProperArguments: true + }, + { + exePath: "/home/bin/pwsh", + displayName: "pwsh-single-quotes", + supportsProperArguments: true + }, { exePath: "/home/bin/pwsh", displayName: "pwsh-single-quotes", @@ -808,6 +878,11 @@ if (process.platform === "win32") { displayName: "pwsh-double-quotes", supportsProperArguments: true }, + { + exePath: "/home/bin/pwsh", + displayName: "pwsh-double-quotes", + supportsProperArguments: true + }, ], filesystem: {}, } From 3c71fcf08ee2b99d18cc6b44a0f835fc066d121d Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 21 Nov 2024 12:12:06 -0800 Subject: [PATCH 2/8] Fix additional PowerShell warning (take two) Since Show Session Menu always fully enumerates the iterator we needed to move the existence check into the generator. Fortunately the 'exists' method was already idempotent. I'd like this to be cleaner, but at least the tests now make sense (and required a stub fix). --- src/platform.ts | 34 ++++-- test/core/platform.test.ts | 210 ++++++++++--------------------------- 2 files changed, 85 insertions(+), 159 deletions(-) diff --git a/src/platform.ts b/src/platform.ts index 706c9f56e2..360fea1613 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -148,7 +148,7 @@ export class PowerShellExeFinder { // Also show any additionally configured PowerShells // These may be duplicates of the default installations, but given a different name. - for (const additionalPwsh of this.enumerateAdditionalPowerShellInstallations()) { + for await (const additionalPwsh of this.enumerateAdditionalPowerShellInstallations()) { if (await additionalPwsh.exists()) { yield additionalPwsh; } else if (!additionalPwsh.suppressWarning) { @@ -230,7 +230,7 @@ export class PowerShellExeFinder { * Iterates through the configured additional PowerShell executable locations, * without checking for their existence. */ - private *enumerateAdditionalPowerShellInstallations(): Iterable { + private async *enumerateAdditionalPowerShellInstallations(): AsyncIterable { for (const versionName in this.additionalPowerShellExes) { if (Object.prototype.hasOwnProperty.call(this.additionalPowerShellExes, versionName)) { let exePath: string | undefined = utils.stripQuotePair(this.additionalPowerShellExes[versionName]); @@ -245,7 +245,11 @@ export class PowerShellExeFinder { // Always search for what the user gave us first, but with the warning // suppressed so we can display it after all possibilities are exhausted - yield new PossiblePowerShellExe(exePath, ...args); + let pwsh = new PossiblePowerShellExe(exePath, ...args); + if (await pwsh.exists()) { + yield pwsh; + continue; + } // Also search for `pwsh[.exe]` and `powershell[.exe]` if missing if (this.platformDetails.operatingSystem === OperatingSystem.Windows) { @@ -253,16 +257,32 @@ export class PowerShellExeFinder { if (!exePath.endsWith("pwsh.exe") && !exePath.endsWith("powershell.exe")) { if (exePath.endsWith("pwsh") || exePath.endsWith("powershell")) { // Add extension if that was missing - yield new PossiblePowerShellExe(exePath + ".exe", ...args); + pwsh = new PossiblePowerShellExe(exePath + ".exe", ...args); + if (await pwsh.exists()) { + yield pwsh; + continue; + } } // Also add full exe names (this isn't an else just in case // the folder was named "pwsh" or "powershell") - yield new PossiblePowerShellExe(path.join(exePath, "pwsh.exe"), ...args); - yield new PossiblePowerShellExe(path.join(exePath, "powershell.exe"), ...args); + pwsh = new PossiblePowerShellExe(path.join(exePath, "pwsh.exe"), ...args); + if (await pwsh.exists()) { + yield pwsh; + continue; + } + pwsh = new PossiblePowerShellExe(path.join(exePath, "powershell.exe"), ...args); + if (await pwsh.exists()) { + yield pwsh; + continue; + } } } else if (!exePath.endsWith("pwsh")) { // Always just 'pwsh' on non-Windows - yield new PossiblePowerShellExe(path.join(exePath, "pwsh"), ...args); + pwsh = new PossiblePowerShellExe(path.join(exePath, "pwsh"), ...args); + if (await pwsh.exists()) { + yield pwsh; + continue; + } } // If we're still being iterated over, no permutation of the given path existed so yield an object with the warning unsuppressed diff --git a/test/core/platform.test.ts b/test/core/platform.test.ts index 299e125626..0953379639 100644 --- a/test/core/platform.test.ts +++ b/test/core/platform.test.ts @@ -18,10 +18,20 @@ import { stripQuotePair } from "../../src/utils"; const platformMock = rewire("../../src/platform"); // eslint-disable-next-line @typescript-eslint/require-await -async function fakeCheckIfFileOrDirectoryExists(targetPath: string | vscode.Uri): Promise { +async function fakeCheckIfFileExists(targetPath: string | vscode.Uri): Promise { try { - fs.lstatSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath); - return true; + const stat = fs.lstatSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath); + return stat.isFile(); + } catch { + return false; + } +} + +// eslint-disable-next-line @typescript-eslint/require-await +async function fakeCheckIfDirectoryExists(targetPath: string | vscode.Uri): Promise { + try { + const stat = fs.lstatSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath); + return stat.isDirectory(); } catch { return false; } @@ -33,8 +43,8 @@ async function fakeReadDirectory(targetPath: string | vscode.Uri): Promise Date: Sat, 16 Nov 2024 17:59:24 -0700 Subject: [PATCH 3/8] Optimize Launch Configs and Enable Hot Reload --- .vscode/launch.json | 127 -------- .vscode/tasks.json | 30 -- docs/development.md | 15 +- extension-dev.code-workspace | 231 --------------- package.json | 12 + pwsh-extension-dev.code-workspace | 477 ++++++++++++++++++++++++++++++ src/extension.ts | 60 +++- src/process.ts | 18 +- src/session.ts | 25 +- 9 files changed, 599 insertions(+), 396 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/tasks.json delete mode 100644 extension-dev.code-workspace create mode 100644 pwsh-extension-dev.code-workspace diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index c8375dfe52..0000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - // NOTE: These are not in the code-workspace file because StartDebugging cannot current resolve configs stored there so they have to be here for the Mocha Test Explorer feature. - // Ref: https://github.com/microsoft/vscode/issues/150663 - { - "name": "Launch Extension", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ], - "env": { - "__TEST_WORKSPACE_PATH": "${workspaceFolder}/examples", - }, - "sourceMaps": true, - // This speeds up source map detection and makes smartStep work correctly - "outFiles": [ - "${workspaceFolder}/**/*.js", - "!**/node_modules/**", - "!**/.vscode-test/**" - ], - "skipFiles": [ - "/**", - "**/node_modules/**", - "**/.vscode-test/**" - ], - "presentation": { - "hidden": false, - "group": "test", - "order": 2 - } - }, - { - // Runs the extension in an empty temp profile that is automatically cleaned up after use - // Undocumented: https://github.com/microsoft/vscode-docs/issues/6220 - "name": "Launch Extension - Temp Profile", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": [ - "--profile-temp", - "--extensionDevelopmentPath=${workspaceFolder}", - "${workspaceFolder}/examples" - ], - "sourceMaps": true, - // This speeds up source map detection and makes smartStep work correctly - "outFiles": [ - "${workspaceFolder}/**/*.js", - "!**/node_modules/**", - "!**/.vscode-test/**" - ], - "skipFiles": [ - "/**", - "**/node_modules/**", - "**/.vscode-test/**" - ], - "presentation": { - "hidden": false, - "group": "test", - "order": 2 - } - }, - { - // Runs the extension in an isolated but persistent profile separate from the user settings - // Undocumented: https://github.com/microsoft/vscode-docs/issues/6220 - "name": "Launch Extension - Isolated Profile", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": [ - "--profile=debug", - "--extensionDevelopmentPath=${workspaceFolder}", - "${workspaceFolder}/examples" - ], - "sourceMaps": true, - // This speeds up source map detection and makes smartStep work correctly - "outFiles": [ - "${workspaceFolder}/**/*.js", - "!**/node_modules/**", - "!**/.vscode-test/**" - ], - "skipFiles": [ - "/**", - "**/node_modules/**", - "**/.vscode-test/**" - ], - "presentation": { - "hidden": false, - "group": "test", - "order": 2 - } - }, - { - "name": "Test Extension", - "type": "node", - "request": "launch", - "program": "${workspaceFolder}/test/runTests.js", - "cascadeTerminateToConfigurations": [ - "ExtensionTests", - ], - // This speeds up source map detection and makes smartStep work correctly - "outFiles": [ - "${workspaceFolder}/**/*.js", - "!**/node_modules/**", - "!**/.vscode-test/**" - ], - "skipFiles": [ - "/**", - "**/node_modules/**", - "**/.vscode-test/**" - ], - "attachSimplePort": 59229, // The default is 9229 but we want to avoid conflicts because we will have two Code instances running. - "env": { - "__TEST_DEBUG_INSPECT_PORT": "59229" // Needs to match attachSimplePort - }, - "presentation": { - "hidden": false, - }, - "internalConsoleOptions": "neverOpen", - "console": "integratedTerminal", - "autoAttachChildProcesses": false, - "preLaunchTask": "watch-tests" - } - ] -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index fa53736684..0000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "watch-tests", - "icon": { - "color": "terminal.ansiCyan", - "id": "sync" - }, - "type": "npm", - "script": "watch-tests", - "group": "test", - "problemMatcher": "$tsc-watch", - "isBackground": true, - "dependsOn": "watch" - }, - { - "label": "watch", - "icon": { - "color": "terminal.ansiCyan", - "id": "sync" - }, - "type": "npm", - "script": "watch", - "group": "build", - "problemMatcher": "$esbuild-watch", - "isBackground": true - } - ] -} diff --git a/docs/development.md b/docs/development.md index 28b55750ab..c8e7cae79a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -56,10 +56,19 @@ Invoke-Build Build Explore the `vscode-powershell.build.ps1` file for other build targets. ### Launching the extension +First, ensure you have completed a build as instructed above, as the launch templates do not check some prerequisites for performance reasons. -To debug the extension use one of the provided `Launch Extension` debug configurations (remember to rebuild first). -You can simultaneously use the `Attach to Editor Services` configuration to attach the .NET debugger to the PowerShell process running the server. -Try the `powershell.developer.editorServicesWaitForDebugger` setting to attach before startup. +To debug the extension use one of the provided `Launch Extension` debug configurations. +1. `Launch Extension`: Launches the debugger using your personal profile settings. +2. `Temp Profile`: Launches VS Code with a temp profile that resets on every launch. Useful for "out of the box" environment testing. +3. `Isolated Profile`: Launches the debugger with a persistent debug profile specific to the extension, so you can preserve some settings or test certain prerequisites. + +All three templates use pre-launch tasks to build the code, and support automatic restart of the extension host on changes to the Extension source code. [Hot Reload](https://devblogs.microsoft.com/dotnet/introducing-net-hot-reload/) is also enabled for PowerShell Editor Services. + +> [!WARNING] +> There is a current limitation that, if you restart the extension/extension host or it is restarted due to a extension code change, the editor services attachment will be disconnected due to the PSES terminal being terminated, and you will either need to restart the debug session completely, or do a manual build of PSES and run the `Attach to Editor Services` debug launch manually. + +Try the `powershell.developer.editorServicesWaitForDebugger` setting to ensure that you are fully attached before the extension startup process continues. ## Contributing Snippets diff --git a/extension-dev.code-workspace b/extension-dev.code-workspace deleted file mode 100644 index d4e7a6aa4a..0000000000 --- a/extension-dev.code-workspace +++ /dev/null @@ -1,231 +0,0 @@ -{ - "folders": [ - { - "name": "Client", - "path": "." - }, - { - "name": "Server", - "path": "../PowerShellEditorServices" - } - ], - "extensions": { - "recommendations": [ - "davidanson.vscode-markdownlint", - "dbaeumer.vscode-eslint", - "editorconfig.editorconfig", - "josefpihrt-vscode.roslynator", - "ms-azure-devops.azure-pipelines", - "ms-dotnettools.csharp", - "ms-vscode.powershell", - "hbenl.vscode-mocha-test-adapter", - "connor4312.esbuild-problem-matchers" - ] - }, - "settings": { - "window.title": "PowerShell VS Code Extension Development", - "debug.onTaskErrors": "prompt", - "editor.tabSize": 4, - "editor.insertSpaces": true, - "files.trimTrailingWhitespace": true, - "files.insertFinalNewline": true, - "files.associations": { - "**/snippets/*.json": "jsonc", // Use JSONC instead of JSON because that's how VS Code interprets snippet files, and it enables better source documentation. - "**/.vsts-ci/**/*.yml": "azure-pipelines", - }, - // Ignore the Markdown rule: - "markdownlint.config": { - "MD024": false // no-duplicate-header - }, - "powershell.cwd": "Client", - "powershell.codeFormatting.autoCorrectAliases": true, - "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": true, - "powershell.codeFormatting.newLineAfterCloseBrace": false, - "powershell.codeFormatting.trimWhitespaceAroundPipe": true, - "powershell.codeFormatting.useCorrectCasing": true, - "powershell.codeFormatting.whitespaceBeforeOpenBrace": false, - "powershell.codeFormatting.whitespaceBetweenParameters": true, - "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", - "typescript.tsdk": "Client/node_modules/typescript/lib", // Lock the TypeScript SDK path to the version we use - "typescript.format.semicolons": "insert", // Code actions like "organize imports" ignore ESLint, so we need this here - "eslint.format.enable": true, // Enable ESLint as defaut formatter so quick fixes can be applied directly - "[typescript]": { - "editor.defaultFormatter": "dbaeumer.vscode-eslint", - "editor.formatOnPaste": true, - "editor.formatOnSave": true, - "editor.formatOnSaveMode": "modificationsIfAvailable" - }, - "mochaExplorer.configFile": ".mocharc.json", - "mochaExplorer.launcherScript": "test/runTests", - "mochaExplorer.autoload": false, // The test instance pops up every time discovery or run is done, this could be annoying on startup. - "mochaExplorer.debuggerPort": 59229, // Matches the launch config, we dont want to use the default port as we are launching a duplicate instance of vscode and it might conflict. - "mochaExplorer.ipcRole": "server", - "mochaExplorer.ipcTimeout": 30000, // 30 seconds - "testExplorer.useNativeTesting": true, - "mochaExplorer.env": { - "VSCODE_VERSION": "insiders", - "ELECTRON_RUN_AS_NODE": null - } - }, - "tasks": { - "version": "2.0.0", - "windows": { - "options": { - "shell": { - "executable": "pwsh.exe", - "args": [ - "-NoProfile", - "-ExecutionPolicy", - "Bypass", - "-Command" - ] - } - } - }, - "linux": { - "options": { - "shell": { - "executable": "pwsh", - "args": [ - "-NoProfile", - "-Command" - ] - } - } - }, - "osx": { - "options": { - "shell": { - "executable": "/usr/local/bin/pwsh", - "args": [ - "-NoProfile", - "-Command" - ] - } - } - }, - "tasks": [ - { - "label": "Build", - "type": "shell", - "options": { - "cwd": "${workspaceFolder:Client}" - }, - "command": "Invoke-Build Build", - "problemMatcher": [ - "$msCompile", - "$tsc" - ], - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "Test Client", - "type": "shell", - "options": { - "cwd": "${workspaceFolder:Client}" - }, - "command": "Invoke-Build Test", - "problemMatcher": [ - "$msCompile", - "$tsc" - ], - "group": { - "kind": "test", - "isDefault": true - } - }, - { - "label": "Test Server", - "type": "shell", - "options": { - "cwd": "${workspaceFolder:Server}" - }, - "problemMatcher": [ - "$msCompile" - ], - "command": "Invoke-Build TestPS74", - "group": { - "kind": "test", - "isDefault": true - } - }, - { - "label": "Invoke-Build Client", - "type": "shell", - "options": { - "cwd": "${workspaceFolder:Client}" - }, - "command": "Invoke-Build ${input:clientBuildCommand}", - "group": "build" - }, - { - "label": "Invoke-Build Server", - "type": "shell", - "options": { - "cwd": "${workspaceFolder:Server}" - }, - "command": "Invoke-Build ${input:serverBuildCommand}", - "group": "build" - } - ], - "inputs": [ - { - "type": "pickString", - "id": "clientBuildCommand", - "description": "Which Invoke-Build Client Task?", - "options": [ - "Restore", - "Clean", - "Build", - "Test", - "Package" - ], - "default": "Clean" - }, - { - "type": "pickString", - "id": "serverBuildCommand", - "description": "Which Invoke-Build Server Task?", - "options": [ - "SetupDotNet", - "BinClean", - "Clean", - "Build", - "Test", - "TestPS74", - "TestE2EPwsh", - "TestPS51", - "TestE2EPowerShell", - ], - "default": "Clean" - } - ] - }, - "launch": { - "version": "0.2.0", - "configurations": [ - { - // https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "name": "Attach to Editor Services", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}", - "justMyCode": false, - "suppressJITOptimizations": true, - "symbolOptions": { - "searchPaths": [], - "searchMicrosoftSymbolServer": true, - "searchNuGetOrgSymbolServer": true - }, - "presentation": { - "hidden": false, - "group": "test", - "order": 3 - } - } - ] - } -} diff --git a/package.json b/package.json index bb448383fb..45ef2b467c 100644 --- a/package.json +++ b/package.json @@ -300,7 +300,19 @@ "title": "Move panel to bottom", "category": "PowerShell", "icon": "$(layout-panel-right)" + }, + { + "title": "[PowerShell Debug Input Task] Wait for and return PSES startup PID", + "command": "PowerShell.WaitForPsesActivationAndReturnProcessId", + "enablement": "false" + }, + { + "title": "[PowerShell Debug Input Task] Get the VS Code Session ID for writing the PID file", + "command": "GetVsCodeSessionId", + "enablement": "false" } + + ], "menus": { "commandPalette": [ diff --git a/pwsh-extension-dev.code-workspace b/pwsh-extension-dev.code-workspace new file mode 100644 index 0000000000..9f243c5754 --- /dev/null +++ b/pwsh-extension-dev.code-workspace @@ -0,0 +1,477 @@ +{ + "folders": [ + { + "name": "Client", + "path": "." + }, + { + "name": "Server", + "path": "../PowerShellEditorServices" + } + ], + + "extensions": { + "recommendations": [ + "davidanson.vscode-markdownlint", + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig", + "ms-dotnettools.csharp", + "ms-vscode.powershell", + "hbenl.vscode-mocha-test-adapter", + "connor4312.esbuild-problem-matchers" + ] + }, + "settings": { + "window.title": "PowerShell VS Code Extension Development", + "debug.onTaskErrors": "prompt", + "editor.tabSize": 4, + "editor.insertSpaces": true, + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "files.associations": { + "**/snippets/*.json": "jsonc", // Use JSONC instead of JSON because that's how VS Code interprets snippet files, and it enables better source documentation. + }, + // Ignore the Markdown rule: + "markdownlint.config": { + "MD024": false // no-duplicate-header + }, + "powershell.cwd": "Client", + "powershell.codeFormatting.autoCorrectAliases": true, + "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": true, + "powershell.codeFormatting.newLineAfterCloseBrace": false, + "powershell.codeFormatting.trimWhitespaceAroundPipe": true, + "powershell.codeFormatting.useCorrectCasing": true, + "powershell.codeFormatting.whitespaceBeforeOpenBrace": false, + "powershell.codeFormatting.whitespaceBetweenParameters": true, + "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", + "typescript.tsdk": "Client/node_modules/typescript/lib", // Lock the TypeScript SDK path to the version we use + "typescript.format.semicolons": "insert", // Code actions like "organize imports" ignore ESLint, so we need this here + "eslint.format.enable": true, // Enable ESLint as defaut formatter so quick fixes can be applied directly + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnPaste": true, + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "modificationsIfAvailable" + }, + "mochaExplorer.configFile": ".mocharc.json", + "mochaExplorer.launcherScript": "test/runTests", + "mochaExplorer.autoload": false, // The test instance pops up every time discovery or run is done, this could be annoying on startup. + "mochaExplorer.debuggerPort": 59229, // Matches the launch config, we dont want to use the default port as we are launching a duplicate instance of vscode and it might conflict. + "mochaExplorer.ipcRole": "server", + "mochaExplorer.ipcTimeout": 30000, // 30 seconds + "testExplorer.useNativeTesting": true, + "mochaExplorer.env": { + "VSCODE_VERSION": "insiders", + "ELECTRON_RUN_AS_NODE": null + } + }, + "tasks": { + "version": "2.0.0", + "windows": { + "options": { + "shell": { + "executable": "pwsh.exe", + "args": [ + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-Command" + ] + } + } + }, + "linux": { + "options": { + "shell": { + "executable": "pwsh", + "args": [ + "-NoProfile", + "-Command" + ] + } + } + }, + "osx": { + "options": { + "shell": { + "executable": "/usr/local/bin/pwsh", + "args": [ + "-NoProfile", + "-Command" + ] + } + } + }, + "tasks": [ + { + "label": "Build", + "icon": { + "id": "tools", + }, + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Client}" + }, + "command": "Invoke-Build Build", + "problemMatcher": [ + "$msCompile", + "$tsc" + ], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Extension: Watch", + "type": "shell", + "isBackground": true, + "options": { + "cwd": "${workspaceFolder:Client}" + }, + "command": "npm run watch", + "problemMatcher": { + "owner": "esbuild-watch", + "pattern": { + "regexp": "^\\[ERROR\\] (.+)\\n\\n\\s+([^:]+):(\\d+):(\\d+):", + "message": 1, + "file": 2, + "line": 3, + "column": 4, + }, + "background": { + "activeOnStart": true, + "beginsPattern": "^\\[watch\\] build started", + "endsPattern": "^\\[watch\\] build finished" + } + }, + "icon": { + "id": "sync", + "color": "terminal.ansiCyan" + }, + "group": { + "kind": "build", + } + }, + { + "label": "PSES: BuildIfChanged", + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Server}" + }, + "command": "Invoke-Build BuildIfChanged", + "problemMatcher": "$msCompile", + "icon": { + "id": "tools", + "color": "terminal.ansiCyan" + }, + "group": { + "kind": "build", + } + }, + { + "label": "PreLaunch", + "dependsOn": [ + "Extension: Watch", + "PSES: BuildIfChanged" + ], + "dependsOrder": "parallel" + }, + { + "label": "Test Client", + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Client}" + }, + "command": "Invoke-Build Test", + "problemMatcher": [ + "$msCompile", + "$tsc" + ], + "group": { + "kind": "test", + "isDefault": true + } + }, + { + "label": "Test Server", + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Server}" + }, + "problemMatcher": [ + "$msCompile" + ], + "command": "Invoke-Build TestPS74", + "group": { + "kind": "test", + "isDefault": true + } + }, + { + "label": "Invoke-Build Client", + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Client}" + }, + "command": "Invoke-Build ${input:clientBuildCommand}", + "group": "build" + }, + { + "label": "Invoke-Build Server", + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Server}" + }, + "command": "Invoke-Build ${input:serverBuildCommand}", + "group": "build" + } + ], + "inputs": [ + { + "type": "pickString", + "id": "clientBuildCommand", + "description": "Which Invoke-Build Client Task?", + "options": [ + "Restore", + "Clean", + "Build", + "Test", + "Package" + ], + "default": "Clean" + }, + { + "type": "pickString", + "id": "serverBuildCommand", + "description": "Which Invoke-Build Server Task?", + "options": [ + "SetupDotNet", + "BinClean", + "Clean", + "Build", + "Test", + "TestPS74", + "TestE2EPwsh", + "TestPS51", + "TestE2EPowerShell", + ], + "default": "Clean" + } + ], + + }, + "launch": { + "version": "0.2.0", + "compounds": [ + { + "name": "Launch Extension", + "configurations": [ + "Launch", + "PowerShell Editor Services" + ], + "preLaunchTask": "Build", + "stopAll": true, + "presentation": { + "hidden": false, + "group": "Test", + "order": 1 + } + }, + { + "name": "Launch Extension - Temp Profile", + "configurations": [ + "Launch-Temp", + "PowerShell Editor Services" + ], + "preLaunchTask": "PreLaunch", + "stopAll": true, + "presentation": { + "hidden": false, + "group": "Test", + "order": 2 + } + }, + { + "name": "Launch Extension - Isolated Profile", + "configurations": [ + "Launch-Isolated", + "PowerShell Editor Services" + ], + "preLaunchTask": "Build", + "stopAll": true, + "presentation": { + "hidden": false, + "group": "Test", + "order": 3 + } + } + ], + "configurations": [ + { + "name": "Launch", + "type": "extensionHost", + "request": "launch", + "env": { + "VSCODE_PARENT_SESSION_ID": "${command:GetVsCodeSessionId}", + }, + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder:Client}", + "${workspaceFolder:Client}/examples" + ], + "sourceMaps": true, + // This speeds up source map detection and makes smartStep work correctly + "outFiles": [ + "${workspaceFolder:Client}/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**", + "**/app/out/vs/**" //Skips Extension Host internals + ], + "presentation": { + "hidden": true + } + }, + { + "name": "Launch-Temp", + "type": "extensionHost", + "request": "launch", + "env": { + "VSCODE_PARENT_SESSION_ID": "${command:GetVsCodeSessionId}", + }, + "runtimeExecutable": "${execPath}", + "args": [ + // Runs the extension in an empty temp profile that is automatically cleaned up after use + // Undocumented: https://github.com/microsoft/vscode-docs/issues/6220 + "--profile-temp", + "--extensionDevelopmentPath=${workspaceFolder:Client}", + "${workspaceFolder:Client}/examples" + ], + "sourceMaps": true, + // This speeds up source map detection and makes smartStep work correctly + "outFiles": [ + "${workspaceFolder:Client}/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**", + "**/app/out/vs/**", // Skips Extension Host internals + ], + "presentation": { + "hidden": true + } + }, + { + "name": "Launch-Isolated", + "type": "extensionHost", + "request": "launch", + "env": { + "VSCODE_PARENT_SESSION_ID": "${command:GetVsCodeSessionId}", + }, + "runtimeExecutable": "${execPath}", + "args": [ + // Runs the extension in an empty temp profile that is automatically cleaned up after use + // Undocumented: https://github.com/microsoft/vscode-docs/issues/6220 + "--profile=pwsh-debug", + "--extensionDevelopmentPath=${workspaceFolder:Client}", + "${workspaceFolder:Client}/examples" + ], + "sourceMaps": true, + // This speeds up source map detection and makes smartStep work correctly + "outFiles": [ + "${workspaceFolder:Client}/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**", + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**", + "**/app/out/vs/**" //Skips Extension Host internals + ], + "presentation": { + "hidden": true + } + }, + { + // https://code.visualstudio.com/docs/csharp/debugger-settings + "name": "Attach to Editor Services", + "type": "coreclr", + "request": "attach", + "processId": "${command:PowerShell.PickPSHostProcess}", + "justMyCode": true, + "suppressJITOptimizations": true, + "symbolOptions": { + "searchPaths": [], + "searchMicrosoftSymbolServer": false, + "searchNuGetOrgSymbolServer": false + }, + "presentation": { + "hidden": false, + "group": "Test", + "order": 5 + }, + "logging": { + "moduleLoad": false + }, + }, + { + // https://code.visualstudio.com/docs/csharp/debugger-settings + "name": "PowerShell Editor Services", + "type": "coreclr", + "request": "attach", + // Waits for the extension terminal to become available and gets the PID, saves having to enter it manually. + "processId": "${command:PowerShell.WaitForPsesActivationAndReturnProcessId}", + "justMyCode": true, + "suppressJITOptimizations": true, + "symbolOptions": { + "searchPaths": [], + "searchMicrosoftSymbolServer": false, + "searchNuGetOrgSymbolServer": false + }, + "presentation": { + "hidden": true + }, + "logging": { + "moduleLoad": false + } + }, + { + // Runs the extension in an isolated but persistent profile separate from the user settings + // Undocumented: https://github.com/microsoft/vscode-docs/issues/6220 + "name": "Launch Extension - Rename Test Cases", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--profile=debug", + "--extensionDevelopmentPath=${workspaceFolder:Client}", + "${workspaceFolder:Server}/test/PowerShellEditorServices.Test.Shared/Refactoring" + ], + "sourceMaps": true, + // This speeds up source map detection and makes smartStep work correctly + "outFiles": [ + "${workspaceFolder:Client}/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**" // Skips Extension Host internals + ], + "presentation": { + "hidden": true, + } + }, + ] + } +} diff --git a/src/extension.ts b/src/extension.ts index 8676724ab1..80a13657a2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -25,7 +25,6 @@ import { SessionManager } from "./session"; import { getSettings } from "./settings"; import { PowerShellLanguageId } from "./utils"; import { LanguageClientConsumer } from "./languageClientConsumer"; - // The 1DS telemetry key, which is just shared among all Microsoft extensions // (and isn't sensitive). const TELEMETRY_KEY = "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255"; @@ -44,6 +43,9 @@ const documentSelector: DocumentSelector = [ export async function activate(context: vscode.ExtensionContext): Promise { logger = new Logger(); + if (context.extensionMode === vscode.ExtensionMode.Development) { + restartOnExtensionFileChanges(context); + } telemetryReporter = new TelemetryReporter(TELEMETRY_KEY); @@ -151,7 +153,13 @@ export async function activate(context: vscode.ExtensionContext): Promise {logger.showLogPanel();} - ) + ), + vscode.commands.registerCommand( + "GetVsCodeSessionId", + () => vscode.env.sessionId + ), + // Register a command that waits for the Extension Terminal to be active. Can be used by .NET Attach Tasks. + registerWaitForPsesActivationCommand(context) ]; const externalApi = new ExternalApiFeature(context, sessionManager, logger); @@ -184,6 +192,54 @@ export async function activate(context: vscode.ExtensionContext): Promise { + const pidFileName = `PSES-${vscode.env.sessionId}.pid`; + const pidFile = vscode.Uri.joinPath(context.globalStorageUri, "sessions", pidFileName); + const fs = vscode.workspace.fs; + // Wait for the file to be created + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition + while (true) { + try { + const pidContent = await fs.readFile(pidFile); + const pid = parseInt(pidContent.toString(), 10); + try { + // Check if the process is still alive, delete the PID file if not and continue waiting. + // https://nodejs.org/api/process.html#process_process_kill_pid_signal + // "As a special case, a signal of 0 can be used to test for the existence of a process. " + const NODE_TEST_PROCESS_EXISTENCE = 0; + process.kill(pid, NODE_TEST_PROCESS_EXISTENCE); + } catch { + await fs.delete(pidFile); + continue; + } + // VSCode command returns for launch configurations *must* be string type explicitly, will error on number or otherwise. + return pidContent.toString(); + } catch { + // File doesn't exist yet, wait and try again + await new Promise(resolve => setTimeout(resolve, 1000)); + } + } + } + ); +} + +/** Restarts the extension host when extension file changes are detected. Useful for development. */ +function restartOnExtensionFileChanges(context: vscode.ExtensionContext): void { + const watcher = vscode.workspace.createFileSystemWatcher( + new vscode.RelativePattern(context.extensionPath, "dist/*.js") + ); + + context.subscriptions.push(watcher); + watcher.onDidChange(({ fsPath }) => { + vscode.window.showInformationMessage(`${fsPath.split(context.extensionPath, 2)[1]} changed. Reloading Extension Host...`); + vscode.commands.executeCommand("workbench.action.restartExtensionHost"); + }); +} + export async function deactivate(): Promise { // Clean up all extension features for (const commandRegistration of commandRegistrations) { diff --git a/src/process.ts b/src/process.ts index 052da2b8bf..f99b0cfa1b 100644 --- a/src/process.ts +++ b/src/process.ts @@ -23,6 +23,7 @@ export class PowerShellProcess { private consoleCloseSubscription?: vscode.Disposable; private pid?: number; + private pidUpdateEmitter?: vscode.EventEmitter; constructor( public exePath: string, @@ -33,10 +34,13 @@ export class PowerShellProcess { private logDirectoryPath: vscode.Uri, private startPsesArgs: string, private sessionFilePath: vscode.Uri, - private sessionSettings: Settings) { + private sessionSettings: Settings, + private devMode = false + ) { this.onExitedEmitter = new vscode.EventEmitter(); this.onExited = this.onExitedEmitter.event; + this.pidUpdateEmitter = new vscode.EventEmitter(); } public async start(cancellationToken: vscode.CancellationToken): Promise { @@ -103,7 +107,7 @@ export class PowerShellProcess { // When VS Code shell integration is enabled, the script expects certain // variables to be added to the environment. - let envMixin = undefined; + let envMixin = {}; if (this.shellIntegrationEnabled) { envMixin = { "VSCODE_INJECTION": "1", @@ -115,6 +119,12 @@ export class PowerShellProcess { }; } + // Enables Hot Reload in .NET for the attached process + // https://devblogs.microsoft.com/devops/net-enc-support-for-lambdas-and-other-improvements-in-visual-studio-2015/ + if (this.devMode) { + (envMixin as Record).COMPLUS_FORCEENC = "1"; + } + // Launch PowerShell in the integrated terminal const terminalOptions: vscode.TerminalOptions = { name: this.isTemp ? `${PowerShellProcess.title} (TEMP)` : PowerShellProcess.title, @@ -136,6 +146,7 @@ export class PowerShellProcess { this.consoleTerminal = vscode.window.createTerminal(terminalOptions); this.pid = await this.getPid(); this.logger.write(`PowerShell process started with PID: ${this.pid}`); + this.pidUpdateEmitter?.fire(this.pid); if (this.sessionSettings.integratedConsole.showOnStartup && !this.sessionSettings.integratedConsole.startInBackground) { @@ -186,6 +197,9 @@ export class PowerShellProcess { this.consoleCloseSubscription?.dispose(); this.consoleCloseSubscription = undefined; + + this.pidUpdateEmitter?.dispose(); + this.pidUpdateEmitter = undefined; } public sendKeyPress(): void { diff --git a/src/session.ts b/src/session.ts index 0b1037a116..34794a5d3e 100644 --- a/src/session.ts +++ b/src/session.ts @@ -240,6 +240,8 @@ export class SessionManager implements Middleware { this.logger.write(`Started PowerShell v${this.versionDetails.version}.`); this.setSessionRunningStatus(); // Yay, we made it! + await this.writePidIfInDevMode(this.languageServerProcess); + // Fire and forget the updater. const updater = new UpdatePowerShell(this.sessionSettings, this.logger, this.versionDetails); void updater.checkForUpdate(); @@ -303,6 +305,26 @@ export class SessionManager implements Middleware { await this.start(); } + /** In Development mode, write the PID to a file where the parent session can find it, to attach the dotnet debugger. */ + private async writePidIfInDevMode(pwshProcess: PowerShellProcess): Promise { + if (this.extensionContext.extensionMode !== vscode.ExtensionMode.Development) { return; } + const parentSessionId = process.env.VSCODE_PARENT_SESSION_ID; + const pidFilePath = vscode.Uri.joinPath(this.sessionsFolder, `PSES-${parentSessionId}.pid`); + + if (parentSessionId === undefined) { return; } + + const fs = vscode.workspace.fs; + const pid = (await pwshProcess.getPid())!.toString(); + await fs.writeFile(pidFilePath, Buffer.from(pid)); + const deletePidOnExit = pwshProcess.onExited(() => { + deletePidOnExit.dispose(); + fs.delete(pidFilePath, {useTrash: false}); + console.log(`Deleted PID file: ${pidFilePath}`); + }); + this.registeredCommands.push(deletePidOnExit); + this.extensionContext.subscriptions.push(deletePidOnExit); + } + public getSessionDetails(): IEditorServicesSessionDetails | undefined { // This is used by the debugger which should have already called `start`. if (this.sessionDetails === undefined) { @@ -569,7 +591,8 @@ export class SessionManager implements Middleware { this.extensionContext.logUri, this.getEditorServicesArgs(bundledModulesPath, powerShellExeDetails), this.getNewSessionFilePath(), - this.sessionSettings); + this.sessionSettings, + this.extensionContext.extensionMode == vscode.ExtensionMode.Development); languageServerProcess.onExited( () => { From 23619a9a4358905a4668b0d6bcacada44fee25a4 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 26 Nov 2024 11:50:28 -0800 Subject: [PATCH 4/8] Implement Extension Setting Categories --- package.json | 877 ++++++++++++++++++++++++++------------------------- 1 file changed, 452 insertions(+), 425 deletions(-) diff --git a/package.json b/package.json index 45ef2b467c..7e797ff226 100644 --- a/package.json +++ b/package.json @@ -601,437 +601,464 @@ "initialConfigurations": [] } ], - "configuration": { - "title": "PowerShell", - "properties": { - "powershell.sideBar.CommandExplorerVisibility": { + "configuration": [ + { + "title": "Interface", + "properties": { + "powershell.buttons.showRunButtons": { + "type": "boolean", + "default": true, + "markdownDescription": "Show the `Run` and `Run Selection` buttons in the editor's title bar." + }, + "powershell.buttons.showPanelMovementButtons": { + "type": "boolean", + "default": false, + "markdownDescription": "Show buttons in the editor's title bar for moving the terminals pane (with the PowerShell Extension Terminal) around." + }, + "powershell.enableReferencesCodeLens": { "type": "boolean", - "default": false, - "markdownDescription": "Specifies the visibility of the Command Explorer in the side bar." - }, - "powershell.sideBar.CommandExplorerExcludeFilter": { - "type": "array", - "items": { - "type": "string" + "default": true, + "markdownDescription": "Specifies if Code Lenses are displayed above function definitions, used to show the number of times the function is referenced in the workspace and navigate to those references. Large workspaces may want to disable this setting if performance is compromised. See also `#powershell.analyzeOpenDocumentsOnly#`." }, - "default": [], - "markdownDescription": "Specifies an array of modules to exclude from Command Explorer listing." - }, - "powershell.powerShellAdditionalExePaths": { - "type": "object", - "default": {}, - "markdownDescription": "Specifies a list of Item / Value pairs where the **Item** is a user-chosen name and the **Value** is an absolute path to a PowerShell executable. The name appears in the [Session Menu Command](command:PowerShell.ShowSessionMenu) and is used to reference this executable in the `#powershell.powerShellDefaultVersion#` setting.", - "additionalProperties": { - "type": "string" + "powershell.codeFolding.enable": { + "type": "boolean", + "default": true, + "markdownDescription": "Enables syntax based code folding. When disabled, the default indentation based code folding is used." + }, + "powershell.codeFolding.showLastLine": { + "type": "boolean", + "default": true, + "markdownDescription": "Shows the last line of a folded section similar to the default VS Code folding style. When disabled, the entire folded region is hidden." + }, + "powershell.helpCompletion": { + "type": "string", + "default": "BlockComment", + "enum": [ + "Disabled", + "BlockComment", + "LineComment" + ], + "markdownEnumDescriptions": [ + "Disables the feature.", + "Inserts a block style help comment, for example:\n\n`<#`\n\n`.`\n\n``\n\n`#>`", + "Inserts a line style help comment, for example:\n\n`# .`\n\n`# `" + ], + "markdownDescription": "Specifies the [comment based help](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) completion style triggered by typing ` ##`." + }, + "powershell.sideBar.CommandExplorerVisibility": { + "type": "boolean", + "default": false, + "markdownDescription": "Specifies the visibility of the Command Explorer in the side bar." + }, + "powershell.sideBar.CommandExplorerExcludeFilter": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "markdownDescription": "Specifies an array of modules to exclude from Command Explorer listing." + }, + "powershell.promptToUpdatePowerShell": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether you may be prompted to update your version of PowerShell." + }, + "powershell.promptToUpdatePackageManagement": { + "type": "boolean", + "default": false, + "markdownDescription": "**Deprecated:** Specifies whether you should be prompted to update your version of `PackageManagement` if it's under 1.4.6.", + "markdownDeprecationMessage": "**Deprecated:** This prompt has been removed as it's no longer strictly necessary to upgrade the `PackageManagement` module." + }, + "powershell.suppressAdditionalExeNotFoundWarning": { + "type": "boolean", + "default": false, + "markdownDescription": "Suppresses the warning message when any of `#powershell.powerShellAdditionalExePaths#` is not found." } - }, - "powershell.powerShellDefaultVersion": { - "type": "string", - "default": "", - "markdownDescription": "Specifies the default PowerShell version started by the extension. The name must match what is displayed in the [Session Menu command](command:PowerShell.ShowSessionMenu), for example, `Windows PowerShell (x86)`. You can specify additional PowerShell executables with the `#powershell.powerShellAdditionalExePaths#` setting." - }, - "powershell.powerShellExePath": { - "type": "string", - "default": "", - "scope": "machine", - "markdownDescription": "**Deprecated:** Specifies the path to the PowerShell executable.", - "markdownDeprecationMessage": "**Deprecated:** Please use the `#powershell.powerShellAdditionalExePaths#` setting instead." - }, - "powershell.promptToUpdatePowerShell": { - "type": "boolean", - "default": true, - "markdownDescription": "Specifies whether you may be prompted to update your version of PowerShell." - }, - "powershell.promptToUpdatePackageManagement": { - "type": "boolean", - "default": false, - "markdownDescription": "**Deprecated:** Specifies whether you should be prompted to update your version of `PackageManagement` if it's under 1.4.6.", - "markdownDeprecationMessage": "**Deprecated:** This prompt has been removed as it's no longer strictly necessary to upgrade the `PackageManagement` module." - }, - "powershell.suppressAdditionalExeNotFoundWarning": { - "type": "boolean", - "default": false, - "markdownDescription": "Suppresses the warning message when any of `#powershell.powerShellAdditionalExePaths#` is not found." - }, - "powershell.startAsLoginShell.osx": { - "type": "boolean", - "default": true, - "markdownDescription": "Starts the PowerShell extension's underlying PowerShell process as a login shell, if applicable." - }, - "powershell.startAsLoginShell.linux": { - "type": "boolean", - "default": false, - "markdownDescription": "Starts the PowerShell extension's underlying PowerShell process as a login shell, if applicable." - }, - "powershell.startAutomatically": { - "type": "boolean", - "default": true, - "markdownDescription": "Starts the PowerShell extension automatically when a PowerShell file is opened. If `false`, to start the extension use the [Restart Session command](command:PowerShell.RestartSession). **IntelliSense, code navigation, the Extension Terminal, code formatting, and other features are not enabled until the extension starts.**" - }, - "powershell.useX86Host": { - "type": "boolean", - "default": false, - "markdownDescription": "**Deprecated:** Uses the 32-bit language service on 64-bit Windows. This setting has no effect on 32-bit Windows or on the PowerShell extension debugger, which has its own architecture configuration.", - "markdownDeprecationMessage": "**Deprecated:** This setting was removed when the PowerShell installation searcher was added. Please use the `#powershell.powerShellAdditionalExePaths#` setting instead." - }, - "powershell.enableProfileLoading": { - "type": "boolean", - "default": true, - "markdownDescription": "Specifies whether the extension loads [PowerShell profiles](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles). Note that the extension's \"Current Host\" profile is `Microsoft.VSCode_profile.ps1`, which will be loaded instead of the default \"Current Host\" profile of `Microsoft.PowerShell_profile.ps1`. Use the \"All Hosts\" profile `profile.ps1` for common configuration." - }, - "powershell.enableReferencesCodeLens": { - "type": "boolean", - "default": true, - "markdownDescription": "Specifies if Code Lenses are displayed above function definitions, used to show the number of times the function is referenced in the workspace and navigate to those references. Large workspaces may want to disable this setting if performance is compromised. See also `#powershell.analyzeOpenDocumentsOnly#`." - }, - "powershell.analyzeOpenDocumentsOnly": { - "type": "boolean", - "default": false, - "markdownDescription": "Specifies to search for references only within open documents instead of all workspace files. An alternative to `#powershell.enableReferencesCodeLens#` that allows large workspaces to support some references without the performance impact." - }, - "powershell.bugReporting.project": { - "type": "string", - "default": "https://github.com/PowerShell/vscode-powershell", - "markdownDescription": "**Deprecated:** Specifies the URL of the GitHub project in which to generate bug reports.", - "markdownDeprecationMessage": "**Deprecated:** This setting was never meant to be changed!" - }, - "powershell.helpCompletion": { - "type": "string", - "default": "BlockComment", - "enum": [ - "Disabled", - "BlockComment", - "LineComment" - ], - "markdownEnumDescriptions": [ - "Disables the feature.", - "Inserts a block style help comment, for example:\n\n`<#`\n\n`.`\n\n``\n\n`#>`", - "Inserts a line style help comment, for example:\n\n`# .`\n\n`# `" - ], - "markdownDescription": "Specifies the [comment based help](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) completion style triggered by typing ` ##`." - }, - "powershell.cwd": { - "type": "string", - "default": "", - "markdownDescription": "A path where the Extension Terminal will be launched. Both the PowerShell process's and the shell's location will be set to this directory. Does not support variables, but does support the use of '~' and paths relative to a single workspace. **For multi-root workspaces, use the name of the folder you wish to have as the cwd.**" - }, - "powershell.scriptAnalysis.enable": { - "type": "boolean", - "default": true, - "markdownDescription": "Enables real-time script analysis using [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) that populates the [Problems view](command:workbench.panel.markers.view.focus)." - }, - "powershell.scriptAnalysis.settingsPath": { - "type": "string", - "default": "PSScriptAnalyzerSettings.psd1", - "markdownDescription": "Specifies the path to a [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) settings file. **This setting may not work as expected currently!**" - }, - "powershell.codeFolding.enable": { - "type": "boolean", - "default": true, - "markdownDescription": "Enables syntax based code folding. When disabled, the default indentation based code folding is used." - }, - "powershell.codeFolding.showLastLine": { - "type": "boolean", - "default": true, - "markdownDescription": "Shows the last line of a folded section similar to the default VS Code folding style. When disabled, the entire folded region is hidden." - }, - "powershell.codeFormatting.autoCorrectAliases": { - "type": "boolean", - "default": false, - "markdownDescription": "Replaces aliases with their aliased name." - }, - "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": { - "type": "boolean", - "default": false, - "markdownDescription": "Removes redundant semicolon(s) at the end of a line where a line terminator is sufficient." - }, - "powershell.codeFormatting.preset": { - "type": "string", - "default": "Custom", - "enum": [ - "Custom", - "Allman", - "OTBS", - "Stroustrup" - ], - "markdownEnumDescriptions": [ - "The three brace settings are respected as-is.", - "Sets `#powershell.codeFormatting.openBraceOnSameLine#` to `false`, `#powershell.codeFormatting.newLineAfterOpenBrace#` to `true`, and `#powershell.codeFormatting.newLineAfterCloseBrace#` to `true`.", - "Sets `#powershell.codeFormatting.openBraceOnSameLine#` to `true`, `#powershell.codeFormatting.newLineAfterOpenBrace#` to `true`, and `#powershell.codeFormatting.newLineAfterCloseBrace#` to `false`.", - "Sets `#powershell.codeFormatting.openBraceOnSameLine#` to `true`, `#powershell.codeFormatting.newLineAfterOpenBrace#` to `true`, and `#powershell.codeFormatting.newLineAfterCloseBrace#` to `true`." - ], - "markdownDescription": "Sets the code formatting options to follow the given indent style in a way that is compatible with PowerShell syntax. Any setting other than `Custom` will configure (and override) the settings:\n\n* `#powershell.codeFormatting.openBraceOnSameLine#`\n\n* `#powershell.codeFormatting.newLineAfterOpenBrace#`\n\n* `#powershell.codeFormatting.newLineAfterCloseBrace#`\n\nFor more information about the brace styles, please see [PoshCode's discussion](https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/81)." - }, - "powershell.codeFormatting.openBraceOnSameLine": { - "type": "boolean", - "default": true, - "markdownDescription": "Places open brace on the same line as its associated statement." - }, - "powershell.codeFormatting.newLineAfterOpenBrace": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds a newline (line break) after an open brace." - }, - "powershell.codeFormatting.newLineAfterCloseBrace": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds a newline (line break) after a closing brace." - }, - "powershell.codeFormatting.pipelineIndentationStyle": { - "type": "string", - "default": "NoIndentation", - "enum": [ - "IncreaseIndentationForFirstPipeline", - "IncreaseIndentationAfterEveryPipeline", - "NoIndentation", - "None" - ], - "markdownEnumDescriptions": [ - "Indent once after the first pipeline and keep this indentation.", - "Indent more after the first pipeline and keep this indentation.", - "Do not increase indentation.", - "Do not change any existing pipeline indentation (disables feature)." - ], - "markdownDescription": "Whether to increase indentation after a pipeline for multi-line statements. See [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer/blob/a94d9f5666bba9f569cdf9c1bc99556934f2b8f4/docs/Rules/UseConsistentIndentation.md#pipelineindentation-string-default-value-is-increaseindentationforfirstpipeline) for examples. It is suggested to use `IncreaseIndentationForFirstPipeline` instead of the default `NoIndentation`. **This default may change in the future,** please see the [Request For Comment](https://github.com/PowerShell/vscode-powershell/issues/4296)." - }, - "powershell.codeFormatting.whitespaceBeforeOpenBrace": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds a space between a keyword and its associated script-block expression." - }, - "powershell.codeFormatting.whitespaceBeforeOpenParen": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds a space between a keyword (`if`, `elseif`, `while`, `switch`, etc.) and its associated conditional expression." - }, - "powershell.codeFormatting.whitespaceAroundOperator": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds spaces before and after an operator (`=`, `+`, `-`, etc.)." - }, - "powershell.codeFormatting.whitespaceAfterSeparator": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds a space after a separator (`,` and `;`)." - }, - "powershell.codeFormatting.whitespaceInsideBrace": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds a space after an opening brace (`{`) and before a closing brace (`}`)." - }, - "powershell.codeFormatting.whitespaceBetweenParameters": { - "type": "boolean", - "default": false, - "markdownDescription": "Removes redundant whitespace between parameters." - }, - "powershell.codeFormatting.whitespaceAroundPipe": { - "type": "boolean", - "default": true, - "markdownDescription": "**Deprecated:** Please use the `#powershell.codeFormatting.addWhitespaceAroundPipe#` setting instead. If you've used this setting before, we have moved it for you automatically.", - "markdownDeprecationMessage": "**Deprecated:** Please use the `#powershell.codeFormatting.addWhitespaceAroundPipe#` setting instead. If you've used this setting before, we have moved it for you automatically." - }, - "powershell.codeFormatting.addWhitespaceAroundPipe": { - "type": "boolean", - "default": true, - "markdownDescription": "Adds a space before and after the pipeline operator (`|`) if it is missing." - }, - "powershell.codeFormatting.trimWhitespaceAroundPipe": { - "type": "boolean", - "default": false, - "markdownDescription": "Trims extraneous whitespace (more than one character) before and after the pipeline operator (`|`)." - }, - "powershell.codeFormatting.ignoreOneLineBlock": { - "type": "boolean", - "default": true, - "markdownDescription": "Does not reformat one-line code blocks, such as: `if (...) {...} else {...}`." - }, - "powershell.codeFormatting.alignPropertyValuePairs": { - "type": "boolean", - "default": true, - "markdownDescription": "Align assignment statements in a hashtable or a DSC Configuration." - }, - "powershell.codeFormatting.useConstantStrings": { - "type": "boolean", - "default": false, - "markdownDescription": "Use single quotes if a string is not interpolated and its value does not contain a single quote." - }, - "powershell.codeFormatting.useCorrectCasing": { - "type": "boolean", - "default": false, - "markdownDescription": "Use correct casing for cmdlets." - }, - "powershell.integratedConsole.showOnStartup": { - "type": "boolean", - "default": true, - "markdownDescription": "Shows the Extension Terminal when the PowerShell extension is initialized. When disabled, the pane is not opened on startup, but the Extension Terminal is still created in order to power the extension's features." - }, - "powershell.integratedConsole.startInBackground": { - "type": "boolean", - "default": false, - "markdownDescription": "Starts the Extension Terminal in the background. **If this is enabled, to access the terminal you must run the [Show Extension Terminal command](command:PowerShell.ShowSessionConsole), and once shown it cannot be put back into the background.** This option completely hides the Extension Terminal from the terminals view. You are probably looking for the `#powershell.integratedConsole.showOnStartup#` option instead." - }, - "powershell.integratedConsole.startLocation": { - "type": "string", - "default": "Panel", - "enum": [ - "Editor", - "Panel" - ], - "markdownEnumDescriptions": [ - "Creates the Extension Terminal in Editor area", - "Creates the Extension Terminal in Panel area" - ], - "markdownDescription": "Sets the startup location for Extension Terminal." - }, - "powershell.integratedConsole.focusConsoleOnExecute": { - "type": "boolean", - "default": true, - "markdownDescription": "Switches focus to the console when a script selection is run or a script file is debugged." - }, - "powershell.integratedConsole.useLegacyReadLine": { - "type": "boolean", - "default": false, - "markdownDescription": "This will disable the use of PSReadLine in the PowerShell Extension Terminal and use a legacy implementation. **This setting is not recommended and likely to be deprecated!**" - }, - "powershell.integratedConsole.forceClearScrollbackBuffer": { - "type": "boolean", - "default": false, - "markdownDescription": "Use the VS Code API to clear the terminal since that's the only reliable way to clear the scrollback buffer. Turn this on if you're used to `Clear-Host` clearing scroll history. **This setting is not recommended and likely to be deprecated!**" - }, - "powershell.integratedConsole.suppressStartupBanner": { - "type": "boolean", - "default": false, - "markdownDescription": "Do not show the startup banner in the PowerShell Extension Terminal." - }, - "powershell.debugging.createTemporaryIntegratedConsole": { - "type": "boolean", - "default": false, - "markdownDescription": "Creates a temporary PowerShell Extension Terminal for each debugging session. This is useful for debugging PowerShell classes and binary modules." - }, - "powershell.debugging.executeMode": { - "type": "string", - "enum": [ - "DotSource", - "Call" - ], - "default": "DotSource", - "markdownEnumDescriptions": [ - "Use the Dot-Source operator `.` to launch the script, for example, `. 'C:\\Data\\MyScript.ps1'`", - "Use the Call operator `&` to launch the script, for example, `& 'C:\\Data\\MyScript.ps1'`" - ], - "markdownDescription": "Sets the operator used to launch scripts." - }, - "powershell.developer.bundledModulesPath": { - "type": "string", - "default": "../../PowerShellEditorServices/module", - "markdownDescription": "Specifies an alternative path to the folder containing modules that are bundled with the PowerShell extension, that is: PowerShell Editor Services, PSScriptAnalyzer and PSReadLine. **This setting is only meant for extension developers and requires the extension to be run in development mode!**" - }, - "powershell.developer.editorServicesLogLevel": { - "type": "string", - "default": "Warning", - "enum": [ - "Trace", - "Debug", - "Information", - "Warning", - "Error", - "None" - ], - "markdownEnumDescriptions": [ - "Enables all logging possible, please use this setting when submitting logs for bug reports!", - "Enables more detailed logging of the extension", - "Logs high-level information about what the extension is doing.", - "Only log warnings and errors. This is the default setting", - "Only log errors.", - "Disable all logging possible. No log files will be written!" - ], - "markdownDescription": "Sets the log verbosity for both the extension and its LSP server, PowerShell Editor Services. **Please set to `Trace` when recording logs for a bug report!**" - }, - "powershell.developer.editorServicesWaitForDebugger": { - "type": "boolean", - "default": false, - "markdownDescription": "Launches the LSP server with the `/waitForDebugger` flag to force it to wait for a .NET debugger to attach before proceeding, and emit its PID until then. **This setting is only meant for extension developers and requires the extension to be run in development mode!**" - }, - "powershell.developer.setExecutionPolicy": { - "type": "boolean", - "default": true, - "markdownDescription": "On Windows we launch the PowerShell executable with `-ExecutionPolicy Bypass` so that the LSP server (PowerShell Editor Services module) will launch without issue. Some anti-virus programs disallow this command-line argument and this flag can be used to remove it. **Using this setting may require trusting the script manually in order for it to launch!**" - }, - "powershell.developer.featureFlags": { - "type": "array", - "items": { - "type": "string" + } + }, + { + "title": "Formatting", + "properties": { + "powershell.codeFormatting.preset": { + "type": "string", + "default": "Custom", + "enum": [ + "Custom", + "Allman", + "OTBS", + "Stroustrup" + ], + "markdownEnumDescriptions": [ + "The three brace settings are respected as-is.", + "Sets `#powershell.codeFormatting.openBraceOnSameLine#` to `false`, `#powershell.codeFormatting.newLineAfterOpenBrace#` to `true`, and `#powershell.codeFormatting.newLineAfterCloseBrace#` to `true`.", + "Sets `#powershell.codeFormatting.openBraceOnSameLine#` to `true`, `#powershell.codeFormatting.newLineAfterOpenBrace#` to `true`, and `#powershell.codeFormatting.newLineAfterCloseBrace#` to `false`.", + "Sets `#powershell.codeFormatting.openBraceOnSameLine#` to `true`, `#powershell.codeFormatting.newLineAfterOpenBrace#` to `true`, and `#powershell.codeFormatting.newLineAfterCloseBrace#` to `true`." + ], + "markdownDescription": "Sets the code formatting options to follow the given indent style in a way that is compatible with PowerShell syntax. Any setting other than `Custom` will configure (and override) the settings:\n\n* `#powershell.codeFormatting.openBraceOnSameLine#`\n\n* `#powershell.codeFormatting.newLineAfterOpenBrace#`\n\n* `#powershell.codeFormatting.newLineAfterCloseBrace#`\n\nFor more information about the brace styles, please see [PoshCode's discussion](https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/81)." }, - "default": [], - "markdownDescription": "An array of strings that enable experimental features in the PowerShell extension. **No flags are currently available!**" - }, - "powershell.developer.traceDap": { - "type": "boolean", - "default": false, - "markdownDescription": "Traces the DAP communication between VS Code and the PowerShell Editor Services [DAP Server](https://microsoft.github.io/debug-adapter-protocol/). The output will be logged and also visible in the Output pane, where the verbosity is configurable. **For extension developers and issue troubleshooting only!**" - }, - "powershell.trace.server": { - "type": "string", - "enum": [ - "off", - "messages", - "verbose" - ], - "default": "off", - "markdownDescription": "Traces the communication between VS Code and the PowerShell Editor Services [LSP Server](https://microsoft.github.io/language-server-protocol/). The output will be logged and also visible in the Output pane, where the verbosity is configurable. **For extension developers and issue troubleshooting only!**" - }, - "powershell.developer.waitForSessionFileTimeoutSeconds": { - "type": "number", - "default": 240, - "markdownDescription": "Specifies how many seconds the extension will wait for the LSP server, PowerShell Editor Services, to connect. The default is four minutes; try increasing this value if your computer is particularly slow (often caused by overactive anti-malware programs)." - }, - "powershell.pester.useLegacyCodeLens": { - "type": "boolean", - "default": true, - "markdownDescription": "Use a CodeLens that is compatible with Pester 4. Disabling this will show `Run Tests` on all `It`, `Describe` and `Context` blocks, and will correctly work only with Pester 5 and newer." - }, - "powershell.pester.codeLens": { - "type": "boolean", - "default": true, - "markdownDescription": "This setting controls the appearance of the `Run Tests` and `Debug Tests` CodeLenses that appears above Pester tests." - }, - "powershell.pester.outputVerbosity": { - "type": "string", - "default": "FromPreference", - "enum": [ - "FromPreference", - "None", - "Minimal", - "Normal", - "Detailed", - "Diagnostic" - ], - "markdownDescription": "Defines the verbosity of output to be used. For Pester 5 and newer the default value `FromPreference` will use the `Output` settings from the `$PesterPreference` defined in the caller's context, and will default to `Normal` if there is none. For Pester 4 the `FromPreference` and `Normal` options map to `All`, and `Minimal` option maps to `Fails`." - }, - "powershell.pester.debugOutputVerbosity": { - "type": "string", - "enum": [ - "None", - "Minimal", - "Normal", - "Detailed", - "Diagnostic" - ], - "default": "Diagnostic", - "markdownDescription": "Defines the verbosity of output to be used when debugging a test or a block. For Pester 5 and newer the default value `Diagnostic` will print additional information about discovery, skipped and filtered tests, mocking and more." - }, - "powershell.buttons.showRunButtons": { - "type": "boolean", - "default": true, - "markdownDescription": "Show the `Run` and `Run Selection` buttons in the editor's title bar." - }, - "powershell.buttons.showPanelMovementButtons": { - "type": "boolean", - "default": false, - "markdownDescription": "Show buttons in the editor's title bar for moving the terminals pane (with the PowerShell Extension Terminal) around." + "powershell.codeFormatting.autoCorrectAliases": { + "type": "boolean", + "default": false, + "markdownDescription": "Replaces aliases with their aliased name." + }, + "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": { + "type": "boolean", + "default": false, + "markdownDescription": "Removes redundant semicolon(s) at the end of a line where a line terminator is sufficient." + }, + "powershell.codeFormatting.openBraceOnSameLine": { + "type": "boolean", + "default": true, + "markdownDescription": "Places open brace on the same line as its associated statement." + }, + "powershell.codeFormatting.newLineAfterOpenBrace": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds a newline (line break) after an open brace." + }, + "powershell.codeFormatting.newLineAfterCloseBrace": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds a newline (line break) after a closing brace." + }, + "powershell.codeFormatting.pipelineIndentationStyle": { + "type": "string", + "default": "NoIndentation", + "enum": [ + "IncreaseIndentationForFirstPipeline", + "IncreaseIndentationAfterEveryPipeline", + "NoIndentation", + "None" + ], + "markdownEnumDescriptions": [ + "Indent once after the first pipeline and keep this indentation.", + "Indent more after the first pipeline and keep this indentation.", + "Do not increase indentation.", + "Do not change any existing pipeline indentation (disables feature)." + ], + "markdownDescription": "Whether to increase indentation after a pipeline for multi-line statements. See [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer/blob/a94d9f5666bba9f569cdf9c1bc99556934f2b8f4/docs/Rules/UseConsistentIndentation.md#pipelineindentation-string-default-value-is-increaseindentationforfirstpipeline) for examples. It is suggested to use `IncreaseIndentationForFirstPipeline` instead of the default `NoIndentation`. **This default may change in the future,** please see the [Request For Comment](https://github.com/PowerShell/vscode-powershell/issues/4296)." + }, + "powershell.codeFormatting.whitespaceBeforeOpenBrace": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds a space between a keyword and its associated script-block expression." + }, + "powershell.codeFormatting.whitespaceBeforeOpenParen": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds a space between a keyword (`if`, `elseif`, `while`, `switch`, etc.) and its associated conditional expression." + }, + "powershell.codeFormatting.whitespaceAroundOperator": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds spaces before and after an operator (`=`, `+`, `-`, etc.)." + }, + "powershell.codeFormatting.whitespaceAfterSeparator": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds a space after a separator (`,` and `;`)." + }, + "powershell.codeFormatting.whitespaceInsideBrace": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds a space after an opening brace (`{`) and before a closing brace (`}`)." + }, + "powershell.codeFormatting.whitespaceBetweenParameters": { + "type": "boolean", + "default": false, + "markdownDescription": "Removes redundant whitespace between parameters." + }, + "powershell.codeFormatting.whitespaceAroundPipe": { + "type": "boolean", + "default": true, + "markdownDescription": "**Deprecated:** Please use the `#powershell.codeFormatting.addWhitespaceAroundPipe#` setting instead. If you've used this setting before, we have moved it for you automatically.", + "markdownDeprecationMessage": "**Deprecated:** Please use the `#powershell.codeFormatting.addWhitespaceAroundPipe#` setting instead. If you've used this setting before, we have moved it for you automatically." + }, + "powershell.codeFormatting.addWhitespaceAroundPipe": { + "type": "boolean", + "default": true, + "markdownDescription": "Adds a space before and after the pipeline operator (`|`) if it is missing." + }, + "powershell.codeFormatting.trimWhitespaceAroundPipe": { + "type": "boolean", + "default": false, + "markdownDescription": "Trims extraneous whitespace (more than one character) before and after the pipeline operator (`|`)." + }, + "powershell.codeFormatting.ignoreOneLineBlock": { + "type": "boolean", + "default": true, + "markdownDescription": "Does not reformat one-line code blocks, such as: `if (...) {...} else {...}`." + }, + "powershell.codeFormatting.alignPropertyValuePairs": { + "type": "boolean", + "default": true, + "markdownDescription": "Align assignment statements in a hashtable or a DSC Configuration." + }, + "powershell.codeFormatting.useConstantStrings": { + "type": "boolean", + "default": false, + "markdownDescription": "Use single quotes if a string is not interpolated and its value does not contain a single quote." + }, + "powershell.codeFormatting.useCorrectCasing": { + "type": "boolean", + "default": false, + "markdownDescription": "Use correct casing for cmdlets." + } + } + }, + { + "title": "Editor Services", + "properties": { + "powershell.powerShellDefaultVersion": { + "type": "string", + "default": "", + "markdownDescription": "Specifies the default PowerShell version started by the extension. The name must match what is displayed in the [Session Menu command](command:PowerShell.ShowSessionMenu), for example, `Windows PowerShell (x86)`. You can specify additional PowerShell executables with the `#powershell.powerShellAdditionalExePaths#` setting." + }, + "powershell.enableProfileLoading": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether the extension loads [PowerShell profiles](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles). Note that the extension's \"Current Host\" profile is `Microsoft.VSCode_profile.ps1`, which will be loaded instead of the default \"Current Host\" profile of `Microsoft.PowerShell_profile.ps1`. Use the \"All Hosts\" profile `profile.ps1` for common configuration." + }, + "powershell.startAutomatically": { + "type": "boolean", + "default": true, + "markdownDescription": "Starts the PowerShell extension automatically when a PowerShell file is opened. If `false`, to start the extension use the [Restart Session command](command:PowerShell.RestartSession). **IntelliSense, code navigation, the Extension Terminal, code formatting, and other features are not enabled until the extension starts.**" + }, + "powershell.scriptAnalysis.enable": { + "type": "boolean", + "default": true, + "markdownDescription": "Enables real-time script analysis using [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) that populates the [Problems view](command:workbench.panel.markers.view.focus)." + }, + "powershell.scriptAnalysis.settingsPath": { + "type": "string", + "default": "PSScriptAnalyzerSettings.psd1", + "markdownDescription": "Specifies the path to a [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) settings file. **This setting may not work as expected currently!**" + }, + "powershell.analyzeOpenDocumentsOnly": { + "type": "boolean", + "default": false, + "markdownDescription": "Specifies to search for references only within open documents instead of all workspace files. An alternative to `#powershell.enableReferencesCodeLens#` that allows large workspaces to support some references without the performance impact." + }, + "powershell.debugging.createTemporaryIntegratedConsole": { + "type": "boolean", + "default": false, + "markdownDescription": "Creates a temporary PowerShell Extension Terminal for each debugging session. This is useful for debugging PowerShell classes and binary modules." + }, + "powershell.debugging.executeMode": { + "type": "string", + "enum": [ + "DotSource", + "Call" + ], + "default": "DotSource", + "markdownEnumDescriptions": [ + "Use the Dot-Source operator `.` to launch the script, for example, `. 'C:\\Data\\MyScript.ps1'`", + "Use the Call operator `&` to launch the script, for example, `& 'C:\\Data\\MyScript.ps1'`" + ], + "markdownDescription": "Sets the operator used to launch scripts." + }, + "powershell.powerShellExePath": { + "type": "string", + "default": "", + "scope": "machine", + "markdownDescription": "**Deprecated:** Specifies the path to the PowerShell executable.", + "markdownDeprecationMessage": "**Deprecated:** Please use the `#powershell.powerShellAdditionalExePaths#` setting instead." + }, + "powershell.powerShellAdditionalExePaths": { + "type": "object", + "default": {}, + "markdownDescription": "Specifies a list of Item / Value pairs where the **Item** is a user-chosen name and the **Value** is an absolute path to a PowerShell executable. The name appears in the [Session Menu Command](command:PowerShell.ShowSessionMenu) and is used to reference this executable in the `#powershell.powerShellDefaultVersion#` setting.", + "additionalProperties": { + "type": "string" + } + }, + "powershell.cwd": { + "type": "string", + "default": "", + "markdownDescription": "A path where the Extension Terminal will be launched. Both the PowerShell process's and the shell's location will be set to this directory. Does not support variables, but does support the use of '~' and paths relative to a single workspace. **For multi-root workspaces, use the name of the folder you wish to have as the cwd.**" + }, + "powershell.startAsLoginShell.osx": { + "type": "boolean", + "default": true, + "markdownDescription": "Starts the PowerShell extension's underlying PowerShell process as a login shell, if applicable." + }, + "powershell.startAsLoginShell.linux": { + "type": "boolean", + "default": false, + "markdownDescription": "Starts the PowerShell extension's underlying PowerShell process as a login shell, if applicable." + }, + "powershell.useX86Host": { + "type": "boolean", + "default": false, + "markdownDescription": "**Deprecated:** Uses the 32-bit language service on 64-bit Windows. This setting has no effect on 32-bit Windows or on the PowerShell extension debugger, which has its own architecture configuration.", + "markdownDeprecationMessage": "**Deprecated:** This setting was removed when the PowerShell installation searcher was added. Please use the `#powershell.powerShellAdditionalExePaths#` setting instead." + } + } + }, + { + "title": "Pester", + "properties": { + "powershell.pester.useLegacyCodeLens": { + "type": "boolean", + "default": true, + "markdownDescription": "Use a CodeLens that is compatible with Pester 4. Disabling this will show `Run Tests` on all `It`, `Describe` and `Context` blocks, and will correctly work only with Pester 5 and newer." + }, + "powershell.pester.codeLens": { + "type": "boolean", + "default": true, + "markdownDescription": "This setting controls the appearance of the `Run Tests` and `Debug Tests` CodeLenses that appears above Pester tests." + }, + "powershell.pester.outputVerbosity": { + "type": "string", + "default": "FromPreference", + "enum": [ + "FromPreference", + "None", + "Minimal", + "Normal", + "Detailed", + "Diagnostic" + ], + "markdownDescription": "Defines the verbosity of output to be used. For Pester 5 and newer the default value `FromPreference` will use the `Output` settings from the `$PesterPreference` defined in the caller's context, and will default to `Normal` if there is none. For Pester 4 the `FromPreference` and `Normal` options map to `All`, and `Minimal` option maps to `Fails`." + }, + "powershell.pester.debugOutputVerbosity": { + "type": "string", + "enum": [ + "None", + "Minimal", + "Normal", + "Detailed", + "Diagnostic" + ], + "default": "Diagnostic", + "markdownDescription": "Defines the verbosity of output to be used when debugging a test or a block. For Pester 5 and newer the default value `Diagnostic` will print additional information about discovery, skipped and filtered tests, mocking and more." + } + } + }, + { + "title": "Terminal", + "properties": { + "powershell.integratedConsole.suppressStartupBanner": { + "type": "boolean", + "default": false, + "markdownDescription": "Do not show the startup banner in the PowerShell Extension Terminal." + }, + "powershell.integratedConsole.showOnStartup": { + "type": "boolean", + "default": true, + "markdownDescription": "Shows the Extension Terminal when the PowerShell extension is initialized. When disabled, the pane is not opened on startup, but the Extension Terminal is still created in order to power the extension's features." + }, + "powershell.integratedConsole.startInBackground": { + "type": "boolean", + "default": false, + "markdownDescription": "Starts the Extension Terminal in the background. **If this is enabled, to access the terminal you must run the [Show Extension Terminal command](command:PowerShell.ShowSessionConsole), and once shown it cannot be put back into the background.** This option completely hides the Extension Terminal from the terminals view. You are probably looking for the `#powershell.integratedConsole.showOnStartup#` option instead." + }, + "powershell.integratedConsole.startLocation": { + "type": "string", + "default": "Panel", + "enum": [ + "Editor", + "Panel" + ], + "markdownEnumDescriptions": [ + "Creates the Extension Terminal in Editor area", + "Creates the Extension Terminal in Panel area" + ], + "markdownDescription": "Sets the startup location for Extension Terminal." + }, + "powershell.integratedConsole.focusConsoleOnExecute": { + "type": "boolean", + "default": true, + "markdownDescription": "Switches focus to the console when a script selection is run or a script file is debugged." + }, + "powershell.integratedConsole.useLegacyReadLine": { + "type": "boolean", + "default": false, + "markdownDescription": "This will disable the use of PSReadLine in the PowerShell Extension Terminal and use a legacy implementation. **This setting is not recommended and likely to be deprecated!**" + }, + "powershell.integratedConsole.forceClearScrollbackBuffer": { + "type": "boolean", + "default": false, + "markdownDescription": "Use the VS Code API to clear the terminal since that's the only reliable way to clear the scrollback buffer. Turn this on if you're used to `Clear-Host` clearing scroll history. **This setting is not recommended and likely to be deprecated!**" + } + } + }, + { + "title": "Developer", + "properties": { + "powershell.developer.editorServicesLogLevel": { + "type": "string", + "default": "Warning", + "enum": [ + "Trace", + "Debug", + "Information", + "Warning", + "Error", + "None" + ], + "markdownEnumDescriptions": [ + "Enables all logging possible, please use this setting when submitting logs for bug reports!", + "Enables more detailed logging of the extension", + "Logs high-level information about what the extension is doing.", + "Only log warnings and errors. This is the default setting", + "Only log errors.", + "Disable all logging possible. No log files will be written!" + ], + "markdownDescription": "Sets the log verbosity for both the extension and its LSP server, PowerShell Editor Services. **Please set to `Trace` when recording logs for a bug report!**" + }, + "powershell.trace.server": { + "type": "string", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "markdownDescription": "Traces the communication between VS Code and the PowerShell Editor Services [LSP Server](https://microsoft.github.io/language-server-protocol/). The output will be logged and also visible in the Output pane, where the verbosity is configurable. **For extension developers and issue troubleshooting only!**" + }, + "powershell.developer.traceDap": { + "type": "boolean", + "default": false, + "markdownDescription": "Traces the DAP communication between VS Code and the PowerShell Editor Services [DAP Server](https://microsoft.github.io/debug-adapter-protocol/). The output will be logged and also visible in the Output pane, where the verbosity is configurable. **For extension developers and issue troubleshooting only!**" + }, + "powershell.developer.editorServicesWaitForDebugger": { + "type": "boolean", + "default": false, + "markdownDescription": "Launches the LSP server with the `/waitForDebugger` flag to force it to wait for a .NET debugger to attach before proceeding, and emit its PID until then. **This setting is only meant for extension developers and requires the extension to be run in development mode!**" + }, + "powershell.developer.setExecutionPolicy": { + "type": "boolean", + "default": true, + "markdownDescription": "On Windows we launch the PowerShell executable with `-ExecutionPolicy Bypass` so that the LSP server (PowerShell Editor Services module) will launch without issue. Some anti-virus programs disallow this command-line argument and this flag can be used to remove it. **Using this setting may require trusting the script manually in order for it to launch!**" + }, + "powershell.developer.bundledModulesPath": { + "type": "string", + "default": "../../PowerShellEditorServices/module", + "markdownDescription": "Specifies an alternative path to the folder containing modules that are bundled with the PowerShell extension, that is: PowerShell Editor Services, PSScriptAnalyzer and PSReadLine. **This setting is only meant for extension developers and requires the extension to be run in development mode!**" + }, + "powershell.developer.featureFlags": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "markdownDescription": "An array of strings that enable experimental features in the PowerShell extension. **No flags are currently available!**" + }, + "powershell.developer.waitForSessionFileTimeoutSeconds": { + "type": "number", + "default": 240, + "markdownDescription": "Specifies how many seconds the extension will wait for the LSP server, PowerShell Editor Services, to connect. The default is four minutes; try increasing this value if your computer is particularly slow (often caused by overactive anti-malware programs)." + }, + "powershell.bugReporting.project": { + "type": "string", + "default": "https://github.com/PowerShell/vscode-powershell", + "markdownDescription": "**Deprecated:** Specifies the URL of the GitHub project in which to generate bug reports.", + "markdownDeprecationMessage": "**Deprecated:** This setting was never meant to be changed!" + } } } - }, + ], "capabilities": { "untrustedWorkspaces": { "supported": false From d1a89fab21ea85b08ab19a73cbb3643aec1241f9 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:01:42 -0800 Subject: [PATCH 5/8] Add Prettier extension to recommendations Since it's set as the TypeScript formatter. --- pwsh-extension-dev.code-workspace | 1 + 1 file changed, 1 insertion(+) diff --git a/pwsh-extension-dev.code-workspace b/pwsh-extension-dev.code-workspace index 9f243c5754..51083c21ad 100644 --- a/pwsh-extension-dev.code-workspace +++ b/pwsh-extension-dev.code-workspace @@ -15,6 +15,7 @@ "davidanson.vscode-markdownlint", "dbaeumer.vscode-eslint", "editorconfig.editorconfig", + "esbenp.prettier-vscode", "ms-dotnettools.csharp", "ms-vscode.powershell", "hbenl.vscode-mocha-test-adapter", From 1aa99c29a86047b7f54bd1e1422d0bdbdd6fd662 Mon Sep 17 00:00:00 2001 From: "Jon D." Date: Tue, 3 Dec 2024 16:42:16 -0600 Subject: [PATCH 6/8] Fix for "suppress psscriptanalyzer rule" snippets (#5110) Fix for issue #5108 - Corrects a missing close comment in the Function rule snippet - Corrects the tab stop numbering in the Parameter rule snippet as well as duplicate use of `$TM_SELECTED_TEXT` - Adds a missing comma in The Scope rule snippet - Minor formatting --- snippets/PowerShell.json | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/snippets/PowerShell.json b/snippets/PowerShell.json index 5e25f10286..e5b23be643 100644 --- a/snippets/PowerShell.json +++ b/snippets/PowerShell.json @@ -268,8 +268,9 @@ "description": "Suppress a PSScriptAnalyzer rule for a function. More: https://docs.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/overview?view=ps-modules#suppressing-rules", "body": [ "[Diagnostics.CodeAnalysis.SuppressMessageAttribute(", - "\t<#Category#>'${1:PSProvideDefaultParameterValue}', <#CheckId>\\$null, Scope='Function',", - "\tJustification = '${0:${TM_SELECTED_TEXT:Reason for suppressing}}'", + "\t<#Category#>'${1:PSProvideDefaultParameterValue}', <#CheckId#>\\$null,", + "\tScope='Function',", + "\tJustification='${0:${TM_SELECTED_TEXT:Reason for suppressing}}'", ")]" ] }, @@ -522,9 +523,10 @@ ], "description": "Suppress a PSScriptAnalyzer rule on a parameter. More: https://docs.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/overview?view=ps-modules#suppressing-rules", "body": [ - "[Diagnostics.CodeAnalysis.SuppressMessageAttribute(<#Category#>'${1:PSUseDeclaredVarsMoreThanAssignments}',", - "\t<#ParameterName#>'${0:${TM_SELECTED_TEXT:ParamName}}',", - "\tJustification = '${0:${TM_SELECTED_TEXT:Reason for suppressing}}'", + "[Diagnostics.CodeAnalysis.SuppressMessageAttribute(", + "\t<#Category#>'${1:PSUseDeclaredVarsMoreThanAssignments}',", + "\t<#ParameterName#>'${2:${TM_SELECTED_TEXT:ParamName}}',", + "\tJustification='${0:Reason for suppressing}'", ")]" ] }, @@ -566,13 +568,17 @@ ] }, "Scope: Suppress PSScriptAnalyzer Rule": { - "prefix": "suppress-message-rule-scope", + "prefix": [ + "suppress-message-rule-scope", + "[SuppressMessageAttribute]" + ], "description": "Suppress a PSScriptAnalyzer rule based on a function/parameter/class/variable/object's name by setting the SuppressMessageAttribute's Target property to a regular expression or a glob pattern. More: https://docs.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/overview?view=ps-modules#suppressing-rules", "body": [ "[Diagnostics.CodeAnalysis.SuppressMessageAttribute(", - "\t<#Category#>'${1:PSUseDeclaredVarsMoreThanAssignments}', <#CheckId#>\\$null, Scope='Function',", - "\tTarget='${1:${TM_SELECTED_TEXT:RegexOrGlobPatternToMatchName}}'", - "\tJustification = '${0:Reason for suppressing}}'", + "\t<#Category#>'${1:PSUseDeclaredVarsMoreThanAssignments}', <#CheckId#>\\$null,", + "\tScope='${2|Function,Parameter,Class,Variable,Object|}',", + "\tTarget='${3:${TM_SELECTED_TEXT:RegexOrGlobPatternToMatchName}}',", + "\tJustification='${0:Reason for suppressing}'", ")]" ] }, From c101d9797b1ad5ad17d35b717e53acf0ce4daadd Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:15:19 -0800 Subject: [PATCH 7/8] Bump packages --- package-lock.json | 167 ++++++++++++++++++++++++++-------------------- package.json | 20 +++--- 2 files changed, 105 insertions(+), 82 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ccbb484da..82c2bd2da9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "powershell", - "version": "2024.4.0", + "version": "2024.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "powershell", - "version": "2024.4.0", + "version": "2024.5.1", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { - "@vscode/extension-telemetry": "^0.9.7", + "@vscode/extension-telemetry": "^0.9.8", "node-fetch": "^2.7.0", "semver": "^7.6.3", "untildify": "^4.0.0", @@ -25,9 +25,9 @@ "vscode": "^1.94.0" }, "optionalDependencies": { - "@types/mocha": "^10.0.9", + "@types/mocha": "^10.0.10", "@types/mock-fs": "^4.13.4", - "@types/node": "^20.17.6", + "@types/node": "^20.17.9", "@types/node-fetch": "^2.6.12", "@types/rewire": "^2.5.30", "@types/semver": "^7.5.8", @@ -35,8 +35,8 @@ "@types/ungap__structured-clone": "^1.2.0", "@types/uuid": "^9.0.8", "@types/vscode": "~1.94.0", - "@typescript-eslint/eslint-plugin": "^8.14.0", - "@typescript-eslint/parser": "^8.14.0", + "@typescript-eslint/eslint-plugin": "^8.17.0", + "@typescript-eslint/parser": "^8.17.0", "@ungap/structured-clone": "^1.2.0", "@vscode/debugprotocol": "^1.68.0", "@vscode/test-electron": "^2.4.1", @@ -50,7 +50,7 @@ "rewire": "^7.0.0", "sinon": "^18.0.1", "source-map-support": "^0.5.21", - "typescript": "^5.6.3" + "typescript": "^5.7.2" } }, "node_modules/@azure/abort-controller": { @@ -95,8 +95,8 @@ } }, "node_modules/@azure/core-rest-pipeline": { - "version": "1.18.0", - "integrity": "sha1-Fl8c2bsQYL47aJV0LbPR8RBicdM=", + "version": "1.18.1", + "integrity": "sha1-OA59PxW+gN6D7kFBdq2zKCRALzg=", "dev": true, "dependencies": { "@azure/abort-controller": "^2.0.0", @@ -190,8 +190,8 @@ } }, "node_modules/@azure/msal-node": { - "version": "2.16.1", - "integrity": "sha1-iYKIMujmyKiM7MTvbY1OQ1IRa3c=", + "version": "2.16.2", + "integrity": "sha1-Prdo02iD6m+ak5wLW0Z7UY54//w=", "dev": true, "dependencies": { "@azure/msal-common": "14.16.0", @@ -897,8 +897,8 @@ "optional": true }, "node_modules/@types/mocha": { - "version": "10.0.9", - "integrity": "sha1-EB6dqI0sAuWsiVKYLCOyJFJNZio=", + "version": "10.0.10", + "integrity": "sha1-kfYpBejSPL1mIlMS8jlFSiO+v6A=", "optional": true }, "node_modules/@types/mock-fs": { @@ -910,8 +910,8 @@ } }, "node_modules/@types/node": { - "version": "20.17.6", - "integrity": "sha1-bkBzIwwYDTV56MYBQfme/fXfAIE=", + "version": "20.17.9", + "integrity": "sha1-XxQdS37hJc3uX67+KN4JU5iGW6s=", "optional": true, "dependencies": { "undici-types": "~6.19.2" @@ -965,15 +965,15 @@ "optional": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.14.0", - "integrity": "sha1-fcDkGch76tyPVUv1pC5QCe03SNw=", + "version": "8.17.0", + "integrity": "sha1-LuBzxCH06B4C0Q5zEkFmS2JTsjw=", "optional": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/type-utils": "8.14.0", - "@typescript-eslint/utils": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/type-utils": "8.17.0", + "@typescript-eslint/utils": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -997,14 +997,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.14.0", - "integrity": "sha1-Cn6dvBG8B3FqstexImIX6fa1H8g=", + "version": "8.17.0", + "integrity": "sha1-LulyuxL6aaxiW4WBPcjZpaBT/1I=", "optional": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/typescript-estree": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", "debug": "^4.3.4" }, "engines": { @@ -1024,12 +1024,12 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.14.0", - "integrity": "sha1-AfN8FHpzXNePD/NV4DO5RX2h83M=", + "version": "8.17.0", + "integrity": "sha1-o/Sb89TSf/jWsuoJm6Rl7028qjo=", "optional": true, "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0" + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1040,12 +1040,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.14.0", - "integrity": "sha1-RVxq8wwzayShryi8T4G43V102U0=", + "version": "8.17.0", + "integrity": "sha1-0yZWn0mM3Q7fWNW7YDC0rZFOY9M=", "optional": true, "dependencies": { - "@typescript-eslint/typescript-estree": "8.14.0", - "@typescript-eslint/utils": "8.14.0", + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/utils": "8.17.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1056,6 +1056,9 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -1063,8 +1066,8 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.14.0", - "integrity": "sha1-DTPY0LCEecQk59ZUhV/d8sceQCE=", + "version": "8.17.0", + "integrity": "sha1-74THCe+DJOdmh4g0lwvqmn47cs8=", "optional": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1075,12 +1078,12 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.14.0", - "integrity": "sha1-p6OlpTpsCTE+EvtFMdT/WC7jwxI=", + "version": "8.17.0", + "integrity": "sha1-QLWQO8kpsejdnHfbPLUs+xmaKjQ=", "optional": true, "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1102,14 +1105,14 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.14.0", - "integrity": "sha1-rCUGh14Dq6JOYCNk5Dst+kVSnb0=", + "version": "8.17.0", + "integrity": "sha1-QcBRBaK2q3WS9RPS7rLCwCNtiQg=", "optional": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/typescript-estree": "8.14.0" + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1120,15 +1123,20 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.14.0", - "integrity": "sha1-JBjVpUZpr5ZYmGreTmz7d2fYFa0=", + "version": "8.17.0", + "integrity": "sha1-TbzQ4oub+VH0KTgFvzT5jfReGqg=", "optional": true, "dependencies": { - "@typescript-eslint/types": "8.14.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.17.0", + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1138,6 +1146,17 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "integrity": "sha1-aHussq+IT83aim59ZcYG9GoUzUU=", + "optional": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "integrity": "sha1-dWZBrbWHhRtcyz4JXa8nrlgchAY=", @@ -1149,12 +1168,12 @@ "optional": true }, "node_modules/@vscode/extension-telemetry": { - "version": "0.9.7", - "integrity": "sha1-OG4IwfmDUL1aNozPJ5pQGgzW3Wc=", + "version": "0.9.8", + "integrity": "sha1-EJqdteCdWwX5QDo/72DVljtmj8M=", "dependencies": { - "@microsoft/1ds-core-js": "^4.3.0", - "@microsoft/1ds-post-js": "^4.3.0", - "@microsoft/applicationinsights-web-basic": "^3.3.0" + "@microsoft/1ds-core-js": "^4.3.4", + "@microsoft/1ds-post-js": "^4.3.4", + "@microsoft/applicationinsights-web-basic": "^3.3.4" }, "engines": { "vscode": "^1.75.0" @@ -1869,8 +1888,8 @@ "optional": true }, "node_modules/cross-spawn": { - "version": "7.0.5", - "integrity": "sha1-kQqsiA/1JD2pa3KLxlIaX2wvL4I=", + "version": "7.0.6", + "integrity": "sha1-ilj+ePANzXDDcEUXWd+/rwPo7p8=", "devOptional": true, "dependencies": { "path-key": "^3.1.0", @@ -2566,8 +2585,8 @@ } }, "node_modules/flatted": { - "version": "3.3.1", - "integrity": "sha1-IdtHBymmc01JlwAvQ5yzCJh/Vno=", + "version": "3.3.2", + "integrity": "sha1-rboUSKmEG+xytCxTLqI9u+3vGic=", "optional": true }, "node_modules/foreground-child": { @@ -2723,11 +2742,14 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "integrity": "sha1-Kf923mnax0ibfAkYpXiOVkd8Myw=", + "version": "1.1.0", + "integrity": "sha1-348IOcLUjK78MqAlpJKU05YGyRI=", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.3" + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2758,9 +2780,12 @@ } }, "node_modules/has-proto": { - "version": "1.0.3", - "integrity": "sha1-sx3f6bDm6ZFFNqarKGQm0CFPd/0=", + "version": "1.1.0", + "integrity": "sha1-3rEElMu+iAm84WijuWH0KWn17UM=", "dev": true, + "dependencies": { + "call-bind": "^1.0.7" + }, "engines": { "node": ">= 0.4" }, @@ -2769,8 +2794,8 @@ } }, "node_modules/has-symbols": { - "version": "1.0.3", - "integrity": "sha1-u3ssQ0klHc6HsSX3vfh0qnyLOfg=", + "version": "1.1.0", + "integrity": "sha1-/JxqeDoISVHQuXH+EBjegTcHozg=", "dev": true, "engines": { "node": ">= 0.4" @@ -4851,8 +4876,8 @@ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "node_modules/ts-api-utils": { - "version": "1.4.0", - "integrity": "sha1-cJxvIHblEagVV/PQegy9VmroGVw=", + "version": "1.4.3", + "integrity": "sha1-v8IhX+ZSj+yrKw+6VwouikJjsGQ=", "optional": true, "engines": { "node": ">=16" @@ -4926,8 +4951,8 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "integrity": "sha1-XzRJ4xydlP67F94DzAgd1W2B21s=", + "version": "5.7.2", + "integrity": "sha1-MWnPjEyKgozeU7qeyz0rHV3We+Y=", "optional": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 7e797ff226..d86be154fd 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "onCommand:PowerShell.SpecifyScriptArgs" ], "dependencies": { - "@vscode/extension-telemetry": "^0.9.7", + "@vscode/extension-telemetry": "^0.9.8", "node-fetch": "^2.7.0", "semver": "^7.6.3", "untildify": "^4.0.0", @@ -73,9 +73,9 @@ "esbuild": "^0.21.5" }, "optionalDependencies": { - "@types/mocha": "^10.0.9", + "@types/mocha": "^10.0.10", "@types/mock-fs": "^4.13.4", - "@types/node": "^20.17.6", + "@types/node": "^20.17.9", "@types/node-fetch": "^2.6.12", "@types/rewire": "^2.5.30", "@types/semver": "^7.5.8", @@ -83,8 +83,8 @@ "@types/ungap__structured-clone": "^1.2.0", "@types/uuid": "^9.0.8", "@types/vscode": "~1.94.0", - "@typescript-eslint/eslint-plugin": "^8.14.0", - "@typescript-eslint/parser": "^8.14.0", + "@typescript-eslint/eslint-plugin": "^8.17.0", + "@typescript-eslint/parser": "^8.17.0", "@ungap/structured-clone": "^1.2.0", "@vscode/debugprotocol": "^1.68.0", "@vscode/test-electron": "^2.4.1", @@ -98,7 +98,7 @@ "rewire": "^7.0.0", "sinon": "^18.0.1", "source-map-support": "^0.5.21", - "typescript": "^5.6.3" + "typescript": "^5.7.2" }, "extensionDependencies": [ "vscode.powershell" @@ -311,8 +311,6 @@ "command": "GetVsCodeSessionId", "enablement": "false" } - - ], "menus": { "commandPalette": [ @@ -616,7 +614,7 @@ "markdownDescription": "Show buttons in the editor's title bar for moving the terminals pane (with the PowerShell Extension Terminal) around." }, "powershell.enableReferencesCodeLens": { - "type": "boolean", + "type": "boolean", "default": true, "markdownDescription": "Specifies if Code Lenses are displayed above function definitions, used to show the number of times the function is referenced in the workspace and navigate to those references. Large workspaces may want to disable this setting if performance is compromised. See also `#powershell.analyzeOpenDocumentsOnly#`." }, @@ -676,7 +674,7 @@ } } }, - { + { "title": "Formatting", "properties": { "powershell.codeFormatting.preset": { @@ -895,7 +893,7 @@ } } }, - { + { "title": "Pester", "properties": { "powershell.pester.useLegacyCodeLens": { From d75312ab20ef30aa395436c27d177fa4cad3d29f Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:16:43 -0800 Subject: [PATCH 8/8] v2024.5.2-preview: Bug fixes and build improvements. --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6941264e..261b13fc84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # PowerShell Extension Release History +## v2024.5.2-preview +### Wednesday, December 04, 2024 + +With PowerShell Editor Services [v4.1.0](https://github.com/PowerShell/PowerShellEditorServices/releases/tag/v4.1.0)! + +Bug fixes and build improvements. + +See more details at the GitHub Release for [v2024.5.2-preview](https://github.com/PowerShell/vscode-powershell/releases/tag/v2024.5.2-preview). + ## v2024.5.1-preview ### Monday, November 18, 2024 diff --git a/package.json b/package.json index d86be154fd..208a191649 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "powershell", "displayName": "PowerShell", - "version": "2024.5.1", + "version": "2024.5.2", "preview": false, "publisher": "ms-vscode", "description": "Develop PowerShell modules, commands and scripts in Visual Studio Code!",