Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JustBarnt opened this issue Oct 21, 2024 · 10 comments
Closed

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

JustBarnt opened this issue Oct 21, 2024 · 10 comments

Comments

@JustBarnt
Copy link

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"

JustBarnt pushed a commit to JustBarnt/lazybarnt.nvim that referenced this issue Oct 21, 2024
@Saghen
Copy link
Owner

Saghen commented Oct 21, 2024

Closed with ffc4282

@Saghen Saghen closed this as completed Oct 21, 2024
@JustBarnt
Copy link
Author

@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
  • Blink.cmp setup
{
  "saghen/blink.cmp",
  lazy = false,
  dev = true,
  build = "cargo build --release",
  ---@module "blink.cmp"
  ---@type blink.cmp.Config
  opts = {
    sources = {
      providers = {
        { "blink.cmp.sources.lsp", name = "LSP" },
        { "blink.cmp.sources.snippets", name = "Snippets", score_offset = -1 },
        {
          "blink.cmp.sources.path",
          name = "Path",
          score_offset = 3,
          opts = { get_cwd = vim.uv.cwd },
        },
        {
          "blink.cmp.sources.buffer",
          name = "Buffer",
          keyword_length = 3,
          fallback_for = { "LSP" }, -- PENDING https://github.com/Saghen/blink.cmp/issues/122
        },
      },
    },
    highlight = { use_nvim_cmp_as_default = true },
    fuzzy = {
      prebuiltBinaries = {
        download = false,
        forceVersion = "v0.3.*",
      },
    },
    keymap = {
      show = "<C-space>",
      hide = "<C-e>",
      accept = "<C-y>",
      select_prev = { "<C-j>" },
      select_next = { "<C-k>" },

      show_documentation = "<C-space>",
      hide_documentation = "<C-space>",
      scroll_documentation_up = "<Up>",
      scroll_documentation_down = "<Down>",

      snippet_forward = "<Tab>",
      snippet_backward = "<S-Tab>",
    },
    nerd_font_variant = "mono",
    windows = {
      autocomplete = {
        border = "none",
        highlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None,FloatBorder:CmpBorder",
        selection = "preselect",
        draw = "reversed",
        cycle = { from_top = false },
      },
      documentation = {
        border = "none",
        winhighlight = "Normal:CmpDoc,FloatBorder:CmpDocBorder",
        auto_show = true,
        auto_show_delay_ms = 250,
      },
    },
  },
}
[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 Saghen reopened this Oct 21, 2024
@Saghen Saghen closed this as completed in 42f8efb Oct 21, 2024
@Saghen
Copy link
Owner

Saghen commented Oct 21, 2024

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

@JustBarnt
Copy link
Author

@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
Copy link
Author

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
Copy link
Owner

Saghen commented Oct 21, 2024

NixOS with roslyn-ls package on version 4.12.0-3.24470.4

@JustBarnt
Copy link
Author

@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
Copy link
Author

@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
Copy link
Owner

Saghen commented Oct 21, 2024

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
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants