nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

[BUG] plugins/lsp omnisharp settings use incorrect case/structure

Open tarantoj opened this issue 1 year ago • 4 comments

Field Description
Plugin lsp
Nixpkgs unstable
Home Manager unstable

Description

The omnisharp lsp server expects options to be directly set using snake_case_lower, yet we provide them as a nested settings table using camelCase.

Minimal, Reproducible Example (MRE)

programs.nixvim = {
  plugins.lsp {
    enable = true;
    servers.omnisharp = {
      enable = true;
      settings.enableRoslynAnalyzers = true;
    };
  };
}

I'm pretty keen to contribute and fix this myself, just wondering if someone could point me in the right direction to idiomatically map props from settings.enableRoslynAnalyers -> enable_roslyn_analyzers

tarantoj avatar Feb 12 '24 23:02 tarantoj

Are you sure this is repercuted in the init.lua? Most plugins have a mapping from camelCase to snake_case

traxys avatar Feb 13 '24 09:02 traxys

@traxys

Here is the contents of options (using print(vim.inspect(server.extraOptions))) before the call to require('lspconfig')[server.name].setup(options)

{
  cmd = { "/nix/store/zpvg8d9zwwxj6g344cdqv3grpldcxvxz-omnisharp-roslyn-1.39.11/bin/OmniSharp" },
  settings = {
    omnisharp = {
      enableEditorConfigSupport = true,
      enableImportCompletion = true,
      enableMsBuildLoadProjectsOnDemand = true,
      enableRoslynAnalyzers = true,
      organizeImportsOnFormat = true,
      sdkIncludePrereleases = false
    }
  }
}

tarantoj avatar Feb 13 '24 09:02 tarantoj

For anyone stumbling across this looking for a dirty hack/workaround and a way to get omnisharp_extended working, see below:

          omnisharp = {
            enable = true;
            extraOptions = {
              enable_rosyln_analyzers = true;
              enable_import_completion = true;
              organize_imports_on_format = true;
              enable_editorconfig_support = true;
              analyze_open_documents_only = true;
              handlers."textDocument/definition".__raw =
                #lua
                "require('omnisharp_extended').handler";
            };
          };

tarantoj avatar Feb 13 '24 11:02 tarantoj

I'm pretty keen to contribute and fix this myself, just wondering if someone could point me in the right direction to idiomatically map props from settings.enableRoslynAnalyers -> enable_roslyn_analyzers

There is already a converter in helpers.toSnakeCase, although mapping over the keys will be a little more involved.

Bodleum avatar Mar 07 '24 18:03 Bodleum