diff --git a/init.lua b/init.lua index 4fb8425..80ce14e 100644 --- a/init.lua +++ b/init.lua @@ -170,6 +170,80 @@ require("lazy").setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically "neanias/everforest-nvim", + { + "seblyng/roslyn.nvim", + ft = { "cs", "razor" }, + dependencies = { + { + -- By loading as a dependencies, we ensure that we are available to set + -- the handlers for roslyn + "tris203/rzls.nvim", + config = function() + ---@diagnostic disable-next-line: missing-fields + require("rzls").setup({}) + end, + }, + }, + config = function() + require("roslyn").setup({ + args = { + "--stdio", + "--logLevel=Information", + "--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()), + "--razorSourceGenerator=" .. vim.fs.joinpath( + vim.fn.stdpath("data") --[[@as string]], + "mason", + "packages", + "roslyn", + "libexec", + "Microsoft.CodeAnalysis.Razor.Compiler.dll" + ), + "--razorDesignTimePath=" .. vim.fs.joinpath( + vim.fn.stdpath("data") --[[@as string]], + "mason", + "packages", + "rzls", + "libexec", + "Targets", + "Microsoft.NET.Sdk.Razor.DesignTime.targets" + ), + }, + ---@diagnostic disable-next-line: missing-fields + config = { + handlers = require("rzls.roslyn_handlers"), + 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, + }, + ["csharp|code_lens"] = { + dotnet_enable_references_code_lens = true, + }, + }, + }, + }) + end, + init = function() + -- we add the razor filetypes before the plugin loads + vim.filetype.add({ + extension = { + razor = "razor", + cshtml = "razor", + }, + }) + end, + }, { "okuuva/auto-save.nvim", version = "^1.0.0", -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release @@ -456,7 +530,15 @@ require("lazy").setup({ -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { "williamboman/mason.nvim", opts = {} }, + { + "williamboman/mason.nvim", + opts = { + registries = { + "github:mason-org/mason-registry", + "github:crashdummyy/mason-registry", + }, + }, + }, "williamboman/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", @@ -682,6 +764,8 @@ require("lazy").setup({ }, }, }, + roslyn = {}, + omnisharp = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- diff --git a/lazy-lock.json b/lazy-lock.json index 3c5f767..a4b4841 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,10 +6,10 @@ "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "f9ef25a7ef00267b7d13bfc00b0dea22d78702d5" }, + "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, "everforest-nvim": { "branch": "main", "commit": "135cc21a45756e688dd1a3cbeb1c80a04b569b46" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, - "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, @@ -17,14 +17,16 @@ "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "mini.nvim": { "branch": "main", "commit": "5012cc35cebbdd97ab4f5906bcd713494d97b52e" }, "nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" }, - "nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" }, + "nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" }, "nvim-dap": { "branch": "master", "commit": "6a5bba0ddea5d419a783e170c20988046376090d" }, "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, - "nvim-lspconfig": { "branch": "master", "commit": "fb733ac734249ccf293e5c8018981d4d8f59fa8f" }, + "nvim-lspconfig": { "branch": "master", "commit": "919f83ef8169d11eabd921a4cbda4fc1ba12f123" }, "nvim-tree.lua": { "branch": "master", "commit": "6709463b2d18e77f7a946027917aa00d4aaed6f4" }, - "nvim-treesitter": { "branch": "master", "commit": "e70cb73e943db7483b0ea86a55e80d471bcb995c" }, + "nvim-treesitter": { "branch": "master", "commit": "1adcd5711929e44d1bc9e59fbf7d94656cf6d389" }, "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "roslyn.nvim": { "branch": "main", "commit": "02aa30c67a538c00ef197708daf2edba11d50a2b" }, + "rzls.nvim": { "branch": "main", "commit": "ebb652a4876c3c6af344333a6fc6bacffd85a27a" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },