Skip to content

Failed to load PowerShellEditorServices with lspconfig (nvim) #1663

Closed
@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?

Activity

ghost added
Needs: TriageMaintainer attention needed!
on Jan 13, 2022
andyleejordan

andyleejordan commented on Jan 19, 2022

@andyleejordan
Member

Well that's an off-by-one error to be sure, but I don't know why nothing else has hit it yet.

moved this from Todo to Done in Sea Biscuiton Jan 24, 2022
andyleejordan

andyleejordan commented on Aug 6, 2022

@andyleejordan
Member

FYI @rudesome I've added an end-to-end regression test for Vim with PSES: #1874

ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @andyleejordan@StevenBucher98@rudesome

      Issue actions

        Failed to load PowerShellEditorServices with lspconfig (nvim) · Issue #1663 · PowerShell/PowerShellEditorServices