Saghen / blink.cmp

Performant, batteries-included completion plugin for Neovim
MIT License
1.3k stars 74 forks source link

[Bug]: Blink cause Roslyn lsp to crash #158

Closed JustBarnt closed 4 weeks ago

JustBarnt commented 4 weeks ago

I am using the Roslyn lsp plugin from https://github.com/seblj/roslyn.nvim

And once the completion window comes up for blink.cmp it immediately crashes the lsp with the following error message.

I have confirmed this doesn't happen within the nvim-cmp plugin.

There may be an issue with how blink.cmp sends a completion request over.

[ERROR][2024-10-21 09:22:51] ...lsp/handlers.lua:624    "[LanguageServerHost] System.InvalidOperationException: Unexpected null - file CompletionResolveHandler.cs line 92\r\n   at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber, String filePath) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 157\r\n   at Microsoft.CodeAnalysis.LanguageServer.Handler.CompletionResolveHandler.GetTextDocumentCacheEntry(CompletionItem request) in /_/src/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs:line 92\r\n   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 38\r\n   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.CreateRequestContextAsync[TRequest](IMethodHandler handler, RequestHandlerMetadata requestHandlerMetadata, AbstractLanguageServer`1 languageServer, CancellationToken cancellationToken)\r\n   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\r\n   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\r\n   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueAsync() in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 254"
Saghen commented 4 weeks ago

Closed with https://github.com/Saghen/blink.cmp/commit/ffc428208f292fa00cb7cced09d35de6e815ab55

JustBarnt commented 4 weeks ago

@Saghen I really appreciate the quick turn around, but the LSP is still crashing with the same error.

I included some information I probably should have included to begin with so my apologies.

 rustup default
nightly-x86_64-pc-windows-msvc (default)
nvim --version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
[ERROR][2024-10-21 09:22:51] ...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 38
   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"
Saghen commented 4 weeks ago

There must be a ghost in my system, the crash disappeared and reappeared again :smile: Latest commit should fix it

JustBarnt commented 4 weeks ago

@Saghen Hmmm. It still keeps crashing for me. Are you using Windows or Unix? I can't think of a reason why it would make a difference

JustBarnt commented 4 weeks ago

I'm gonna grab a fresh clone of kickstart real quick as well. I wonder if there is something in LazyVim's distro as well that could be causing an issue

Saghen commented 4 weeks ago

NixOS with roslyn-ls package on version 4.12.0-3.24470.4

JustBarnt commented 4 weeks ago

@Saghen Hmm. Okay gotcha. Then there may be an OS issue there which would intrigue me, or what I'm hoping the issue is- Is it is related to LazyVim since I know folke does some wizarding magic in his Distro. I'll get back after I've tried this in kickstart. Hopefully with good news saying its something in LazyVim and not something related to Windows.

JustBarnt commented 4 weeks ago

@Saghen I'm back with good news! It appears to definitely be something within LazyVim. Using a kickstart and just moving installing blink and roslyn.nvim it works just fine! So this is definitely fixed on your end! Ill have to do some investigating to see if I can find where it happens in LazyVim and make an issue over there! Thanks for working and fixing this super quick!

Saghen commented 4 weeks ago

My pleasure :) You might want to look into the capabilities sent to the LSP, particularly around itemDefaults. Perhaps LazyVim changes those. For ref: #13

JustBarnt commented 4 weeks ago

@Saghen Yea that was my thought. I know folke quite a few overrides for quite a few LSP related items so it wouldn't surprise me. Thanks again!