Prerequisites
Summary
When you try starting PSES by calling Start-EditorServices.ps1 with a Microsoft.Extensions.Logging log level value, if it doesn't match one of the legacy log levels you get an error, e.g.:
19:22:57 ❯ pwsh -nol -nop -Command "& '$PWD/PowerShellEditorServices/Start-EditorServices.ps1' -BundledModulesPath '$PWD' -LogPath '$PWD/powershell_es.log' -SessionDetailsPath '$HOME/.cache/nvim/powershell_es.session.json' -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Information"
Start-EditorServices.ps1: Cannot validate argument on parameter 'LogLevel'. The argument "Information" does not belong to the set "Diagnostic,Verbose,Normal,Warning,Error" specified by the ValidateSet attribute. Supply an argument that is in the set
and then try the command again.
As you can see, it's expecting one of the legacy log levels: Diagnostic, Verbose, Normal, Warning, Error, while the MEL log level defines: Trace, Debug, Information, Warning, Error, Critical, None.
So these are the log levels missing from the validation (the one defined here Start-EditorServices.ps1:49):
Trace
Debug
Information
Critical
None
I believe this was introduced while making the changes for #2200 and this spot was simply missed. Also, I think the legacy log levels should be kept while a clear cut hasn't been made, for compatibility reasons - as noted here:
PSES used to have log levels that didn't match MEL levels, this is an adapter for those types and may eventually be removed once people migrate their settings.
If you'd like to reproduce the error, you just need to pass one of the log levels mentioned via -LogLevel, you can also use my command above, or you can use the one in the readme for Advanced Usage, since it uses Trace for the log level.
Workaround
Warning and Error can be used as is. For the rest of them, the code has the following mapping:
| MEL (New) |
Legacy |
| Trace |
Diagnostic |
| Debug |
Verbose |
| Information |
Normal |
| Critical |
N/A |
| None |
N/A |
PowerShell Version
Name Value
---- -----
PSVersion 7.5.1
PSEdition Core
GitCommitId 7.5.1
OS Ubuntu 22.04.5 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Editor Version
NVIM v0.12.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.1744317938
Compilation: /usr/bin/cc -O2 -g -flto -fno-fat-lto-objects -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fsigned-char -fstack-protector-strong -Wno-conversion -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -DUNIT_TESTING -D_GNU_SOURCE -DINCLUDE_GENERATED_DECLARATIONS -DUTF8PROC_STATIC -I~/.local/share/mise/downloads/neovim/ref-nightly/.deps/usr/include/luajit-2.1 -I~/.local/share/mise/downloads/neovim/ref-nightly/.deps/usr/include -I~/.local/share/mise/downloads/neovim/ref-nightly/build/src/nvim/auto -I~/.local/share/mise/downloads/neovim/ref-nightly/build/include -I~/.local/share/mise/downloads/neovim/ref-nightly/build/cmake.config -I~/.local/share/mise/downloads/neovim/ref-nightly/src -I/usr/include
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/share/nvim"
PowerShell Editor Services Version
Steps to Reproduce
pwsh -nol -nop -Command "./PowerShellEditorServices/Start-EditorServices.ps1 -SessionDetailsPath ./session.json -LogLevel Information"
Visuals
No response
Logs
No response
Prerequisites
Summary
When you try starting PSES by calling
Start-EditorServices.ps1with a Microsoft.Extensions.Logging log level value, if it doesn't match one of the legacy log levels you get an error, e.g.:As you can see, it's expecting one of the legacy log levels:
Diagnostic,Verbose,Normal,Warning,Error, while the MEL log level defines:Trace,Debug,Information,Warning,Error,Critical,None.So these are the log levels missing from the validation (the one defined here Start-EditorServices.ps1:49):
TraceDebugInformationCriticalNoneI believe this was introduced while making the changes for #2200 and this spot was simply missed. Also, I think the legacy log levels should be kept while a clear cut hasn't been made, for compatibility reasons - as noted here:
If you'd like to reproduce the error, you just need to pass one of the log levels mentioned via
-LogLevel, you can also use my command above, or you can use the one in the readme for Advanced Usage, since it usesTracefor the log level.Workaround
WarningandErrorcan be used as is. For the rest of them, the code has the following mapping:PowerShell Version
Editor Version
PowerShell Editor Services Version
-Steps to Reproduce
pwsh -nol -nop -Command "./PowerShellEditorServices/Start-EditorServices.ps1 -SessionDetailsPath ./session.json -LogLevel Information"Visuals
No response
Logs
No response