Skip to content

Remove redundant check from Start-EditorServices - #2344

Open
Christian Pfeiffer (ChrisTX) wants to merge 1 commit into
PowerShell:mainfrom
ChrisTX:fixstartuploglevel
Open

Christian Pfeiffer (ChrisTX) wants to merge 1 commit into
PowerShell:mainfrom
ChrisTX:fixstartuploglevel

Conversation

@ChrisTX

Copy link
Copy Markdown

This replaces #2333, which I closed by accident when cleaning up my forks. It's the same change, rebased onto the current main.

6f76c6e introduced a correct change to the ValidateSet, but added a redundant check that is already handled in StartEditorServicesCommand.cs in its StartLogging() routine. In fact, exchanging the values in Start-EditorServices will suppress the warning about the old PSES log levels that StartLogging() would normally emit.

However, the check is actually harmful on top of this issue since it doesn't check if LogLevel is even set.
If LogLevel is $null, then the default option

default { $LogLevel }

isn't valid PowerShell anymore:

The variable cannot be validated because the value $null is not a valid value for the LogLevel variable.

6f76c6e introduced a correct change to
the ValidateSet, but added a redundant check that is already handled in
`StartEditorServicesCommand.cs` in its `StartLogging()` routine. In
fact, exchanging the values in Start-EditorServices will suppress the
warning about the old PSES log levels that `StartLogging()` would
normally emit.

However, the check is actually harmful on top of this issue since it
doesn't check if LogLevel is even set.
If LogLevel is `$null`, then the default option
```
default { $LogLevel }
```
isn't valid PowerShell anymore:
```
The variable cannot be validated because the value $null is not a valid value for the LogLevel variable.
```
@ChrisTX
Christian Pfeiffer (ChrisTX) requested a review from a team as a code owner November 5, 2026 16:40
Copilot AI balanced review requested due to automatic review settings November 5, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the removal of redundant log-level translation from the PowerShell startup wrapper.

No open issues 🎉

What changed in this PR

Removes redundant log-level translation from the PowerShell startup wrapper, leaving legacy-level handling to StartEditorServicesCommand.StartLogging().

Changes:

  • Removes the reassignment that causes validation errors when LogLevel is omitted.
  • Leaves legacy log levels unchanged for downstream handling and warnings.
  • Normalizes indentation for SessionDetailsPath.
File Description
module/​PowerShellEditorServices/​Start-EditorServices.ps1 Removes duplicate log-level conversion and adjusts parameter indentation.

Review effort: Balanced

Christian Pfeiffer (ChrisTX) added a commit to ChrisTX/aur-packages that referenced this pull request Nov 5, 2026
- PowerShell/PowerShellEditorServices#2344 replaces #2333, which was closed
  by accident

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Arch Linux Technical User (archlinux-github) pushed a commit to archlinux/aur that referenced this pull request Nov 5, 2026
- PowerShell/PowerShellEditorServices#2344 replaces #2333, which was closed
  by accident

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants