Repository navigation
Closed
Labels
Description
Hi!
Kate is an awesome open source text editor made by the KDE folks, and it supports language servers. By default, they provide configurations for some popular languages, documented here: https://docs.kde.org/trunk5/en/kate/kate/kate-application-plugin-lspclient.html
I am trying to add PowerShell support in it, by using this config:
{
"servers": {
"powershell": {
"command": ["pwsh", "-NoLogo", "-NoProfile", "-Command", "%{ENV:USERPROFILE}/Desktop/PowerShellEditorServices/PowerShellEditorServices/Start-EditorServices.ps1", "-BundledModulesPath", "%{ENV:USERPROFILE}/Desktop/PowerShellEditorServices", "-LogPath", "%{ENV:TEMP}/kate/logs.log", "-SessionDetailsPath", "%{ENV:TEMP}/kate/session.json", "-HostName", "Kate", "-HostProfileId", "KDE.Kate", "-HostVersion", "2.0.0", "-Stdio", "-LogLevel", "Normal"],
"highlightingModeRegex": "^PowerShell$"
}
}
}The server starts successfully, and recognizes symbols, but that's it. Nothing else seems to work, definitions go-to, hover etc. This is the log:
2022-02-02 12:11:37.835 +05:30 [INF] highlight handler loaded
2022-02-02 12:11:38.942 +05:30 [INF] PSScriptAnalyzer settings file not found. Falling back to default rules
2022-02-02 12:11:43.975 +05:30 [FTL] Failed to handle request textDocument/hover 3
System.InvalidOperationException: Stack empty.
at System.Collections.Generic.Stack`1.ThrowForEmptyStack()
at System.Collections.Generic.Stack`1.Peek()
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentFrame() in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 153
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentRunspace() in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 137
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace.IRunspaceContext.get_CurrentRunspace() in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 151
at Microsoft.PowerShell.EditorServices.Services.SymbolsService.FindSymbolDetailsAtLocationAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber) in D:\a\1\s\src\PowerShellEditorServices\Services\Symbols\SymbolsService.cs:line 327
at Microsoft.PowerShell.EditorServices.Handlers.PsesHoverHandler.Handle(HoverParams request, CancellationToken cancellationToken) in D:\a\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\HoverHandler.cs:line 49
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()
I'm using PowerShell 7.1.2 on Windows 10 21H2.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
ydschneider commentedon Feb 10, 2022
I had the same issue when trying to use the builtin Neovim LSP client. I tried some older versions of the PowerShell Editor Services, release 2.5.3 works fine for me so far. Seems like this is broken since 3.0
rashil2000 commentedon Feb 10, 2022
Wow! Thank you, you're a genius :)
2.5.3 works perfect.
It looks like there was a major refactor, which broke it for stdio mode.
[-]Help needed with Kate configuration[/-][+]Stdio mode broken since v3.0.0[/+]rashil2000 commentedon Feb 10, 2022
Updated the title to be more specific
andyleejordan commentedon Feb 16, 2022
I think it's probably #1592
Interestingly though, we have a suite of LSP and DAP tests which use PSES over stdio, and they work. So we'll have to dig into what exactly is still broken.
andyleejordan commentedon Feb 16, 2022
Looking at that stack trace makes me wonder if we actually get into a command loop, since non-Code LSP clients don't usually start up an integrated console. 🤔
rashil2000 commentedon Feb 16, 2022
If it helps, Kate does have an integrated terminal, but only on Linux.
andyleejordan commentedon Feb 16, 2022
Hm, does it work on Linux just fine?
rashil2000 commentedon Feb 16, 2022
I have not tested it (don't have linux system).
ydschneider commentedon Feb 18, 2022
Just had a chance to test on Linux and got the exact same behavior. 3.1.2 and 3.1.3 lead to the error message from the original post, 2.5.3 works.
fl3pp commentedon Apr 3, 2022
I'm having the same issue using the Neovim LSP client and version 3.1.6 on Windows. Version 2.5.3 works just fine.
Because I didn't set up the project before, I spend hours troubleshooting this thing until I found this issue... Since LSP is just starting to take off in many editors, it is actually a bit frightening that stdio clients have been broken for so long, with many releases in between.
andyleejordan commentedon Apr 4, 2022
jflepp We are still working on getting v3 "released" into its main consumer, the VS Code extension. Once that work is done, we're slated to come back and get the stdio mode working again too 😊
fl3pp commentedon Apr 4, 2022
Andy Jordan (@andschwa) Appreciate the work, thanks for the update 👍
Sorry if I came off a bit judgy / demanding, I was just a bit frustrated. It's now working in the 2.5 release and I'm having a blast working with PowerShell completely in the console 😊
But if I understand this correctly, does this mean that the versions 3.0.0+ are neither working in VSCode nor in stdio based editors? Maybe it would then make sense to mark them as pre-releases so that people don't get confused.
andyleejordan commentedon Apr 4, 2022
3.0.0 is only in the preview channel for VS Code, and our top priority is to get that stable enough to release to the stable channel. So it's working (it uses named pipes) but we're working on sorting through our remaining MVP issues.
4 remaining items
andyleejordan commentedon May 9, 2022
Getting to work on this now!
andyleejordan commentedon May 17, 2022
I think I got this solved! It was...a doozy. Had a few issues to fix. Tested successfully with eglot in Emacs. Will get a release out ASAP (today is the plan!) and hope you all can test in your various environments with different clients.
andyleejordan commentedon May 18, 2022
Heyo, sorry, that took a bit longer to get out than expected due to client-side tests failing. Rashil Gandhi (@rashil2000), fl3pp, Yannick Schneider (@ydschneider) Can you give v3.4.0 a try?
fl3pp commentedon May 19, 2022
Hi Andy Jordan (@andschwa), thanks for taking a look at the issue.
Unfortunately, the version you supplied doesn't work, although a behavior change was noticeable. In the log of NeoVim
NVIM v0.7.0-dev+1385-g6786b6afaI can see following exceptions thrown by PowershellES:The configuration I'm running works flawlessly with version
2.5.3:andyleejordan commentedon May 19, 2022
Interesting...I have it working with Emacs and eglot with this configuration:
andyleejordan commentedon May 19, 2022
We figured it out! Fix incoming.
andyleejordan commentedon May 19, 2022
fl3pp thanks for that log, it was super helpful. #1807
andyleejordan commentedon May 20, 2022
Ok fl3pp Can you please test https://github.com/PowerShell/PowerShellEditorServices/releases/tag/v3.4.1? I fixed that issue, but wonder if you'll find another!
fl3pp commentedon May 20, 2022
Andy Jordan (@andschwa) didn't find anything, it just works!
Thanks for fixing and have a nice weekend 😄
andyleejordan commentedon May 20, 2022
Yay! Thank you for testing!!!
andyleejordan commentedon Jun 9, 2022
Hey all, I really didn't want this to happen again, so I've setup a full regression test against Eglot (an Emacs LSP client using PSES over stdio).