From 7e93a4a4969d6f6c39aaf491b8167741b3fce0e6 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Mon, 10 Oct 2022 12:48:48 -0700 Subject: [PATCH 1/3] Fix automatic focus to temporary debug terminal (if it exists) This fixes the client so that if a temporary debug terminal is in use that it will be focused instead of the session terminal when debugging. --- src/features/DebugSession.ts | 5 +++-- src/features/PesterTests.ts | 5 +++-- src/features/RunCode.ts | 4 +--- src/main.ts | 2 +- src/process.ts | 7 ++----- src/session.ts | 22 +++++++++++++++------- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index e9cc0db3ab..e10bbd78e1 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -225,8 +225,9 @@ export class DebugSessionFeature extends LanguageClientConsumer if (this.sessionManager.getSessionStatus() !== SessionStatus.Running) { await this.sessionManager.start(); } - // Create or show the Extension Terminal. - vscode.commands.executeCommand("PowerShell.ShowSessionConsole", true); + + // Create or show the debug terminal (either temporary or session). + this.sessionManager.showDebugTerminal(true); return config; } diff --git a/src/features/PesterTests.ts b/src/features/PesterTests.ts index ec48743183..7cda274f1a 100644 --- a/src/features/PesterTests.ts +++ b/src/features/PesterTests.ts @@ -3,6 +3,7 @@ import * as path from "path"; import vscode = require("vscode"); +import { SessionManager } from "../session"; import Settings = require("../settings"); import utils = require("../utils"); @@ -16,7 +17,7 @@ export class PesterTestsFeature implements vscode.Disposable { private command: vscode.Disposable; private invokePesterStubScriptPath: string; - constructor() { + constructor(private sessionManager: SessionManager) { this.invokePesterStubScriptPath = path.resolve(__dirname, "../modules/PowerShellEditorServices/InvokePesterStub.ps1"); // File context-menu command - Run Pester Tests @@ -126,7 +127,7 @@ export class PesterTestsFeature implements vscode.Disposable { private async launch(launchConfig: vscode.DebugConfiguration): Promise { // Create or show the interactive console // TODO: #367 Check if "newSession" mode is configured - await vscode.commands.executeCommand("PowerShell.ShowSessionConsole", true); + this.sessionManager.showDebugTerminal(true); // TODO: Update to handle multiple root workspaces. // diff --git a/src/features/RunCode.ts b/src/features/RunCode.ts index 83f8c78473..db1a8546b3 100644 --- a/src/features/RunCode.ts +++ b/src/features/RunCode.ts @@ -1,11 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import * as path from "path"; import vscode = require("vscode"); import { SessionManager } from "../session"; import Settings = require("../settings"); -import utils = require("../utils"); enum LaunchType { Debug, @@ -41,7 +39,7 @@ export class RunCodeFeature implements vscode.Disposable { private async launch(launchConfig: string | vscode.DebugConfiguration) { // Create or show the interactive console // TODO: #367: Check if "newSession" mode is configured - await vscode.commands.executeCommand("PowerShell.ShowSessionConsole", true); + this.sessionManager.showDebugTerminal(true); // TODO: Update to handle multiple root workspaces. await vscode.debug.startDebugging(vscode.workspace.workspaceFolders?.[0], launchConfig); diff --git a/src/main.ts b/src/main.ts index eaccd6e405..c35e92cc60 100644 --- a/src/main.ts +++ b/src/main.ts @@ -139,7 +139,7 @@ export async function activate(context: vscode.ExtensionContext): Promise { await this.showSessionMenu(); }), vscode.workspace.onDidChangeConfiguration(async () => { await this.onConfigurationUpdated(); }), vscode.commands.registerCommand( - "PowerShell.ShowSessionConsole", (isExecute?: boolean) => { this.showSessionConsole(isExecute); }), + "PowerShell.ShowSessionConsole", (isExecute?: boolean) => { this.showSessionTerminal(isExecute); }), vscode.commands.registerCommand( "PowerShell.WalkthroughTelemetry", (satisfaction: number) => { this.sendTelemetryEvent("powershellWalkthroughSatisfaction", null, { level: satisfaction }); @@ -795,12 +795,20 @@ Type 'help' to get help. await this.restartSession(exePath.displayName); } - private showSessionConsole(isExecute?: boolean) { - if (this.languageServerProcess) { - this.languageServerProcess.showConsole(isExecute && !this.focusConsoleOnExecute); + // Shows the temp debug terminal if it exists, otherwise the session terminal. + public showDebugTerminal(isExecute?: boolean) { + if (this.debugSessionProcess) { + this.debugSessionProcess.showTerminal(isExecute && !this.focusTerminalOnExecute); + } else { + this.languageServerProcess?.showTerminal(isExecute && !this.focusTerminalOnExecute) } } + // Always shows the session terminal. + public showSessionTerminal(isExecute?: boolean) { + this.languageServerProcess?.showTerminal(isExecute && !this.focusTerminalOnExecute); + } + private async showSessionMenu() { const availablePowerShellExes = await this.powershellExeFinder.getAllAvailablePowerShellInstallations(); From 635283faf8bfdabb7c7df034cc2044351d0243f2 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Thu, 20 Oct 2022 10:24:20 -0700 Subject: [PATCH 2/3] Update CHANGELOG for `v2022.10.0` --- CHANGELOG.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dafe69155e..b04b733579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,56 @@ # PowerShell Extension Release History +## v2022.10.0 +### Thursday, October 20, 2022 + +This October stable release incorporates a number of bugfixes throughout September and +early October, though is no based on the latest preview, v2022.10.1-preview, as the +refactors involved in enabling TypeScript's strict type checking and ESLint's strict +linting will need more testing. However, based on the success of the PowerShell Script +Analyzer's [v1.21.0][pssa-v1.21] release we wanted to get this to you sooner! + +Highlighted bugfixes include: supporting events registered to PowerShell's `OnIdle` +handler so that Azure cmdlets such as `Az.Tools.Predictor` now work, a lock around the +client's `start()` so the extension terminal cannot accidentally be spawned multiple +times, and making the default debug configurations not override your current working +directory (by unsetting `cwd` on all of them). + +In addition to fixing bugs, we also reintroduced a fan-favorite feature: the PowerShell +Language Status Icon will visually indicate if the execution pipeline is busy. For +example, a long-running task in the PowerShell Extension Terminal or a launched editor +command will show a spinner! + +Finally, I wanted to call out work by Patrick to significantly improve the performance of +reference finding (which powers the reference code lenses), so large workspaces can now be +used more easily; when the improvement is not enough, we also introduced the setting +`powershell.enableReferencesCodeLens` which can be used to disable reference finding +without having to turn off other code lenses. + +[pssa-v1.21]: https://github.com/PowerShell/PSScriptAnalyzer/releases/tag/1.21.0 +#### [vscode-powershell](https://github.com/PowerShell/vscode-powershell) + +- 🐛 🔍 [vscode-powershell #4201](https://github.com/PowerShell/vscode-powershell/pull/4203) - Fix automatic focus to temporary debug terminal (if it exists). +- 🐛 ✂️ [vscode-powershell #4195](https://github.com/PowerShell/vscode-powershell/pull/4195) - Fix Function Help snippet. (Thanks @okhoel!) +- ✨ 📺 [vscode-powershell #4193](https://github.com/PowerShell/vscode-powershell/pull/4193) - Handle busy notification for all PowerShell tasks. +- ✨ ‍🕵️ [vscode-powershell #4164](https://github.com/PowerShell/vscode-powershell/pull/4164) - Enable new PSScriptAnalyzer option `avoidSemicolonsAsLineTerminators`. (Thanks @bergmeister!) +- ✨ 📺 [vscode-powershell #3954](https://github.com/PowerShell/vscode-powershell/pull/4187) - Re-implement indicator when running registered editor commands. +- 🐛 🔍 [vscode-powershell #4185](https://github.com/PowerShell/vscode-powershell/pull/4186) - Only check a script's extension if a script was given. +- 🐛 🔍 [vscode-powershell #4082](https://github.com/PowerShell/vscode-powershell/pull/4172) - Refactor the debug launch configuration resolvers. +- 🐛 📁 [vscode-powershell #4163](https://github.com/PowerShell/vscode-powershell/pull/4171) - Fix incorrect docstring for `powershell.cwd`. +- #️⃣ 🙏 [vscode-powershell #4170](https://github.com/PowerShell/vscode-powershell/pull/4170) - Add setting to only analyze open documents for references. +- 🐛 🛫 [vscode-powershell #4160](https://github.com/PowerShell/vscode-powershell/pull/4161) - Lock `SessionManager.start()` so only one session is started. +- ✨ 🔧 [vscode-powershell #4139](https://github.com/PowerShell/vscode-powershell/pull/4139) - Add setting to control the references code lens. + +#### [PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices) v3.5.4 + +- ✨ 🚂 [PowerShellEditorServices #1928](https://github.com/PowerShell/PowerShellEditorServices/pull/1928) - Generalize the execution busy status to all PowerShell tasks. +- ✨ ‍🕵️ [PowerShellEditorServices #1916](https://github.com/PowerShell/PowerShellEditorServices/pull/1916) - Upgrade PSScriptAnalyzer to 1.21.0. (Thanks @bergmeister!) +- ✨ 🙏 [PowerShellEditorServices #1924](https://github.com/PowerShell/PowerShellEditorServices/pull/1924) - Re-implement indicator when running registered editor commands. +- 🐛 🛫 [vscode-powershell #4048](https://github.com/PowerShell/PowerShellEditorServices/pull/1918) - Created a nested PowerShell for the top-level loop. +- #️⃣ 🙏 [PowerShellEditorServices #1917](https://github.com/PowerShell/PowerShellEditorServices/pull/1917) - Overhaul workspace search for symbol references. +- ✨ 🚨 [PowerShellEditorServices #1914](https://github.com/PowerShell/PowerShellEditorServices/pull/1914) - Add regression tests for F5 and F8 saving to history. +- ✨ 🙏 [PowerShellEditorServices #1900](https://github.com/PowerShell/PowerShellEditorServices/pull/1900) - Add setting to control references code lens. + ## v2022.10.0-preview ### Friday, October 07, 2022 From 193660bd9ccd25627f0ff895389fd3f0794be385 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Thu, 20 Oct 2022 10:24:20 -0700 Subject: [PATCH 3/3] Bump version to `v2022.10.0` --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0a735e6923..4d616d26fc 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "powershell-preview", - "displayName": "PowerShell Preview", + "name": "powershell", + "displayName": "PowerShell", "version": "2022.10.0", - "preview": true, + "preview": false, "publisher": "ms-vscode", - "description": "(Preview) Develop PowerShell modules, commands and scripts in Visual Studio Code!", + "description": "Develop PowerShell modules, commands and scripts in Visual Studio Code!", "engines": { "vscode": "^1.65.0" }, @@ -17,7 +17,7 @@ "Snippets", "Linters" ], - "icon": "media/PowerShell_Preview_Icon.png", + "icon": "media/PowerShell_Icon.png", "galleryBanner": { "color": "#ACD1EC", "theme": "light"