diff --git a/modules/home-manager/programs/neovim/ftplugin/cs.lua b/modules/home-manager/programs/neovim/ftplugin/cs.lua index c129918..3b69f26 100644 --- a/modules/home-manager/programs/neovim/ftplugin/cs.lua +++ b/modules/home-manager/programs/neovim/ftplugin/cs.lua @@ -83,10 +83,6 @@ end ---@return thread function M:choose_dll() - self.projects = self.find_projects() - - local dap = require "dap" - return coroutine.create(function(search_coroutine) vim.ui.select( self.projects, @@ -100,13 +96,9 @@ function M:choose_dll() }, ---@param item CSFTPlugin.Project function(item) - local path = item and item.dll_path or dap.ABORT + self:run "build" - if path ~= dap.ABORT then - self:run "build" - end - - coroutine.resume(search_coroutine, path) + coroutine.resume(search_coroutine, item and item.dll_path or require("dap").ABORT) end ) end) @@ -120,20 +112,10 @@ function M:start() return end - vim.fn.setenv("DOTNET_ENVIRONMENT", "Development") - - local debugger_path = vim.fn.getnixpath "netcoredbg" .. "/bin/netcoredbg" + self.projects = self.find_projects() local dap = require "dap" - ---@type dap.ExecutableAdapter - dap.adapters.netcoredbg = { - type = "executable", - command = debugger_path, - args = { "--interpreter=vscode" }, - } - - ---@type dap.Configuration[] dap.configurations.cs = { { type = "netcoredbg", @@ -145,6 +127,8 @@ function M:start() }, } + vim.notify_once("Loaded projects for nvim-dap", vim.log.levels.INFO) + vim.g.loaded_csftplugin = true end diff --git a/modules/home-manager/programs/neovim/init.lua b/modules/home-manager/programs/neovim/init.lua index f05f9e8..2ce1cdd 100644 --- a/modules/home-manager/programs/neovim/init.lua +++ b/modules/home-manager/programs/neovim/init.lua @@ -11,8 +11,8 @@ vim.opt.rtp:prepend(lazypath) if not pcall(require, "lazy") then -- stylua: ignore vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) - vim.fn.getchar() - vim.cmd.quit() + vim.fn.getchar() + vim.cmd.quit() end require "lazy_setup" diff --git a/modules/home-manager/programs/neovim/lua/lazy_setup.lua b/modules/home-manager/programs/neovim/lua/lazy_setup.lua index 2abb3b7..3fb71f7 100644 --- a/modules/home-manager/programs/neovim/lua/lazy_setup.lua +++ b/modules/home-manager/programs/neovim/lua/lazy_setup.lua @@ -3,8 +3,8 @@ require("lazy").setup({ "AstroNvim/AstroNvim", --version = "^4", -- Remove version tracking to elect for nighly AstroNvim import = "astronvim.plugins", - opts = { -- AstroNvim options must be set here with the `import` key - mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up + opts = { -- AstroNvim options must be set here with the `import` key + mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override diff --git a/modules/home-manager/programs/neovim/lua/plugins/astrocore.lua b/modules/home-manager/programs/neovim/lua/plugins/astrocore.lua index ed325ae..c558b1c 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/astrocore.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/astrocore.lua @@ -11,11 +11,11 @@ return { -- Configure core features of AstroNvim features = { large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter - autopairs = true, -- enable autopairs at start - cmp = true, -- enable completion at start - diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) - highlighturl = true, -- highlight URLs at start - notifications = true, -- enable notifications at start + autopairs = true, -- enable autopairs at start + cmp = true, -- enable completion at start + diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) + highlighturl = true, -- highlight URLs at start + notifications = true, -- enable notifications at start }, -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on diagnostics = { @@ -24,20 +24,20 @@ return { }, -- vim options can be configured here options = { - opt = { -- vim.opt. - autoindent = true, -- indents automatically based on context - expandtab = true, -- use spaces instead of tabs + opt = { -- vim.opt. + autoindent = true, -- indents automatically based on context + expandtab = true, -- use spaces instead of tabs grepprg = "rg --vimgrep", -- use ripgrep on grep actions - number = true, -- sets vim.opt.number - relativenumber = true, -- sets vim.opt.relativenumber - shiftwidth = 2, -- how many spaces after indentation - signcolumn = "auto", -- sets vim.opt.signcolumn to auto - smartindent = true, -- smartly indent - spell = false, -- sets vim.opt.spell - tabstop = 2, -- how many spaces to indent when pressing tab - wrap = false, -- sets vim.opt.wrap + number = true, -- sets vim.opt.number + relativenumber = true, -- sets vim.opt.relativenumber + shiftwidth = 2, -- how many spaces after indentation + signcolumn = "auto", -- sets vim.opt.signcolumn to auto + smartindent = true, -- smartly indent + spell = false, -- sets vim.opt.spell + tabstop = 2, -- how many spaces to indent when pressing tab + wrap = false, -- sets vim.opt.wrap }, - g = { -- vim.g. + g = { -- vim.g. -- configure global vim variables (vim.g) -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` -- This can be found in the `lua/lazy_setup.lua` file diff --git a/modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua b/modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua index a72804a..bc14746 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/nvim-ufo.lua @@ -9,7 +9,7 @@ return { } local function handleFallbackException(bufnr, err, providerName) - if type(err) == "string" and err:match "UfoFallbackException" then + if type(err) == "string" and err:match("UfoFallbackException") then return require("ufo").getFolds(bufnr, providerName) else return require("promise").reject(err) diff --git a/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua b/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua index 27a8891..ea0dec6 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua @@ -2,57 +2,57 @@ ---@type LazySpec return { - "nvim-treesitter/nvim-treesitter", - ---@param _ LazyPlugin - ---@param opts TSConfig - opts = function(_, opts) - -- disable automatically installing parsers - opts.auto_install = false + "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, + -- 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, } diff --git a/modules/home-manager/programs/neovim/polish.lua b/modules/home-manager/programs/neovim/polish.lua index 7f2c3d1..c0c62c4 100644 --- a/modules/home-manager/programs/neovim/polish.lua +++ b/modules/home-manager/programs/neovim/polish.lua @@ -83,7 +83,7 @@ end, { range = true, nargs = "?" }) local dap = require "dap" ----@type dap.Adapter +-- @type DapAdapter dap.adapters.codelldb = { port = "${port}", type = "server", @@ -93,7 +93,7 @@ dap.adapters.codelldb = { }, } ----@type dap.Adapter +-- @type DapAdapter dap.adapters.cppdbg = { id = "cppdbg", type = "executable", @@ -101,14 +101,21 @@ dap.adapters.cppdbg = { "{pkgs.vscode-extensions.ms-vscode.cpptools}/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7", } ----@type dap.Adapter +-- @type DapAdapter +dap.adapters.netcoredbg = { + type = "executable", + command = "netcoredbg", + args = { "--interpreter=vscode" }, +} + +-- @type DapAdapter dap.adapters.godot = { type = "server", host = "127.0.0.1", port = 6006, } ----@type dap.Configuration[] +-- @type DapConfiguration dap.configurations.rust = { { name = "Launch file", @@ -122,7 +129,7 @@ dap.configurations.rust = { }, } ----@type dap.Configuration[] +-- @type DapConfiguration dap.configurations.cpp = { { name = "Launch file", @@ -150,7 +157,29 @@ dap.configurations.cpp = { dap.configurations.c = dap.configurations.cpp ----@type dap.Configuration[] +-- @type DapConfiguration +dap.configurations.cs = { + { + 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 dap.configurations.gdscript = { { name = "Launch scene",