Skip to content

Failed to load PowerShellEditorServices with lspconfig (nvim) #1663

@rudesome

Description

@rudesome

Followed the instructions on: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#powershell_es
I only set the bundle_path, installed powershell from: https://aur.archlinux.org/packages/powershell/ and downloaded and unzipped the latest PowerShellEditorServices (3.1.0) in my home directory.

I get the error:

[START][2022-01-13 10:58:50] LSP logging initiated
[ERROR][2022-01-13 10:58:59] ...lsp/handlers.lua:404    "OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/completion 5 - System.ArgumentOutOfRangeException: Value is not between 1 and 0 (Parameter 'lineNumber')\nActual value was 1.\n   at Microsoft.PowerShell.EditorServices.Utility.Validate.IsWithinRange(String parameterName, Int32 valueToCheck, Int32 lowerLimit, Int32 upperLimit) in D:\\a\\1\\s\\src\\PowerShellEditorServices\\Utility\\Validate.cs:line 46\n   at Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFile.GetOffsetAtPosition(Int32 lineNumber, Int32 columnNumber) in D:\\a\\1\\s\\src\\PowerShellEditorServices\\Services\\TextDocument\\ScriptFile.cs:line 414\n   at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.GetCompletionsInFileAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber) in D:\\a\\1\\s\\src\\PowerShellEditorServices\\Services\\TextDocument\\Handlers\\CompletionHandler.cs:line 161\n   at Microsoft.PowerShell.EditorServices.Handlers.PsesCompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in D:\\a\\1\\s\\src\\PowerShellEditorServices\\Services\\TextDocument\\Handlers\\CompletionHandler.cs:line 72\n   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)\n   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)\n   at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext() | Method='textDocument/completion' RequestId='5'"
[ERROR][2022-01-13 11:00:14] .../vim/lsp/rpc.lua:420    "rpc"   "pwsh"  "stderr"        "Exception encountered starting EditorServices. Exception logged in D:\\a\\1\\s\\src\\PowerShellEditorServices.Hosting\\Commands\\StartEditorServicesCommand.cs on line 252 in EndProcessing:\nSystem.Threading.ThreadStateException: Thread has not been started.\n   at System.Threading.Thread.Join(Int32 millisecondsTimeout)\n   at System.Threading.Thread.Join()\n   at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.TriggerShutdown() in D:\\a\\1\\s\\src\\PowerShellEditorServices\\Services\\PowerShell\\Host\\PsesInternalHost.cs:line 247\n   at Microsoft.PowerShell.EditorServices.Server.PsesLanguageServer.WaitForShutdown() in D:\\a\\1\\s\\src\\PowerShellEditorServices\\Server\\PsesLanguageServer.cs:line 164\n   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesRunner.CreateEditorServicesAndRunUntilShutdown() in D:\\a\\1\\s\\src\\PowerShellEditorServices.Hosting\\Internal\\EditorServicesRunner.cs:line 188\n   at Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing() in D:\\a\\1\\s\\src\\PowerShellEditorServices.Hosting\\Commands\\StartEditorServicesCommand.cs:line 247\n"

in lspinfo it show as active/attached:
lsp_powershell_es

full command is:
pwsh -NoLogo -NoProfile -Command ~/PowerShellEditorServices/PowerShellEditorServices/Start-EditorServices.ps1 -BundledModulesPath ~/PowerShellEditorServices -LogPath ~/.cache/nvim/powershell_es.log -SessionDetailsPath ~/.cache/nvim/powershell_es.session.json -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Normal

any ideas what this is and how to solve it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions