seblj / roslyn.nvim

Roslyn LSP plugin for neovim
MIT License
172 stars 18 forks source link

Last change broke the plugin on WSL #23

Closed franroa closed 3 months ago

franroa commented 3 months ago

I dont know the error after updating, the notification of Roslyn running does not appear at all

seblj commented 3 months ago

Please, at least give me some snippet of how you are configuring the plugin... It is impossible to debug issues like this

franroa commented 3 months ago

sorry, I am really new to this lsp thigs. I manage to go to the logs. I am getting this

`[ERROR][2024-07-25 22:49:53] ...lsp/handlers.lua:624 "Unhandled exception: MethodNotFound\nError: MethodNotFound\n at handleResponse (/root/.local/share/nvim/mason/packages/json-lsp/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/connection.js:595:48)\n at handleMessage (/root/.local/share/nvim/mason/packages/json-lsp/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/connection.js:432:20)\n at Immediate. (/root/.local/share/nvim/mason/packages/json-lsp/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/connection.js:402:30)\n at process.processImmediate (node:internal/timers:478:21)"

my config

return {
  {
    "seblj/roslyn.nvim",
    -- commit = "f38ca8fd8638b94d355af17d419cab394c82c9f5",
    config = function(_, opts)
      vim.api.nvim_set_keymap("n", "<leader>co", ":lua vim.cmd('CSFixUsings')<CR>", { noremap = true, silent = true })
      require("roslyn").setup({
        -- Optional. Will use `vim.lsp.protocol.make_client_capabilities()`,
        -- and it will also try to merge that with `nvim-cmp` LSP capabilities
        --
        config = {
          capabilities = {
            textDocument = {},
          },
          settings = {
            ["csharp|navigation"] = {
              dotnet_navigate_to_decompiled_sources = true,
            },
            ["csharp|symbol_search"] = {
              dotnet_search_reference_assemblies = true,
            },
            ["csharp|quick_info"] = {
              dotnet_show_remarks_in_quick_info = true,
            },
            ["csharp|implement_type"] = {
              dotnet_insertion_behavior = true,
              dotnet_property_generation_behavior = true,
            },
            ["csharp|highlighting"] = {
              dotnet_highlight_related_json_components = true,
              dotnet_highlight_related_regex_components = true,
            },
            ["csharp|completion"] = {
              dotnet_provide_regex_completions = true,
              dotnet_show_completion_items_from_unimported_namespaces = true,
              dotnet_show_name_completion_suggestions = true,
            },
            -- ["csharp|background_analysis"] = {
            --   dotnet_analyzer_diagnostics_scope = true,
            --   dotnet_compiler_diagnostics_scope = true,
            -- },
            ["csharp|code_lens"] = {
              dotnet_enable_references_code_lens = true,
              dotnet_enable_tests_code_lens = true,
            },
            ["csharp|inlay_hints"] = {
              csharp_enable_inlay_hints_for_implicit_object_creation = true,
              csharp_enable_inlay_hints_for_implicit_variable_types = true,
              csharp_enable_inlay_hints_for_lambda_parameter_types = true,
              csharp_enable_inlay_hints_for_types = true,
              dotnet_enable_inlay_hints_for_indexer_parameters = true,
              dotnet_enable_inlay_hints_for_literal_parameters = true,
              dotnet_enable_inlay_hints_for_object_creation_parameters = true,
              dotnet_enable_inlay_hints_for_other_parameters = true,
              dotnet_enable_inlay_hints_for_parameters = true,
              dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
              dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
              dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
            },
            -- ["csharp|code_style.formatting.indentation_and_spacing"] = {
            --   indent_size = 4, -- replace with your preferred indent size
            --   indent_style = "space", -- replace with your preferred indent style: "space" or "tab"
            --   tab_width = 4, -- replace with your preferred tab width
            -- },
            -- ["csharp|code_style.formatting.new_line"] = {
            --   end_of_line = "lf", -- replace with your preferred end of line character: "lf" or "crlf"
            -- },
          },
        },
        exe = vim.fs.joinpath(
          vim.fn.stdpath("data") --[[@as string]],
          "roslyn",
          "Microsoft.CodeAnalysis.LanguageServer.dll"
        ),
        -- NOTE: Set `filewatching` to false if you experience performance problems.
        -- Defaults to true, since turning it off is a hack.
        -- If you notice that the server is _super_ slow, it is probably because of file watching
        -- I noticed that neovim became super unresponsive on some large codebases, and that was because
        -- it schedules the file watching on the event loop.
        -- This issue went away by disabling that capability. However, roslyn will fallback to its own
        -- file watching, which can make the server super slow to initialize.
        -- Setting this option to false will indicate to the server that neovim will do the file watching.
        -- However, in `hacks.lua` I will also just don't start off any watchers, which seems to make the server
        -- a lot faster to initialize.
        filewatching = true,
      })
    end,
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        cs = { "csharpier" },
      },
      formatters = {
        csharpier = {
          command = "dotnet-csharpier",
          args = { "--write-stdout" },
        },
      },
    },
  },
}

`

seblj commented 3 months ago

Aaaah okay. Sorry, I must have made somewhat of a breaking change there. I will update the README with the "new" way of configuring exe. You can just remove exe from the config, as it will just use that as a default value, so no need to explicitly set it. (The same with filewathing and the long comment I have in the README about it :))

Otherwise, if you want to explicitly set it, you can do it like this:

exe = {
    "dotnet",
    vim.fs.joinpath(
        vim.fn.stdpath("data") --[[@as string]],
        "roslyn",
        "Microsoft.CodeAnalysis.LanguageServer.dll"
    ),
},

Note that it is now a table and explicitly also telling to run with dotnet. The name exe might actually be misleading now, and should instead really be cmd, but I don't want to bother with that breaking change for now at least