From c547f7ef4cdc6f1cb1441f7907a41d57132e714f Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:24:26 -0300 Subject: [PATCH 01/15] feat(hm/fish): add helper aliases and abbreviations for nix usage --- modules/home-manager/programs/fish/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/home-manager/programs/fish/default.nix b/modules/home-manager/programs/fish/default.nix index 3c5e4d1..b928270 100644 --- a/modules/home-manager/programs/fish/default.nix +++ b/modules/home-manager/programs/fish/default.nix @@ -30,12 +30,21 @@ shellAbbrs = { z = "zoxide"; + pkg_expr = { + position = "anywhere"; + expansion = "--expr 'with import { % }; '"; + }; + impure_cmd = { + position = "command"; + expansion = "NIXPKGS_ALLOW_UNFREE=1 nix % --impure"; + }; }; shellAliases = { del = "trash_file"; dev = "nix develop -c fish"; doom = "~/.config/emacs/bin/doom"; + repl = "NIXPKGS_ALLOW_UNFREE=1 nix repl --impure --extra-experimental-features 'flakes' nixpkgs.legacyPackages.x86_64-linux"; }; functions = { From 15defecc74373c5a370c01ae057bc1ee50b5ddbb Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:25:53 -0300 Subject: [PATCH 02/15] fix(neovim): prefer nvim-treesitter for C# folds --- .../programs/neovim/lua/plugins/nvim-ufo.lua | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua diff --git a/modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua b/modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua new file mode 100644 index 0000000..bc14746 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua @@ -0,0 +1,32 @@ +---@type LazySpec +return { + "kevinhwang91/nvim-ufo", + opts = { + provider_selector = function(_, filetype, _) + ---@type table + local ftDefaults = { + cs = "treesitter", + } + + local function handleFallbackException(bufnr, err, providerName) + if type(err) == "string" and err:match("UfoFallbackException") then + return require("ufo").getFolds(bufnr, providerName) + else + return require("promise").reject(err) + end + end + + return ftDefaults[filetype] + or function(bufnr) + return require("ufo") + .getFolds(bufnr, "lsp") + :catch(function(err) + return handleFallbackException(bufnr, err, "treesitter") + end) + :catch(function(err) + return handleFallbackException(bufnr, err, "indent") + end) + end + end, + }, +} From 8a8fec54767194822552fe676363ab4bdd88c1cf Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:35:42 -0300 Subject: [PATCH 03/15] feat(neovim): create a helper function to fetch Nix derivation outputs --- .../home-manager/programs/neovim/polish.lua | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/modules/home-manager/programs/neovim/polish.lua b/modules/home-manager/programs/neovim/polish.lua index 9641c76..837bb0f 100644 --- a/modules/home-manager/programs/neovim/polish.lua +++ b/modules/home-manager/programs/neovim/polish.lua @@ -15,6 +15,42 @@ vim.filetype.add({ }, }) +--- Define PackageOutput +--- @enum PackageOutput +local PACKAGEOUTPUT = { + out = 0, + lib = 1, +} + +--- Get the store path of a package +--- @param packagename NixSearchExceptions | string +--- @param packageoutput PackageOutput? +--- @return string | nil +vim.fn.getnixpath = function(packagename, packageoutput) + ---@enum (key) NixSearchExceptions + local exceptions = { + rzls = "callPackage ~/.system/modules/home-manager/programs/rzls { }", + } + + return vim.split( + vim.api.nvim_cmd( + vim.api.nvim_parse_cmd( + string.format( + "silent !nix eval --raw --expr 'with import { }; (%s).%s' --impure", + exceptions[packagename] or packagename, + (packageoutput == PACKAGEOUTPUT.out or packageoutput == nil) and "outPath" + or string.format("lib.getLib %s", packagename) + ), + {} + ), + { + output = true, + } + ), + "\n" + )[3] +end + local dap = require("dap") -- @type DapAdapter From 48599d27661cc780cf4ca151acc841edfb9b13fc Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:36:16 -0300 Subject: [PATCH 04/15] feat(neovim): create helper function that allows me to eval highlighted lua code --- .../home-manager/programs/neovim/polish.lua | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/modules/home-manager/programs/neovim/polish.lua b/modules/home-manager/programs/neovim/polish.lua index 837bb0f..a6ec9cc 100644 --- a/modules/home-manager/programs/neovim/polish.lua +++ b/modules/home-manager/programs/neovim/polish.lua @@ -51,6 +51,38 @@ vim.fn.getnixpath = function(packagename, packageoutput) )[3] end +--- Helper function to allow me to run commands grabbed +--- by the current selection. +--- @param isLua boolean +--- @return string +vim.fn.runcmdonmark = function(isLua) + local beginRow, beginCol = unpack(vim.api.nvim_buf_get_mark(0, "<")) + local endRow, endCol = unpack(vim.api.nvim_buf_get_mark(0, ">")) + + if beginRow == nil or beginCol == nil or endRow == nil or endCol == nil then + return "" + end + + local text = table.concat( + vim.tbl_map(function(incoming) + return vim.trim(incoming) + end, vim.api.nvim_buf_get_text(0, beginRow - 1, beginCol, endRow - 1, endCol + 1, {})), + " " + ) + + vim.notify("Running expression: " .. text, vim.log.levels.INFO) + + return vim.api.nvim_cmd( + vim.api.nvim_parse_cmd((isLua == true and ":lua " or "") .. text, {}) --[[@as vim.api.keyset.cmd]], + {} + ) +end + +--- Register the function as a command as well, to facilitate things. +vim.api.nvim_create_user_command("RunCmdOnMark", function(opts) + vim.fn.runcmdonmark((opts.args == "v:false" or opts.args == "false") and false or true) +end, { range = true, nargs = "?" }) + local dap = require("dap") -- @type DapAdapter From cfd84bde6a035d5f04c9ac04b72c80c80cd43cb1 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:36:46 -0300 Subject: [PATCH 05/15] fix(neovim): rename coreclr dap to netcoredbg --- modules/home-manager/programs/neovim/polish.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/home-manager/programs/neovim/polish.lua b/modules/home-manager/programs/neovim/polish.lua index a6ec9cc..6e708ad 100644 --- a/modules/home-manager/programs/neovim/polish.lua +++ b/modules/home-manager/programs/neovim/polish.lua @@ -104,7 +104,7 @@ dap.adapters.cppdbg = { } -- @type DapAdapter -dap.adapters.coreclr = { +dap.adapters.netcoredbg = { type = "executable", command = "netcoredbg", args = { "--interpreter=vscode" }, @@ -162,13 +162,23 @@ dap.configurations.c = dap.configurations.cpp -- @type DapConfiguration dap.configurations.cs = { { - type = "coreclr", - name = "launch - netcoredbg", + type = "netcoredbg", + name = "Launch DLL", request = "launch", program = function() return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") end, }, + { + type = "netcoredbg", + name = "Attach to debugger", + request = "attach", + program = function() + return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") + end, + pid = "${command:pickProcess}", + cwd = "${workspaceFolder}", + }, } -- @type DapConfiguration From 7025b5fe97f38041e868b381136b1f3ba2fb0ede Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:38:36 -0300 Subject: [PATCH 06/15] feat(neovim): add roslyn.nvim support + rzls.nvim --- .../home-manager/programs/neovim/default.nix | 4 +- modules/home-manager/programs/neovim/lsp.lua | 2 +- .../programs/neovim/lua/community.lua | 4 +- .../neovim/lua/plugins/roslyn-nvim.lua | 120 ++++++++++++++++++ .../neovim/lua/plugins/treesitter.lua | 99 ++++++++------- 5 files changed, 180 insertions(+), 49 deletions(-) create mode 100644 modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix index 367563f..f99486b 100644 --- a/modules/home-manager/programs/neovim/default.nix +++ b/modules/home-manager/programs/neovim/default.nix @@ -78,7 +78,9 @@ in vscode-extensions.ms-vscode.cpptools # C# - csharp-ls + #csharp-ls Testing roslyn.nvim + roslyn-ls + rzls csharpier netcoredbg diff --git a/modules/home-manager/programs/neovim/lsp.lua b/modules/home-manager/programs/neovim/lsp.lua index 8d617a6..65faa69 100644 --- a/modules/home-manager/programs/neovim/lsp.lua +++ b/modules/home-manager/programs/neovim/lsp.lua @@ -55,7 +55,7 @@ return { "basedpyright", "clangd", "cmake", - "csharp_ls", + --"csharp_ls", Testing roslyn.nvim "cssls", "denols", "eslint", diff --git a/modules/home-manager/programs/neovim/lua/community.lua b/modules/home-manager/programs/neovim/lua/community.lua index 13881f3..96d4822 100644 --- a/modules/home-manager/programs/neovim/lua/community.lua +++ b/modules/home-manager/programs/neovim/lua/community.lua @@ -18,9 +18,11 @@ return { { import = "astrocommunity.motion.mini-ai" }, { import = "astrocommunity.motion.mini-surround" }, + { import = "astrocommunity.test.neotest" }, + { import = "astrocommunity.pack.cmake" }, { import = "astrocommunity.pack.cpp" }, - { import = "astrocommunity.pack.cs" }, + -- { import = "astrocommunity.pack.cs" }, Trying out roslyn.nvim { import = "astrocommunity.pack.godot" }, { import = "astrocommunity.pack.html-css" }, { import = "astrocommunity.pack.json" }, diff --git a/modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua b/modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua new file mode 100644 index 0000000..1ebefc4 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua @@ -0,0 +1,120 @@ +---@type LazySpec +return { + "seblyng/roslyn.nvim", + ft = { "cs", "razor" }, + commit = "490fd2d0f76249032ef6ce503e43ccdaeed9616e", + lazy = true, + dependencies = { + { + "tris203/rzls.nvim", + config = function() + ---@diagnostic disable-next-line: missing-fields + require("rzls").setup { + path = vim.fn.getnixpath "rzls" .. "/bin/rzls", + } + end, + }, + }, + opts = function(_, opts) + local rzlspath = vim.fn.getnixpath "rzls" + require("roslyn.config").get() + + opts = { + exe = "Microsoft.CodeAnalysis.LanguageServer", + args = { + "--logLevel=Information", + "--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()), + "--razorSourceGenerator=" .. rzlspath .. "/lib/rzls/Microsoft.CodeAnalysis.Razor.Compiler.dll", + "--razorDesignTimePath=" .. rzlspath .. "/lib/rzls/Targets/Microsoft.NET.Sdk.Razor.DesignTime.targets", + }, + ---@type vim.lsp.ClientConfig + ---@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, + }, + }, + ---@class RoslynPatchedClient: vim.lsp.Client + ---@field patched boolean? + + ---@param client RoslynPatchedClient + ---@param bufnr integer + on_attach = function(client, bufnr) + -- Call AstroLSP's on_attach so it registers mappings, formatting, etc. + require("astrolsp").on_attach(client, bufnr) + + -- HACK: Patch out the `roslyn-ls` LSP client to have proper + -- semantic tokens. + -- This is a snippet of code taken and modified from: + -- https://github.com/seblyng/roslyn.nvim/wiki#semantic-tokens + if client.patched then + return + else + client.patched = true + end + + -- let the runtime know the server can do semanticTokens/full now + client.server_capabilities = vim.tbl_deep_extend("force", client.server_capabilities, { + semanticTokensProvider = { + full = true, + }, + }) + + local lsp_request = client.request + + client.request = function(method, params, handler, req_bufnr) + if method ~= vim.lsp.protocol.Methods.textDocument_semanticTokens_full then + return lsp_request(method, params, handler, req_bufnr) + end + + local target_bufnr = vim.uri_to_bufnr(params.textDocument.uri) + local line_count = vim.api.nvim_buf_line_count(target_bufnr) + local last_line = vim.api.nvim_buf_get_lines(target_bufnr, line_count - 1, line_count, true)[1] + + local returnvalue = lsp_request("textDocument/semanticTokens/range", { + textDocument = params.textDocument, + range = { + ["start"] = { + line = 0, + character = 0, + }, + ["end"] = { + line = line_count - 1, + character = string.len(last_line) - 1, + }, + }, + }, handler, req_bufnr) + return returnvalue + end + end, + }, + } + + return opts + end, + init = function() + vim.filetype.add { + extension = { + razor = "razor", + cshtml = "razor", + }, + } + end, +} diff --git a/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua b/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua index ee535af..ea0dec6 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua @@ -2,50 +2,57 @@ ---@type LazySpec return { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - -- add more things to the ensure_installed table protecting against community packs modifying it - opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { - -- Programming - "c", - "c_sharp", - "cmake", - "cpp", - "css", - "gdscript", - "godot_resource", - "html", - "hyprlang", - "javascript", - "jsdoc", - "lua", - "nim", - "nim_format_string", - "objc", - "proto", - "python", - "svelte", - "tsx", - "typescript", - "vue", - -- Scripting - "bash", - "glsl", - -- Configuring - "dockerfile", - "json", - "jsonc", - "nix", - "vhs", - "yaml", - -- Misc - "cuda", - "markdown", - "markdown_inline", - "query", - -- VIM - "vim", - "vimdoc", - }) - end, + "nvim-treesitter/nvim-treesitter", + ---@param _ LazyPlugin + ---@param opts TSConfig + opts = function(_, opts) + -- disable automatically installing parsers + opts.auto_install = false + + -- add more things to the ensure_installed table protecting against community packs modifying it + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed --[[@as string[]], { + -- Programming + "c", + "c_sharp", + "cmake", + "cpp", + "css", + "gdscript", + "godot_resource", + "html", + "hyprlang", + "javascript", + "jsdoc", + "lua", + "nim", + "nim_format_string", + "objc", + "proto", + "python", + "razor", + "svelte", + "tsx", + "typescript", + "vue", + -- Scripting + "bash", + "fish", + "glsl", + -- Configuring + "dockerfile", + "json", + "jsonc", + "nix", + "vhs", + "yaml", + -- Misc + "cuda", + "markdown", + "markdown_inline", + "query", + -- VIM + "vim", + "vimdoc", + }) + end, } From c848b78edaeddecd41994c9389b874986f3a3951 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:39:16 -0300 Subject: [PATCH 07/15] chore(neovim): style changes --- .../home-manager/programs/neovim/.neoconf.json | 14 ++++++++++++++ modules/home-manager/programs/neovim/.stylua.toml | 5 +++++ modules/home-manager/programs/neovim/default.nix | 4 +++- modules/home-manager/programs/neovim/lsp.lua | 15 +++++++++++---- .../programs/neovim/lua/plugins/user.lua | 11 +++++------ 5 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 modules/home-manager/programs/neovim/.neoconf.json create mode 100644 modules/home-manager/programs/neovim/.stylua.toml diff --git a/modules/home-manager/programs/neovim/.neoconf.json b/modules/home-manager/programs/neovim/.neoconf.json new file mode 100644 index 0000000..1a1be43 --- /dev/null +++ b/modules/home-manager/programs/neovim/.neoconf.json @@ -0,0 +1,14 @@ +{ + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + }, + "lspconfig": { + "lua_ls": { + "Lua.completion.callSnippet": "Replace" + } + } +} diff --git a/modules/home-manager/programs/neovim/.stylua.toml b/modules/home-manager/programs/neovim/.stylua.toml new file mode 100644 index 0000000..3ee0ae0 --- /dev/null +++ b/modules/home-manager/programs/neovim/.stylua.toml @@ -0,0 +1,5 @@ +quote_style = "AutoPreferDouble" +call_parentheses = "None" + +[sort_requires] +enabled = true diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix index f99486b..86fa47f 100644 --- a/modules/home-manager/programs/neovim/default.nix +++ b/modules/home-manager/programs/neovim/default.nix @@ -69,12 +69,14 @@ in # Needed by LuaSnip luajitPackages.jsregexp + # Treesitter + gcc # For compiling languages + # CMAKE neocmakelsp # C/C++ clang-tools - gcc # Needed for treesitter vscode-extensions.ms-vscode.cpptools # C# diff --git a/modules/home-manager/programs/neovim/lsp.lua b/modules/home-manager/programs/neovim/lsp.lua index 65faa69..c44dcce 100644 --- a/modules/home-manager/programs/neovim/lsp.lua +++ b/modules/home-manager/programs/neovim/lsp.lua @@ -10,16 +10,16 @@ return { opts = { -- Configuration table of features provided by AstroLSP features = { - autoformat = true, -- enable or disable auto formatting on start - codelens = true, -- enable/disable codelens refresh on start - inlay_hints = false, -- enable/disable inlay hints on start + autoformat = true, -- enable or disable auto formatting on start + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start semantic_tokens = true, -- enable/disable semantic token highlighting }, -- customize lsp formatting options formatting = { -- control auto formatting on save format_on_save = { - enabled = true, -- enable or disable format on save globally + enabled = true, -- enable or disable format on save globally allow_filetypes = { -- enable format on save for specified filetypes only -- "go", "c", @@ -76,6 +76,7 @@ return { ---@diagnostic disable: missing-fields config = { -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + ---@type lspconfig.Config nixd = { settings = { nixd = { @@ -94,6 +95,7 @@ return { }, }, }, + ---@type lspconfig.Config vtsls = { filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" }, settings = { @@ -112,6 +114,7 @@ return { }, }, }, + ---@type lspconfig.Config rust_analyzer = { settings = { ["rust-analyzer"] = { @@ -123,6 +126,10 @@ return { }, }, }, + ---@type lspconfig.Config + omnisharp = { + cmd = { "OmniSharp" }, + }, }, -- customize how language servers are attached handlers = { diff --git a/modules/home-manager/programs/neovim/lua/plugins/user.lua b/modules/home-manager/programs/neovim/lua/plugins/user.lua index 60b0925..f2d900a 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/user.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/user.lua @@ -85,7 +85,7 @@ return { { "xiyaowong/transparent.nvim", opts = function(_, opts) - local transparent = require("transparent") + local transparent = require "transparent" opts.groups = { "Comment", @@ -150,9 +150,9 @@ return { "WinSeparator", } - transparent.clear_prefix("BufferLine") - transparent.clear_prefix("Diagnostic") - transparent.clear_prefix("NvimTree") + transparent.clear_prefix "BufferLine" + transparent.clear_prefix "Diagnostic" + transparent.clear_prefix "NvimTree" end, }, @@ -160,10 +160,9 @@ return { { "jmbuhr/otter.nvim", dependencies = { - "hrsh7th/nvim-cmp", - "neovim/nvim-lspconfig", "nvim-treesitter/nvim-treesitter", }, + opts = {}, }, -- Adds highlighting and custom commands for ledger files From b9e6347a04a274dd05583eb83160be73ec3c0023 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:39:39 -0300 Subject: [PATCH 08/15] feat(neovim): add c_sharp treesitter query, fold regions --- modules/home-manager/programs/neovim/default.nix | 5 +++++ .../programs/neovim/queries/c_sharp/folds.scm | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 modules/home-manager/programs/neovim/queries/c_sharp/folds.scm diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix index 86fa47f..4d8a5f2 100644 --- a/modules/home-manager/programs/neovim/default.nix +++ b/modules/home-manager/programs/neovim/default.nix @@ -137,6 +137,11 @@ in source = ./lua; }; + xdg.configFile."nvim/queries" = { + recursive = true; + source = ./queries; + }; + xdg.configFile."nvim/lua/plugins/astrolsp.lua".source = pkgs.runCommand "astrolsp.lua" { } '' cp ${./lsp.lua} $out diff --git a/modules/home-manager/programs/neovim/queries/c_sharp/folds.scm b/modules/home-manager/programs/neovim/queries/c_sharp/folds.scm new file mode 100644 index 0000000..2ec6b8b --- /dev/null +++ b/modules/home-manager/programs/neovim/queries/c_sharp/folds.scm @@ -0,0 +1,14 @@ +;; extends + +; Capture entire regions for folding +( + (preproc_region) @region_begin + . + [ + (declaration) + (type_declaration) + ]* + . + (preproc_endregion) @region_end + (#make-range! "fold" @region_begin @region_end) +) From b402de2dd242ae9b8880c6e8b330e8f584a8a88d Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 11 Feb 2025 23:42:37 -0300 Subject: [PATCH 09/15] fix(neovim): allow cpu ollama rocm is broken for a while now --- modules/home-manager/programs/neovim/default.nix | 1 + specific/desktop/home-manager.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix index 4d8a5f2..399919e 100644 --- a/modules/home-manager/programs/neovim/default.nix +++ b/modules/home-manager/programs/neovim/default.nix @@ -49,6 +49,7 @@ in type = types.enum [ "amd" "nvidia" + "cpu" ]; }; }; diff --git a/specific/desktop/home-manager.nix b/specific/desktop/home-manager.nix index 0b20301..2f7fbae 100644 --- a/specific/desktop/home-manager.nix +++ b/specific/desktop/home-manager.nix @@ -126,6 +126,7 @@ # Enable ollama support ollama.enable = true; + ollama.type = "cpu"; }; modules.hyprland = { From 0b8b1d9af4dd79eba02c54aeaecd17d865ba49ff Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 12 Feb 2025 01:08:45 -0300 Subject: [PATCH 10/15] fix(fish): remove unused directories from PATH --- modules/home-manager/programs/fish/default.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/home-manager/programs/fish/default.nix b/modules/home-manager/programs/fish/default.nix index b928270..da4f342 100644 --- a/modules/home-manager/programs/fish/default.nix +++ b/modules/home-manager/programs/fish/default.nix @@ -17,13 +17,10 @@ ## Add directories to $PATH fish_add_path /home/wizardlink/.local/share/scripts \ /home/wizardlink/.config/emacs/bin \ - /home/wizardlink/.spicetify \ /home/wizardlink/.nimble/bin \ /home/wizardlink/.cargo/bin \ /home/wizardlink/.local/bin \ - /lib/flatpak/exports/bin \ - /home/wizardlink/.local/share/scripts/burrito \ - ${pkgs.vscode-extensions.vadimcn.vscode-lldb.adapter}/bin + /lib/flatpak/exports/bin zoxide init --cmd cd fish | source ''; From f18e7ecadfae0d218b6f40c6c66bd304cd293a9e Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 12 Feb 2025 01:09:39 -0300 Subject: [PATCH 11/15] chore!: comment/update broken packages --- modules/home-manager/packages.nix | 2 +- modules/home-manager/programs/neovim/default.nix | 2 +- specific/desktop/services/jellyfin.nix | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/home-manager/packages.nix b/modules/home-manager/packages.nix index 41afbc0..553a846 100644 --- a/modules/home-manager/packages.nix +++ b/modules/home-manager/packages.nix @@ -37,7 +37,7 @@ libreoffice # Creative work - aseprite + # aseprite FIXME: Broken currently blender krita lmms diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix index 399919e..0cf20ce 100644 --- a/modules/home-manager/programs/neovim/default.nix +++ b/modules/home-manager/programs/neovim/default.nix @@ -119,7 +119,7 @@ in rust-analyzer cargo # Needed by blink-cmp taplo - vscode-extensions.vadimcn.vscode-lldb + #vscode-extensions.vadimcn.vscode-lldb # FIXME: Broken until MR 380775 hits nixpkgs-untable # Vue prettierd diff --git a/specific/desktop/services/jellyfin.nix b/specific/desktop/services/jellyfin.nix index badc27a..c7e3f0a 100644 --- a/specific/desktop/services/jellyfin.nix +++ b/specific/desktop/services/jellyfin.nix @@ -27,5 +27,10 @@ services.jellyseerr = { enable = true; openFirewall = true; + package = pkgs.jellyseerr.overrideAttrs ( + _final: _prev: { + dontCheckForBrokenSymlinks = true; + } + ); }; } From c0ae99447e7fcd635f7729c307c8b06d9d040aa3 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 12 Feb 2025 01:09:49 -0300 Subject: [PATCH 12/15] chore: flake update --- flake.lock | 95 ++++++++++++++++++++++-------------------------------- 1 file changed, 39 insertions(+), 56 deletions(-) diff --git a/flake.lock b/flake.lock index 8555657..dfd49c4 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1738183445, - "narHash": "sha256-C1He3N1SA8D2u+TSlldbA9wiYwDvXI4GxX3zKaeD7qU=", + "lastModified": 1739103745, + "narHash": "sha256-c53dcRaw0F4Os9WD05HwIRs9kTDZw4Mxe1XK4edEALo=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "48a000cf35dd10bfeb231152735aebbe875f4b74", + "rev": "a3dda0d10ce9aa1d1dfb7a6c139ea8c2872c74bd", "type": "github" }, "original": { @@ -69,22 +69,6 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -114,11 +98,11 @@ ] }, "locked": { - "lastModified": 1738200030, - "narHash": "sha256-z2DVxun8fEH0yeVIyfL68hXht+k2h3vEwNVxJPOMCgU=", + "lastModified": 1739314552, + "narHash": "sha256-ggVf2BclyIW3jexc/uvgsgJH4e2cuG6Nyg54NeXgbFI=", "owner": "nix-community", "repo": "home-manager", - "rev": "86a0d627cae02e8cc5d29eeb03de97f8c652a4bb", + "rev": "83bd3a26ac0526ae04fa74df46738bb44b89dcdd", "type": "github" }, "original": { @@ -163,11 +147,11 @@ ] }, "locked": { - "lastModified": 1738178255, - "narHash": "sha256-+D6Nu2ewXbMTFzx/Q4jDOo+LAOUPr0cxQJg5k33daIE=", + "lastModified": 1738664950, + "narHash": "sha256-xIeGNM+iivwVHkv9tHwOqoUP5dDrtees34bbFKKMZYs=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "dcadd3398abe146d60c67e0d9ee6e27b301cae82", + "rev": "7c6d165e1eb9045a996551eb9f121b6d1b30adc3", "type": "github" }, "original": { @@ -192,11 +176,11 @@ ] }, "locked": { - "lastModified": 1738018829, - "narHash": "sha256-5Ol5iahMlELx3lWuChyZsqqLk6sP6aqaJCJFw92OZGo=", + "lastModified": 1739049071, + "narHash": "sha256-3+7TpXMrbsUXSwgr5VAKAnmkzMb6JO+Rvc9XRb5NMg4=", "owner": "hyprwm", "repo": "hyprgraphics", - "rev": "12cd7034e441a5ebfdef1a090c0788413b4a635b", + "rev": "175c6b29b6ff82100539e7c4363a35a02c74dd73", "type": "github" }, "original": { @@ -221,11 +205,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1738192585, - "narHash": "sha256-bhlT5u8SHc10eFA695klLlKOm3Wb6um1bxuSgp3D5TU=", + "lastModified": 1739285923, + "narHash": "sha256-2G2qqyx9MIlWTxNVm+ADZvZSwrNhrV6UtazonxZ9FJ0=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "d462cc7fa166e1e6a6f14b58a2dd1e8b92e15426", + "rev": "f83fe9986b34c53c67b113a015d54fe8c084e9bd", "type": "github" }, "original": { @@ -246,11 +230,11 @@ ] }, "locked": { - "lastModified": 1737556638, - "narHash": "sha256-laKgI3mr2qz6tas/q3tuGPxMdsGhBi/w+HO+hO2f1AY=", + "lastModified": 1738422629, + "narHash": "sha256-5v+bv75wJWvahyM2xcMTSNNxmV8a7hb01Eey5zYnBJw=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "4c75dd5c015c8a0e5a34c6d02a018a650f57feb5", + "rev": "755aef8dab49d0fc4663c715fa4ad221b2aedaed", "type": "github" }, "original": { @@ -314,11 +298,11 @@ ] }, "locked": { - "lastModified": 1737981711, - "narHash": "sha256-lh6cL5D8nPplB3WovCQjLUZ7k7MViiBrMlpkfm4R7/c=", + "lastModified": 1739048983, + "narHash": "sha256-REhTcXq4qs3B3cCDtLlYDz0GZvmsBSh947Ub6pQWGTQ=", "owner": "hyprwm", "repo": "hyprland-qtutils", - "rev": "96bf0677fa9cd13508294e3d4559dfbbc8beff73", + "rev": "3504a293c8f8db4127cb0f7cfc1a318ffb4316f8", "type": "github" }, "original": { @@ -343,11 +327,11 @@ ] }, "locked": { - "lastModified": 1737634606, - "narHash": "sha256-W7W87Cv6wqZ9PHegI6rH1+ve3zJPiyevMFf0/HwdbCQ=", + "lastModified": 1739048914, + "narHash": "sha256-vd5rJBTmp2w7SDgfv23Zcd84ktI5eDA7e5UBzx+pKrU=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "f41271d35cc0f370d300413d756c2677f386af9d", + "rev": "a7334904d591f38757c46fbe2ab68651877d9099", "type": "github" }, "original": { @@ -368,11 +352,11 @@ ] }, "locked": { - "lastModified": 1737978343, - "narHash": "sha256-TfFS0HCEJh63Kahrkp1h9hVDMdLU8a37Zz+IFucxyfA=", + "lastModified": 1739048933, + "narHash": "sha256-ck6MaoYvISBQKqZR+HcxXnx0wOhyCauxfVMaV5zhJxQ=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "6a8bc9d2a4451df12f5179dc0b1d2d46518a90ab", + "rev": "e4e018a2ca6f5a9c33511973454199e1c7c85499", "type": "github" }, "original": { @@ -393,11 +377,11 @@ ] }, "locked": { - "lastModified": 1735493474, - "narHash": "sha256-fktzv4NaqKm94VAkAoVqO/nqQlw+X0/tJJNAeCSfzK4=", + "lastModified": 1739049028, + "narHash": "sha256-RleJp7LYbr6s+M1xgbmhtBs+fYa3ZdIiF7+QalJ4D1g=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "de913476b59ee88685fdc018e77b8f6637a2ae0b", + "rev": "04146df74a8d5ec0b579657307be01f1e241125f", "type": "github" }, "original": { @@ -455,11 +439,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1737885589, - "narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=", + "lastModified": 1739020877, + "narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8", + "rev": "a79cfe0ebd24952b580b1cf08cd906354996d547", "type": "github" }, "original": { @@ -471,11 +455,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1738142207, - "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", + "lastModified": 1739214665, + "narHash": "sha256-26L8VAu3/1YRxS8MHgBOyOM8xALdo6N0I04PgorE7UM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", + "rev": "64e75cd44acf21c7933d61d7721e812eac1b5a0a", "type": "github" }, "original": { @@ -520,18 +504,17 @@ }, "spicetify-nix": { "inputs": { - "flake-compat": "flake-compat_2", "nixpkgs": [ "nixpkgs" ], "systems": "systems_3" }, "locked": { - "lastModified": 1738099675, - "narHash": "sha256-q1oixDeEvoKm8t7Fr6vEGnv4sb8vRXCa6rF6YWIbGmk=", + "lastModified": 1739223162, + "narHash": "sha256-YrbYTM0CkZQG38Ysr2gF4BYdsQDNQtQ4YdQTDgw/zWM=", "owner": "Gerg-L", "repo": "spicetify-nix", - "rev": "2f0cc0c110c25804cd2f6c167ab66f567941452c", + "rev": "dea717737d04a2a3e877c082bfd2c7f91c1a33ff", "type": "github" }, "original": { From 919b5040128b63835bac8249b9fb49acfe869edd Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 12 Feb 2025 16:38:41 -0300 Subject: [PATCH 13/15] feat(neovim): add neotest-dotnet --- .../neovim/lua/plugins/roslyn-nvim.lua | 243 ++++++++++-------- 1 file changed, 129 insertions(+), 114 deletions(-) diff --git a/modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua b/modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua index 1ebefc4..40cfe0a 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/roslyn-nvim.lua @@ -1,120 +1,135 @@ ---@type LazySpec return { - "seblyng/roslyn.nvim", - ft = { "cs", "razor" }, - commit = "490fd2d0f76249032ef6ce503e43ccdaeed9616e", - lazy = true, - dependencies = { - { - "tris203/rzls.nvim", - config = function() - ---@diagnostic disable-next-line: missing-fields - require("rzls").setup { - path = vim.fn.getnixpath "rzls" .. "/bin/rzls", - } - end, - }, - }, - opts = function(_, opts) - local rzlspath = vim.fn.getnixpath "rzls" - require("roslyn.config").get() - - opts = { - exe = "Microsoft.CodeAnalysis.LanguageServer", - args = { - "--logLevel=Information", - "--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()), - "--razorSourceGenerator=" .. rzlspath .. "/lib/rzls/Microsoft.CodeAnalysis.Razor.Compiler.dll", - "--razorDesignTimePath=" .. rzlspath .. "/lib/rzls/Targets/Microsoft.NET.Sdk.Razor.DesignTime.targets", - }, - ---@type vim.lsp.ClientConfig - ---@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, - }, - }, - ---@class RoslynPatchedClient: vim.lsp.Client - ---@field patched boolean? - - ---@param client RoslynPatchedClient - ---@param bufnr integer - on_attach = function(client, bufnr) - -- Call AstroLSP's on_attach so it registers mappings, formatting, etc. - require("astrolsp").on_attach(client, bufnr) - - -- HACK: Patch out the `roslyn-ls` LSP client to have proper - -- semantic tokens. - -- This is a snippet of code taken and modified from: - -- https://github.com/seblyng/roslyn.nvim/wiki#semantic-tokens - if client.patched then - return - else - client.patched = true - end - - -- let the runtime know the server can do semanticTokens/full now - client.server_capabilities = vim.tbl_deep_extend("force", client.server_capabilities, { - semanticTokensProvider = { - full = true, - }, - }) - - local lsp_request = client.request - - client.request = function(method, params, handler, req_bufnr) - if method ~= vim.lsp.protocol.Methods.textDocument_semanticTokens_full then - return lsp_request(method, params, handler, req_bufnr) - end - - local target_bufnr = vim.uri_to_bufnr(params.textDocument.uri) - local line_count = vim.api.nvim_buf_line_count(target_bufnr) - local last_line = vim.api.nvim_buf_get_lines(target_bufnr, line_count - 1, line_count, true)[1] - - local returnvalue = lsp_request("textDocument/semanticTokens/range", { - textDocument = params.textDocument, - range = { - ["start"] = { - line = 0, - character = 0, - }, - ["end"] = { - line = line_count - 1, - character = string.len(last_line) - 1, - }, - }, - }, handler, req_bufnr) - return returnvalue - end + { + "seblyng/roslyn.nvim", + ft = { "cs", "razor" }, + commit = "490fd2d0f76249032ef6ce503e43ccdaeed9616e", + lazy = true, + dependencies = { + { + "tris203/rzls.nvim", + config = function() + ---@diagnostic disable-next-line: missing-fields + require("rzls").setup { + path = vim.fn.getnixpath "rzls" .. "/bin/rzls", + } end, }, - } + }, + opts = function(_, opts) + local rzlspath = vim.fn.getnixpath "rzls" + require("roslyn.config").get() - return opts - end, - init = function() - vim.filetype.add { - extension = { - razor = "razor", - cshtml = "razor", - }, - } - end, + opts = { + exe = "Microsoft.CodeAnalysis.LanguageServer", + args = { + "--logLevel=Information", + "--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()), + "--razorSourceGenerator=" .. rzlspath .. "/lib/rzls/Microsoft.CodeAnalysis.Razor.Compiler.dll", + "--razorDesignTimePath=" + .. rzlspath + .. "/lib/rzls/Targets/Microsoft.NET.Sdk.Razor.DesignTime.targets", + }, + ---@type vim.lsp.ClientConfig + ---@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, + }, + }, + ---@class RoslynPatchedClient: vim.lsp.Client + ---@field patched boolean? + + ---@param client RoslynPatchedClient + ---@param bufnr integer + on_attach = function(client, bufnr) + -- Call AstroLSP's on_attach so it registers mappings, formatting, etc. + require("astrolsp").on_attach(client, bufnr) + + -- HACK: Patch out the `roslyn-ls` LSP client to have proper + -- semantic tokens. + -- This is a snippet of code taken and modified from: + -- https://github.com/seblyng/roslyn.nvim/wiki#semantic-tokens + if client.patched then + return + else + client.patched = true + end + + -- let the runtime know the server can do semanticTokens/full now + client.server_capabilities = vim.tbl_deep_extend("force", client.server_capabilities, { + semanticTokensProvider = { + full = true, + }, + }) + + local lsp_request = client.request + + client.request = function(method, params, handler, req_bufnr) + if method ~= vim.lsp.protocol.Methods.textDocument_semanticTokens_full then + return lsp_request(method, params, handler, req_bufnr) + end + + local target_bufnr = vim.uri_to_bufnr(params.textDocument.uri) + local line_count = vim.api.nvim_buf_line_count(target_bufnr) + local last_line = + vim.api.nvim_buf_get_lines(target_bufnr, line_count - 1, line_count, true)[1] + + local returnvalue = lsp_request("textDocument/semanticTokens/range", { + textDocument = params.textDocument, + range = { + ["start"] = { + line = 0, + character = 0, + }, + ["end"] = { + line = line_count - 1, + character = string.len(last_line) - 1, + }, + }, + }, handler, req_bufnr) + return returnvalue + end + end, + }, + } + + return opts + end, + init = function() + vim.filetype.add { + extension = { + razor = "razor", + cshtml = "razor", + }, + } + end, + }, + { + "nvim-neotest/neotest", + dependencies = { "Issafalcon/neotest-dotnet", config = function() end }, + opts = function(_, opts) + if not opts.adapters then + opts.adapters = {} + end + table.insert(opts.adapters, require "neotest-dotnet" (require("astrocore").plugin_opts "neotest-dotnet")) + end, + }, } From 1eab51606081c4f103d5105ca18ac3df15e727e5 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 12 Feb 2025 16:39:00 -0300 Subject: [PATCH 14/15] fix(neovim): remove rzls exception for getnixpath --- modules/home-manager/programs/neovim/polish.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/home-manager/programs/neovim/polish.lua b/modules/home-manager/programs/neovim/polish.lua index 6e708ad..092fe7c 100644 --- a/modules/home-manager/programs/neovim/polish.lua +++ b/modules/home-manager/programs/neovim/polish.lua @@ -3,7 +3,7 @@ -- fit in the normal config locations above can go here -- Set up custom filetypes -vim.filetype.add({ +vim.filetype.add { extension = { foo = "fooscript", }, @@ -13,7 +13,7 @@ vim.filetype.add({ pattern = { ["~/%.config/foo/.*"] = "fooscript", }, -}) +} --- Define PackageOutput --- @enum PackageOutput @@ -28,9 +28,7 @@ local PACKAGEOUTPUT = { --- @return string | nil vim.fn.getnixpath = function(packagename, packageoutput) ---@enum (key) NixSearchExceptions - local exceptions = { - rzls = "callPackage ~/.system/modules/home-manager/programs/rzls { }", - } + local exceptions = {} return vim.split( vim.api.nvim_cmd( @@ -83,7 +81,7 @@ vim.api.nvim_create_user_command("RunCmdOnMark", function(opts) vim.fn.runcmdonmark((opts.args == "v:false" or opts.args == "false") and false or true) end, { range = true, nargs = "?" }) -local dap = require("dap") +local dap = require "dap" -- @type DapAdapter dap.adapters.codelldb = { From a1dcf49602e94beba78683cb46f453e75092bb78 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 12 Feb 2025 16:39:22 -0300 Subject: [PATCH 15/15] feat(neovim): add html lsp and prettierd to razor files --- modules/home-manager/programs/neovim/lsp.lua | 4 ++-- .../programs/neovim/lua/plugins/none-ls.lua | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/home-manager/programs/neovim/lsp.lua b/modules/home-manager/programs/neovim/lsp.lua index c44dcce..413048d 100644 --- a/modules/home-manager/programs/neovim/lsp.lua +++ b/modules/home-manager/programs/neovim/lsp.lua @@ -127,8 +127,8 @@ return { }, }, ---@type lspconfig.Config - omnisharp = { - cmd = { "OmniSharp" }, + html = { + filetypes = { "html", "templ", "razor" }, }, }, -- customize how language servers are attached diff --git a/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua b/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua index 9a918b2..304876d 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua @@ -8,8 +8,8 @@ return { }, opts = function(_, config) -- config variable is the default configuration table for the setup function call - local null_ls = require("null-ls") - local helpers = require("null-ls.helpers") + local null_ls = require "null-ls" + local helpers = require "null-ls.helpers" -- local deno_fmt = helpers.make_builtin({ -- name = "deno_fmt", @@ -44,16 +44,18 @@ return { -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics config.sources = require("astrocore").list_insert_unique(config.sources, { -- Set a formatter - require("none-ls.diagnostics.flake8"), - require("none-ls.formatting.ruff"), - null_ls.builtins.formatting.clang_format.with({ + require "none-ls.diagnostics.flake8", + require "none-ls.formatting.ruff", + null_ls.builtins.formatting.clang_format.with { disabled_filetypes = { "cs" }, - }), + }, null_ls.builtins.formatting.csharpier, null_ls.builtins.formatting.nixfmt, null_ls.builtins.formatting.stylua, --deno_fmt, - null_ls.builtins.formatting.prettierd, + null_ls.builtins.formatting.prettierd.with { + extra_filetypes = { "razor" }, + }, null_ls.builtins.code_actions.statix,