Closed ForNeVeR closed 4 months ago
Logs from the LSP host:
2024-03-24 20:15:05.495 +01:00 [DBG] Opened file on disk: file:///t:/Temp/untitled26/file.ps1
2024-03-24 20:15:05.498 +01:00 [DBG] Finished: Routing Notification textDocument/didChange in 7ms
2024-03-24 20:15:05.498 +01:00 [FTL] Failed to handle request textDocument/didChange
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Position 1:5 is outside of the column range of 1 to 1.')
at Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFile.ValidatePosition(Int32 line, Int32 column) in C:\__w\1\s\src\PowerShellEditorServices\Services\TextDocument\ScriptFile.cs:line 277
at Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFile.ApplyChange(FileChange fileChange) in C:\__w\1\s\src\PowerShellEditorServices\Services\TextDocument\ScriptFile.cs:line 318
at Microsoft.PowerShell.EditorServices.Handlers.PsesTextDocumentHandler.Handle(DidChangeTextDocumentParams notification, CancellationToken token) in C:\__w\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\TextDocumentHandler.cs:line 52
at OmniSharp.Extensions.JsonRpc.JsonRpcServerServiceCollectionExtensions.RequestHandlerDecorator`2.Handle(T request, CancellationToken cancellationToken)
at MediatR.Internal.RequestHandlerWrapperImpl`2.<>c__DisplayClass1_0.<Handle>g__Handler|0()
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.<RouteNotification>g__InnerRoute|6_0(IServiceScopeFactory serviceScopeFactory, TDescriptor descriptor, Object params, CancellationToken token)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteNotification(IRequestDescriptor`1 descriptors, Notification notification, CancellationToken token)
at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass11_0.<<RouteNotification>b__3>d.MoveNext()
So, what happened here: PSES ignored our document creation message, seemingly because we were sending a wrong language id: "PowerShell"
instead of "powershell"
.
But it tried to apply typings to the created document anyway, which caused the error in log (thankfully).
.ps1
fileecho $Host.
This is seemingly because we currently ignore the events that came before server's been started.
(Not sure if it was a case before, or was surfaced due to some of my refactorings.)