Closed
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.