diff --git a/plugins/lsp/language-servers/default.nix b/plugins/lsp/language-servers/default.nix index a4ab50eb..68a6abb1 100644 --- a/plugins/lsp/language-servers/default.nix +++ b/plugins/lsp/language-servers/default.nix @@ -377,6 +377,60 @@ with lib; let }; }; } + { + name = "omnisharp"; + description = "Enable omnisharp language server, for C#"; + package = pkgs.omnisharp-roslyn; + cmd = cfg: ["${cfg.package}/bin/OmniSharp"]; + settings = cfg: {omnisharp = cfg;}; + settingsOptions = { + enableEditorConfigSupport = helpers.defaultNullOpts.mkBool true '' + Enables support for reading code style, naming convention and analyzer settings from + `.editorconfig`. + ''; + + enableMsBuildLoadProjectsOnDemand = helpers.defaultNullOpts.mkBool false '' + If true, MSBuild project system will only load projects for files that were opened in the + editor. + This setting is useful for big C# codebases and allows for faster initialization of code + navigation features only for projects that are relevant to code that is being edited. + With this setting enabled OmniSharp may load fewer projects and may thus display + incomplete reference lists for symbols. + ''; + + enableRoslynAnalyzers = helpers.defaultNullOpts.mkBool false '' + If true, MSBuild project system will only load projects for files that were opened in the + editor. + This setting is useful for big C# codebases and allows for faster initialization of code + navigation features only for projects that are relevant to code that is being edited. + With this setting enabled OmniSharp may load fewer projects and may thus display + incomplete reference lists for symbols. + ''; + + organizeImportsOnFormat = helpers.defaultNullOpts.mkBool false '' + Specifies whether 'using' directives should be grouped and sorted during document + formatting. + ''; + + enableImportCompletion = helpers.defaultNullOpts.mkBool false '' + Enables support for showing unimported types and unimported extension methods in + completion lists. + When committed, the appropriate using directive will be added at the top of the current + file. + This option can have a negative impact on initial completion responsiveness, particularly + for the first few completion sessions after opening a solution. + ''; + + sdkIncludePrereleases = helpers.defaultNullOpts.mkBool true '' + Specifies whether to include preview versions of the .NET SDK when determining which + version to use for project loading. + ''; + + analyzeOpenDocumentsOnly = helpers.defaultNullOpts.mkBool true '' + Only run analyzers against open files when 'enableRoslynAnalyzers' is true. + ''; + }; + } { name = "pylsp"; description = "Enable pylsp, for Python."; diff --git a/tests/test-sources/plugins/lsp/nixd.nix b/tests/test-sources/plugins/lsp/nixd.nix index dcaa37f8..1c3078dd 100644 --- a/tests/test-sources/plugins/lsp/nixd.nix +++ b/tests/test-sources/plugins/lsp/nixd.nix @@ -1,4 +1,4 @@ -{pkgs}: { +{ example = { plugins.lsp = { enable = true; diff --git a/tests/test-sources/plugins/lsp/nvim-lsp.nix b/tests/test-sources/plugins/lsp/nvim-lsp.nix index 9f3d0751..f62c60c0 100644 --- a/tests/test-sources/plugins/lsp/nvim-lsp.nix +++ b/tests/test-sources/plugins/lsp/nvim-lsp.nix @@ -92,6 +92,7 @@ metals.enable = true; nil_ls.enable = true; nixd.enable = true; + omnisharp.enable = true; pylsp.enable = true; pyright.enable = true; rnix-lsp.enable = true; diff --git a/tests/test-sources/plugins/lsp/omnisharp.nix b/tests/test-sources/plugins/lsp/omnisharp.nix new file mode 100644 index 00000000..7e8e9880 --- /dev/null +++ b/tests/test-sources/plugins/lsp/omnisharp.nix @@ -0,0 +1,21 @@ +{ + defaults = { + plugins.lsp = { + enable = true; + + servers.omnisharp = { + enable = true; + + settings = { + enableEditorConfigSupport = true; + enableMsBuildLoadProjectsOnDemand = false; + enableRoslynAnalyzers = false; + organizeImportsOnFormat = false; + enableImportCompletion = false; + sdkIncludePrereleases = true; + analyzeOpenDocumentsOnly = true; + }; + }; + }; + }; +}