diff --git a/flake.lock b/flake.lock index d458a9d9..8d479a14 100644 Binary files a/flake.lock and b/flake.lock differ diff --git a/flake.nix b/flake.nix index 1d9edbe4..15a8c29c 100644 Binary files a/flake.nix and b/flake.nix differ diff --git a/homeManagerModules/neovim/langs/csharp.nix b/homeManagerModules/neovim/langs/csharp.nix index 240167d5..651a3a0d 100644 --- a/homeManagerModules/neovim/langs/csharp.nix +++ b/homeManagerModules/neovim/langs/csharp.nix @@ -1,20 +1,21 @@ -{ +self: { config, lib, pkgs, ... }: let inherit (lib) mkIf; + inherit (self.inputs) vimplugin-roslyn-nvim-src; cfg = config.programs.neovim; -in - mkIf cfg.enableIde { +in { + config = mkIf cfg.enableIde { programs = { neovim = { extraPackages = builtins.attrValues { inherit (pkgs) - omnisharp-roslyn + roslyn-ls ; }; @@ -26,42 +27,24 @@ in 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({ - 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, - }, - }, + exe = 'Microsoft.CodeAnalysis.LanguageServer', }); ''; - plugins = builtins.attrValues { - inherit (pkgs.vimPlugins) omnisharp-extended-lsp-nvim; - }; + plugins = [ + (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; +} diff --git a/homeManagerModules/neovim/langs/default.nix b/homeManagerModules/neovim/langs/default.nix index 43f58ebf..91c1cabc 100644 --- a/homeManagerModules/neovim/langs/default.nix +++ b/homeManagerModules/neovim/langs/default.nix @@ -11,13 +11,13 @@ in { imports = [ ./bash.nix ./clang.nix - ./csharp.nix ./hyprlang.nix ./java.nix ./json.nix ./lua.nix ./python.nix ./rust.nix + (import ./csharp.nix self) (import ./markdown.nix self) (import ./nix.nix self) (import ./web.nix self) diff --git a/inputs/default.nix b/inputs/default.nix index ea723e08..4e5b1e73 100644 --- a/inputs/default.nix +++ b/inputs/default.nix @@ -266,6 +266,11 @@ let owner = "dmmulroy"; repo = "ts-error-translator.nvim"; } + { + name = "vimplugin-roslyn-nvim-src"; + owner = "seblj"; + repo = "roslyn.nvim"; + } # Overlays & packages { diff --git a/nixosModules/base/packages/default.nix b/nixosModules/base/packages/default.nix index 5441586a..9873ae37 100644 --- a/nixosModules/base/packages/default.nix +++ b/nixosModules/base/packages/default.nix @@ -22,9 +22,10 @@ in { ; }); - # FIXME: Omnisharp uses dotnet6 + # FIXME: Roslyn-ls uses dotnet6 nixpkgs.config.permittedInsecurePackages = [ "dotnet-core-combined" + "dotnet-sdk-7.0.410" "dotnet-sdk-6.0.428" "dotnet-sdk-wrapped-6.0.428" ];