feat(nvim): omnisharp -> roslyn-ls
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-11 14:00:13 -05:00
parent ab17dbbc1c
commit caaaba4381
6 changed files with 28 additions and 39 deletions

Binary file not shown.

BIN
flake.nix

Binary file not shown.

View file

@ -1,20 +1,21 @@
{ self: {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (self.inputs) vimplugin-roslyn-nvim-src;
cfg = config.programs.neovim; cfg = config.programs.neovim;
in in {
mkIf cfg.enableIde { config = mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraPackages = builtins.attrValues { extraPackages = builtins.attrValues {
inherit inherit
(pkgs) (pkgs)
omnisharp-roslyn roslyn-ls
; ;
}; };
@ -26,42 +27,24 @@ in
command = 'setlocal ts=4 sw=4 sts=0 expandtab', command = 'setlocal ts=4 sw=4 sts=0 expandtab',
}); });
local omnisharp_extended = require('omnisharp_extended'); require('roslyn').setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
require('lspconfig').omnisharp.setup({ exe = 'Microsoft.CodeAnalysis.LanguageServer',
cmd = { "dotnet", "${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll" },
handlers = {
["textDocument/definition"] = omnisharp_extended.definition_handler,
["textDocument/typeDefinition"] = omnisharp_extended.type_definition_handler,
["textDocument/references"] = omnisharp_extended.references_handler,
["textDocument/implementation"] = omnisharp_extended.implementation_handler,
},
settings = {
FormattingOptions = {
EnableEditorConfigSupport = true,
OrganizeImports = true,
},
MsBuild = {
LoadProjectsOnDemand = false,
},
RoslynExtensionsOptions = {
EnableAnalyzersSupport = true,
EnableDecompilationSupport = true,
EnableImportCompletion = true,
AnalyzeOpenDocumentsOnly = false,
},
Sdk = {
IncludePrereleases = true,
},
},
}); });
''; '';
plugins = builtins.attrValues { plugins = [
inherit (pkgs.vimPlugins) omnisharp-extended-lsp-nvim; (pkgs.vimUtils.buildVimPlugin {
pname = "roslyn-nvim";
version = "0.0.0+${vimplugin-roslyn-nvim-src.shortRev}";
src = vimplugin-roslyn-nvim-src;
})
];
}; };
}; };
}; };
# For accurate stack trace
_file = ./csharp.nix;
} }

View file

@ -11,13 +11,13 @@ in {
imports = [ imports = [
./bash.nix ./bash.nix
./clang.nix ./clang.nix
./csharp.nix
./hyprlang.nix ./hyprlang.nix
./java.nix ./java.nix
./json.nix ./json.nix
./lua.nix ./lua.nix
./python.nix ./python.nix
./rust.nix ./rust.nix
(import ./csharp.nix self)
(import ./markdown.nix self) (import ./markdown.nix self)
(import ./nix.nix self) (import ./nix.nix self)
(import ./web.nix self) (import ./web.nix self)

View file

@ -266,6 +266,11 @@ let
owner = "dmmulroy"; owner = "dmmulroy";
repo = "ts-error-translator.nvim"; repo = "ts-error-translator.nvim";
} }
{
name = "vimplugin-roslyn-nvim-src";
owner = "seblj";
repo = "roslyn.nvim";
}
# Overlays & packages # Overlays & packages
{ {

View file

@ -22,9 +22,10 @@ in {
; ;
}); });
# FIXME: Omnisharp uses dotnet6 # FIXME: Roslyn-ls uses dotnet6
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [
"dotnet-core-combined" "dotnet-core-combined"
"dotnet-sdk-7.0.410"
"dotnet-sdk-6.0.428" "dotnet-sdk-6.0.428"
"dotnet-sdk-wrapped-6.0.428" "dotnet-sdk-wrapped-6.0.428"
]; ];