plugins/lsp: add omnisharp language server

Co-authored-by: garaiza-93 <57430880+garaiza-93@users.noreply.github.com>
This commit is contained in:
Gaetan Lepage 2023-07-20 08:09:49 +02:00 committed by Gaétan Lepage
parent f1aaef47a9
commit 54ebe3b0ee
4 changed files with 77 additions and 1 deletions

View file

@ -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.";

View file

@ -1,4 +1,4 @@
{pkgs}: {
{
example = {
plugins.lsp = {
enable = true;

View file

@ -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;

View file

@ -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;
};
};
};
};
}