Skip to content

My settings are not being applied, why? #286

Description

@Kevinizevbigie

Description

Thanks for making this plugin.

I have tried various iterations of the config file. I got roslyn working via mason but for some reason, I cannot get my settings to work. For example organize imports and inlay hints are not working. But I can see that the server has started (i get the message, and bad code had the E for error).

This less of a bug in the app, and more of a starting point to improve the documentation. Which I will more than happily do once this works.

Neovim version

NVIM v0.11.5

Operating system and version

Debian 13

Expected behavior

I expect that when I run vim.lsp.buf.format, that organize imports runs (because I have that setting on).

I also expect inlay hints.

Actual behavior

No inlay hints, but formatting runs.

Minimal config

-- Lazy
return {
  {
    "nvim-treesitter/nvim-treesitter",
    lazy = false,
    opts = {
      ensure_installed = {
        "vim",
        "lua",
        "vimdoc",
        "html",
        "css",

        -- !
        "c_sharp",
        "razor",
      },
    },
  },

    {
    "williamboman/mason.nvim",
    lazy = false,
    opts = {
      registries = {
        "github:mason-org/mason-registry",
        "github:Crashdummyy/mason-registry",
      },
      ensure_installed = {
        "lua-language-server",

        "xmlformatter",
        "csharpier",
        "prettier",

        "stylua",
        "bicep-lsp",
        "html-lsp",
        "css-lsp",
        "eslint-lsp",
        "typescript-language-server",
        "json-lsp",
        "rust-analyzer",

        -- !
        "roslyn"
     },
    },
  },
  {
    "seblyng/roslyn.nvim",
    ft = { "cs", "razor" },
    lazy = false,
    opts = {

    },
    config = function(_, opts)
        require('roslyn').setup(opts)
        vim.lsp.config('roslyn', {
          { 'gd', vim.lsp.buf.definition, desc = 'Goto Definition' },
          { 'gr', vim.lsp.buf.references, desc = 'Goto References' },
          { 'gi', vim.lsp.buf.implementation, desc = 'Goto Implementation' },
          { 'gD', vim.lsp.buf.type_definition, desc = 'Goto Type Definition' },
          { '<leader>cr', vim.lsp.buf.rename, desc = 'Rename Symbol' },
          { '<leader>ca', vim.lsp.buf.code_action, desc = 'Code Action' },

          on_attach = function(client, bufnr)
            if client.server_capabilities.inlayHintProvider then
              vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
            end
          end,

           -- Roslyn LSP server settings (these names come from Roslyn, not OmniSharp)
        settings = {
          ['csharp|inlay_hints'] = {
            csharp_enable_inlay_hints_for_parameters = true,
            csharp_enable_inlay_hints_for_literal_parameters = true,
            csharp_enable_inlay_hints_for_implicit_object_creation = true,
            csharp_enable_inlay_hints_for_indexer_parameters = true,
            csharp_enable_inlay_hints_for_other_parameters = true,
            csharp_enable_inlay_hints_for_return_types = true,
            csharp_enable_inlay_hints_for_struct = false,
            csharp_enable_inlay_hints_for_types = false,
          },
          ['csharp|code_lens'] = {
            dotnet_enable_references_code_lens = false,
          },
          ['csharp|background_analysis'] = {
            dotnet_analyzer_diagnostics_scope = 'fullSolution',
            dotnet_compiler_diagnostics_scope = 'fullSolution',
          },
          ['csharp|completion'] = {
            dotnet_show_completion_items_from_unimported_namespaces = true,
            dotnet_show_name_completion_suggestions = true,
          },
          ['csharp|formatting'] = {
            dotnet_organize_imports_on_format = true,
          },
        },
      })
    end,
   },
 }

Roslyn checkhealth

==============================================================================
roslyn:                                                                   1 ⚠️

roslyn.nvim: Requirements ~
- ✅ OK Neovim >= 0.11
- ✅ OK dotnet SDK >= 10 (found 10.0.101)

roslyn.nvim: Roslyn Language Server ~
- ✅ OK /home/vinnland/.local/share/nvim/mason/bin/roslyn: found
- ✅ OK Razor extension: found at /home/vinnland/.local/share/nvim/mason/packages/roslyn/libexec/.razorExtension
- ✅ OK vscode-html-language-server: found
- ⚠️ WARNING html-lsp client not configured
  - ADVICE:
    - Razor HTML support will be limited.
    - Consider configuring the html-lsp client for better Razor support.

roslyn.nvim: File Watching Configuration ~
- ✅ OK File watching: auto (using Roslyn's built-in file watcher)

roslyn.nvim: Solution Detection ~
- ✅ OK Selected solution: /home/vinnland/projects/dotnet/Commerce/Commerce.sln

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions