seblj / roslyn.nvim

Roslyn LSP plugin for neovim
MIT License
212 stars 23 forks source link

Roslyn Language Server Crashes When Accepting Suggestions from Blink Completion Plugin #62

Closed Imlimp closed 3 weeks ago

Imlimp commented 1 month ago

Description:

I have been trying to switch from nvim-cmp to blink-cmp but have been experiencing issues with the Roslyn language server (LSP).

I'm encountering a problem where the Roslyn language server stops unexpectedly whenever I accept a suggestion from the Blink completion plugin. Other language servers (LSPs) work fine with Blink, so I'm unsure if the issue lies with Roslyn or Blink.

Initially, everything seems to work, but whenever I accept a suggestion from Blink, I receive the following notification: Roslyn server stopped

Steps to Reproduce:

  1. Open a project in Neovim using blink-cmp.
  2. Begin typing to trigger auto-completion suggestions from Blink.
  3. Accept one of the suggested completions.

Expected Behavior:

Actual Behavior:

Logs

Here is the relevant excerpt from the :LspLog:

[ERROR][2024-10-10 09:41:16] ...lsp/handlers.lua:624 "[LanguageServerHost] System.InvalidOperationException: Unexpected null - file CompletionResolveHandler.cs line 92
   at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber, String filePath) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 157
   at Microsoft.CodeAnalysis.LanguageServer.Handler.CompletionResolveHandler.GetTextDocumentCacheEntry(CompletionItem request) in /_/src/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs:line 92
   at Microsoft.CodeAnalysis.LanguageServer.Handler.RequestContextFactory.CreateRequestContextAsync[TRequestParam](IQueueItem`1 queueItem, IMethodHandler methodHandler, TRequestParam requestParam, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/RequestContextFactory.cs:line 24
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.CreateRequestContextAsync[TRequest](IMethodHandler handler, RequestHandlerMetadata requestHandlerMetadata, AbstractLanguageServer`1 languageServer, CancellationToken cancellationToken)
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueCoreAsync[TRequest,TResponse](IQueueItem`1 work, IMethodHandler handler, RequestHandlerMetadata metadata, ConcurrentDictionary`2 concurrentlyExecutingTasks, CancellationTokenSource currentWorkCts, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 319
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.InvokeProcessCoreAsync(IQueueItem`1 work, RequestHandlerMetadata metadata, IMethodHandler handler, MethodInfo methodInfo, ConcurrentDictionary`2 concurrentlyExecutingTasks, CancellationTokenSource currentWorkCts, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 302
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueAsync() in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 254"

Additional Information:

seblj commented 1 month ago

This is most definitely a server issue or blink-cmp issue. We can leave the issue open though, and I can see when I get some time to look a bit into this. There was something similar previously with nvim-cmp and built in completion, and that seemed to be a server issue that was "somewhat" fixed

seblj commented 1 month ago

I tried to install blink myself, and I actually got an error immediately when starting to type. I tried to look a bit into it, but I have no idea why it is failing🤷‍♂️

However, I think it is best to try and open an issue over at blink to see if they understand what the problem might be. It shouldn't be something in this plugin at least since it seems to work perfectly with both nvim-cmp and the builtin lsp completion added in neovim nightly.

I am fine with leaving this open in case anyone else that is looking to switch to blink stumbles upon the same issue. Unfortunately, I personally will probably not spend much more time debugging this issue for now

adriankarlen commented 3 weeks ago

This issue is resolved in the latest release v0.4, so I am guessing this can be closed now :)

Blink issue for reference https://github.com/Saghen/blink.cmp/issues/158

seblj commented 3 weeks ago

Thanks for the update! Will close this now then :)