seblj / roslyn.nvim

Roslyn LSP plugin for neovim
MIT License
130 stars 12 forks source link

on_attach not invoked #8

Closed Crashdummyy closed 3 months ago

Crashdummyy commented 3 months ago

Hi there

I've got some trouble setting this up.

My config looks like this with monkeyPatchSemanticTokens containing this workaround

but it looks like my on_attach never gets called.

{
  "seblj/roslyn.nvim",
  event = "User csFile",
  config = function()
    require("roslyn").setup({
      dotnet_cmd = "dotnet", -- this is the default
      roslyn_version = "4.12.0-1.24329.2", -- this is the default
      exe = vim.fs.joinpath(
        vim.fn.stdpath("data") --[[@as string]],
        "roslyn",
        "Microsoft.CodeAnalysis.LanguageServer.dll"
      ),
      on_attach = function(client)
        utils.notify("attached")
        utils_lsp.monkeyPatchSemanticTokens(client)
      end
    })
  end
}

However it appears like on_attach is never called. Am I missing something here ?

seblj commented 3 months ago

You can do this:

{
    "seblj/roslyn.nvim",
    event = "User csFile",
    config = function()
        require("roslyn").setup({
            config = {
                on_attach = function(client)
                    utils.notify("attached")
                    utils_lsp.monkeyPatchSemanticTokens(client)
                end,
            },
        })
    end,
}
seblj commented 3 months ago

The two first options you pass in is never used in my fork of the plugin, and the exe option is the same as the default, so it is also not needed

seblj commented 3 months ago

Also, you need to update to the latest commit I just pushed, since I wasn't passing along on_attach from the config until now

Crashdummyy commented 3 months ago

Damn thanks for that quick update. I'm literally trying to get it done for 4 hours straight :laughing:

Thanks for keeping this alive