AvaloniaUI / AvaloniaVSCode

Visual Studio Code Extension for Avalonia UI
https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.vscode-avalonia
MIT License
103 stars 16 forks source link

VScode Avalonia XAML autocompletion doesn't work #110

Open RegreTTO opened 9 months ago

RegreTTO commented 9 months ago

Describe the bug

After triggering autocomplete it doesn't work and throws errors in "Avalonia Client" log section in VScode

To Reproduce

Steps to reproduce the behavior:

  1. Create new project with dotnet new install Avalonia.Templates
  2. Go to .axaml
  3. Click on "<" for example
  4. See error

Expected behavior

I get autocompletion

Environment

Additional context

Error itself
2024-02-13 20:07:23.837 [info] [Trace - 20:07:23] Sending notification 'textDocument/didChange'.
2024-02-13 20:07:23.843 [info] [Trace - 20:07:23] Sending request 'textDocument/completion - (2)'.
2024-02-13 20:07:23.853 [info] [Trace - 20:07:23] Received notification 'window/logMessage'.
2024-02-13 20:07:23.853 [info] [Error - 20:07:23] OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/completion 2 - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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.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.<b__5>d.MoveNext() | Method='textDocument/completion' RequestId='2'
2024-02-13 20:07:23.854 [info] [Trace - 20:07:23] Received response 'textDocument/completion - (2)' in 11ms. Request failed: Internal Error - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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.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.<b__5>d.MoveNext() (-32603).
2024-02-13 20:07:23.855 [info] [Error - 20:07:23] Request textDocument/completion failed.
2024-02-13 20:07:23.855 [info]   Message: Internal Error - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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.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.<b__5>d.MoveNext()
  Code: -32603 
2024-02-13 20:07:24.854 [info] [Trace - 20:07:24] Sending notification 'textDocument/didSave'.
2024-02-13 20:07:24.856 [info] [Trace - 20:07:24] Received notification 'window/logMessage'.
2024-02-13 20:07:24.857 [info] [Info  - 20:07:24] AvaloniaLanguageServer.Handlers.TextDocumentSyncHandler: DidSaveTextDocumentParams OmniSharp.Extensions.LanguageServer.Protocol.Models.DidSaveTextDocumentParams | Request='OmniSharp.Extensions.LanguageServer.Protocol.Models.DidSaveTextDocumentParams'
2024-02-13 20:07:25.169 [info] [Trace - 20:07:25] Sending notification 'workspace/didChangeWatchedFiles'.
timunie commented 9 months ago

@RegreTTO please make sure you have all the latest versions of the extension and Avalonia. If the issue persistets file a minimum repo.

Note: that the extension has its own repo where issues should be reported.

prashantvc commented 9 months ago

@RegreTTO This is fixed in the version v0.0.30, could you confirm that you have latest version of the extension?

RegreTTO commented 9 months ago

@prashantvc Yes. I've checked the version right now and it is exactly v0.0.30

RegreTTO commented 9 months ago

@timunie It was the first time I installed all avalonia-related plugins, so they are exactly last version

timunie commented 9 months ago

11.0.6 is outdated. 11.0.9 is recent.

RegreTTO commented 9 months ago

I installed it as said in the docs with dotnet new install Avalonia.Templates. I took version from my .csproj file.

timunie commented 9 months ago

The templates were maybe not updated yet. They are not always in sync with latest minor version, so please try to update your nugets 🙏

calee88 commented 9 months ago

@timunie Hello! How can I update my nugets? I tried

dotnet new install Avalonia.Templates::11.0.9

I got

Warning: Avalonia.Templates::11.0.9 is not found in NuGet feeds https://api.nuget.org/v3/index.json. Avalonia.Templates::11.0.9 could not be installed, the package does not exist.

I also searched for the Avalonia.Templates and found that the latest version is 11.0.6. https://www.nuget.org/packages?q=Avalonia.Templates

calee88 commented 9 months ago

I tried to update the package versions by manually changing the versions in .csproj file, and rebuild the project. However, the problem persists.

calee88 commented 9 months ago

I changed the extension to v0.0.29, and the problem has been resolved.

RegreTTO commented 8 months ago

Thanks, I'll try downgrading later

RegreTTO commented 8 months ago

@calee88 Indeed, downgrading fixes this problem

RegreTTO commented 8 months ago

Or not. After rebooting it started to infinitely ask me to build project, but nothing changes. It asks, I build, it asks again and so on

timunie commented 8 months ago

@RegreTTO please upload a minimum sample for us to reproduce.

RegreTTO commented 8 months ago

@timunie There is no need me to upload such. It is just dotnet new avalonia.mvvm, nothing more

microhobby commented 8 months ago

I'm having the same issue 😓

microhobby commented 8 months ago

Interesting, if I downgrade the extension to the v0.0.29 it works 🤔

Edit: yeah, now I see that this was already proposed, then confirmed.

LeadManPL commented 8 months ago

I can confirm. Just follow Avalonia docs to reproduce this error. Avalonia.Templates::11.0.6 is the newest version available.

Might be related to this OmniSharp issue #2525 or #2550

2024-03-05 15:52:27.694 [info] [Trace - 15:52:27] Sending request 'textDocument/completion - (1)'.
2024-03-05 15:52:27.729 [info] [Trace - 15:52:27] Received notification 'window/logMessage'.
2024-03-05 15:52:27.729 [info] [Error - 15:52:27] OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/completion 1 - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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() | Method='textDocument/completion' RequestId='1'
2024-03-05 15:52:27.736 [info] [Trace - 15:52:27] Received response 'textDocument/completion - (1)' in 41ms. Request failed: Internal Error - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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() (-32603).
2024-03-05 15:52:27.736 [info] [Error - 15:52:27] Request textDocument/completion failed.
2024-03-05 15:52:27.736 [info]   Message: Internal Error - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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()
  Code: -32603 
doxxx commented 8 months ago

I have the same problem, even after updating all the Avalonia packages in my project to 11.0.9 and with extension v0.0.31.

I'm running VS Code on Windows but connected to WSL.

doxxx commented 8 months ago

However, the same happens for a project opened from the Windows filesystem.

prashantvc commented 7 months ago

@doxxx the WSL support is untested. Let me check this one windows

AedDev commented 5 months ago

I changed the extension to v0.0.29, and the problem has been resolved.

Same issue here. Installed the latest versions of Avalonia.Templates which is 11.0.11 at the time of writing and the Avalonia VS Code Extension in version 0.0.31. Downgraded to 0.0.29 resolved the issue.

I am working on Pop!OS Linux by System76. VS Code is installed via flatpak.

Steps to reproduce:

2024-05-18 14:33:05.639 [info] [Trace - 2:33:05 PM] Sending notification 'textDocument/didChange'.
2024-05-18 14:33:05.639 [info] [Trace - 2:33:05 PM] Sending request 'textDocument/completion - (1)'.
2024-05-18 14:33:05.674 [info] [Trace - 2:33:05 PM] Received notification 'window/logMessage'.
2024-05-18 14:33:05.674 [info] [Error - 2:33:05 PM] OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/completion 1 - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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() | Method='textDocument/completion' RequestId='1'
2024-05-18 14:33:05.679 [info] [Trace - 2:33:05 PM] Received response 'textDocument/completion - (1)' in 40ms. Request failed: Internal Error - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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() (-32603).
2024-05-18 14:33:05.680 [info] [Error - 2:33:05 PM] Request textDocument/completion failed.
2024-05-18 14:33:05.680 [info]   Message: Internal Error - System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at AvaloniaLanguageServer.Services.Buffer.GetTextTillLine(Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/Buffer.cs:line 8
   at AvaloniaLanguageServer.Services.BufferService.GetTextTillPosition(DocumentUri key, Position position) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Services/BufferService.cs:line 22
   at AvaloniaLanguageServer.Handlers.CompletionHandler.Handle(CompletionParams request, CancellationToken cancellationToken) in /Users/prashantvc/Avalonia/src/AvaloniaLSP/AvaloniaLanguageServer/Handlers/CompletionHandler.cs:line 29
   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()
  Code: -32603
aneeskA commented 4 months ago

If this helps anyone, 0.0.31 had issues. Downgrading to 0.0.29 resolved the issue.

image image
tmp64 commented 1 week ago

Can confirm that the issue is fixed in latest commits. But you have to build the latest AvaloniaLSP manually.