Skip to content

Commit abaf531

Browse files
committed
Remove redundant check from Start-EditorServices
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. ```
1 parent c7088b7 commit abaf531

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

‎module/PowerShellEditorServices/Start-EditorServices.ps1‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ param(
4949
[ValidateSet("Diagnostic", "Verbose", "Normal", "Warning", "Error", "Trace", "Debug", "Information", "Critical", "None")]
5050
$LogLevel,
5151

52-
[ValidateNotNullOrEmpty()]
53-
[string]
54-
$SessionDetailsPath,
52+
[ValidateNotNullOrEmpty()]
53+
[string]
54+
$SessionDetailsPath,
5555

5656
[switch]
5757
$EnableConsoleRepl,
@@ -107,13 +107,5 @@ param(
107107
$DebugServiceOutPipeName
108108
)
109109

110-
#Translate legacy PSES log levels to MEL levels
111-
$LogLevel = switch ($LogLevel) {
112-
'Diagnostic' { 'Trace' }
113-
'Verbose' { 'Debug' }
114-
'Normal' { 'Information' }
115-
default { $LogLevel }
116-
}
117-
118110
Import-Module -Name "$PSScriptRoot/PowerShellEditorServices.psd1"
119111
Start-EditorServices @PSBoundParameters

0 commit comments

Comments
 (0)