diff --git a/configurations/homie/modules/home-assistant/netdaemon/apps/Spotify/PlaySong/PlaySong.cs b/configurations/homie/modules/home-assistant/netdaemon/apps/Spotify/PlaySong/PlaySong.cs index 354b43ec..b9092b87 100644 --- a/configurations/homie/modules/home-assistant/netdaemon/apps/Spotify/PlaySong/PlaySong.cs +++ b/configurations/homie/modules/home-assistant/netdaemon/apps/Spotify/PlaySong/PlaySong.cs @@ -1,6 +1,6 @@ using System; -using System.Text.Json; using System.Reflection; +using System.Text.Json; using HomeAssistantGenerated; diff --git a/flake.lock b/flake.lock index 06b3578a..98a868e1 100644 Binary files a/flake.lock and b/flake.lock differ diff --git a/flake.nix b/flake.nix index 8f714276..2ded77c5 100644 Binary files a/flake.nix and b/flake.nix differ diff --git a/homeManagerModules/neovim/default.nix b/homeManagerModules/neovim/default.nix index 7178b552..f1be72ea 100644 --- a/homeManagerModules/neovim/default.nix +++ b/homeManagerModules/neovim/default.nix @@ -50,6 +50,9 @@ in { silent = true, }); + -- https://github.com/seblj/roslyn.nvim/issues/121#issuecomment-2544076963 + vim.opt.cmdheight = 2; + -- Get rid of deprecated messages vim.tbl_add_reverse_lookup = function(tbl) for k, v in pairs(tbl) do diff --git a/homeManagerModules/neovim/langs/csharp.nix b/homeManagerModules/neovim/langs/csharp.nix index 4f71f23f..f97a562c 100644 --- a/homeManagerModules/neovim/langs/csharp.nix +++ b/homeManagerModules/neovim/langs/csharp.nix @@ -1,20 +1,22 @@ -{ +self: { config, lib, pkgs, ... }: let inherit (lib) attrValues mkIf; + inherit (self.lib.${pkgs.system}) buildPlugin; + inherit (self.inputs) vimplugin-roslyn-nvim-src; cfg = config.programs.neovim; -in - mkIf cfg.enableIde { +in { + config = mkIf cfg.enableIde { programs = { neovim = { extraPackages = attrValues { inherit (pkgs) - omnisharp-roslyn + roslyn-ls ; }; @@ -26,45 +28,51 @@ in command = 'setlocal ts=4 sw=4 sts=0 expandtab', }); - local omnisharp_extended = require('omnisharp_extended'); + vim.api.nvim_create_autocmd('User', { + pattern = 'RoslynInitialized', + callback = function() + vim.lsp.inlay_hint.enable(); + end, + }); - require('lspconfig').omnisharp.setup({ - cmd = { 'dotnet', '${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll' }, + -- FIXME: make editorconfig and format work + require('roslyn').setup({ + config = { + capabilities = require('cmp_nvim_lsp').default_capabilities(), - 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, + on_attach = function() + vim.lsp.inlay_hint.enable(); + end, + + settings = { + ["csharp|inlay_hints"] = { + csharp_enable_inlay_hints_for_implicit_object_creation = true, + csharp_enable_inlay_hints_for_implicit_variable_types = true, + csharp_enable_inlay_hints_for_lambda_parameter_types = true, + csharp_enable_inlay_hints_for_types = true, + dotnet_enable_inlay_hints_for_indexer_parameters = true, + dotnet_enable_inlay_hints_for_literal_parameters = true, + dotnet_enable_inlay_hints_for_object_creation_parameters = true, + dotnet_enable_inlay_hints_for_other_parameters = true, + dotnet_enable_inlay_hints_for_parameters = true, + dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true, + dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true, + dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true, + }, + }, }, - 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 = attrValues { - inherit - (pkgs.vimPlugins) - omnisharp-extended-lsp-nvim - ; - }; + plugins = [ + (buildPlugin "roslyn-nvim" 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 03206f39..60e63d9e 100644 --- a/homeManagerModules/neovim/langs/default.nix +++ b/homeManagerModules/neovim/langs/default.nix @@ -11,7 +11,6 @@ in { imports = [ ./bash.nix ./clang.nix - ./csharp.nix ./hyprlang.nix ./java.nix ./json.nix @@ -19,6 +18,7 @@ in { ./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 ed96cc20..34473ff6 100644 --- a/inputs/default.nix +++ b/inputs/default.nix @@ -276,6 +276,11 @@ let owner = "dmmulroy"; repo = "ts-error-translator.nvim"; } + { + name = "vimplugin-roslyn-nvim-src"; + owner = "seblj"; + repo = "roslyn.nvim"; + } # Overlays & packages { diff --git a/modules/base/packages/default.nix b/modules/base/packages/default.nix index 3b7462be..de96a3c3 100644 --- a/modules/base/packages/default.nix +++ b/modules/base/packages/default.nix @@ -22,7 +22,7 @@ in { ; }); - # FIXME: Omnisharp uses dotnet6 + # FIXME: Roslyn-ls uses dotnet6 https://github.com/NixOS/nixpkgs/blob/d3c42f187194c26d9f0309a8ecc469d6c878ce33/pkgs/by-name/ro/roslyn-ls/package.nix#L21 nixpkgs.config.permittedInsecurePackages = [ "dotnet-core-combined" "dotnet-sdk-6.0.428"