diff options
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/lsp.lua | 76 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 33 |
2 files changed, 78 insertions, 31 deletions
diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 6fe008e..5e8ddf8 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -281,7 +281,7 @@ require("lspconfig").lua_ls.setup({ }; }) -require('lspconfig').jedi_language_server.setup({}) +require("lspconfig").jedi_language_server.setup({}) local null_ls = require("null-ls") @@ -307,6 +307,80 @@ null_ls.setup({ }; }) +-- Debugging + +local dap, dapui = require("dap"), require("dapui") +dapui.setup() +dap.listeners.after.event_initialized["dapui_config"] = + function() dapui.open() end +dap.listeners.before.event_terminated["dapui_config"] = + function() dapui.close() end +dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end + +dap.adapters.coreclr = { + type = "executable"; + command = "netcoredbg"; + args = { "--interpreter=vscode" }; +} + +vim.g.dotnet_build_project = function() + local default_path = vim.fn.getcwd() .. "/" + if vim.g["dotnet_last_proj_path"] ~= nil then + default_path = vim.g["dotnet_last_proj_path"] + end + local path = vim.fn.input("Path to your *proj file", default_path, "file") + vim.g["dotnet_last_proj_path"] = path + local cmd = "dotnet build -c Debug " .. path .. " > /dev/null" + print("") + print("Cmd to execute: " .. cmd) + local f = os.execute(cmd) + if f == 0 then + print("\nBuild: ✔️ ") + else + print("\nBuild: ❌ (code: " .. f .. ")") + end +end + +vim.g.dotnet_get_dll_path = function() + local request = function() + return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") + end + + if vim.g["dotnet_last_dll_path"] == nil then + vim.g["dotnet_last_dll_path"] = request() + else + if vim.fn.confirm("Do you want to change the path to dll?\n" .. + vim.g["dotnet_last_dll_path"], "&yes\n&no", 2) == 1 then + vim.g["dotnet_last_dll_path"] = request() + end + end + + return vim.g["dotnet_last_dll_path"] +end + +dap.configurations.cs = { + { + type = "coreclr"; + name = "launch - netcoredbg"; + request = "launch"; + program = function() + if vim.fn.confirm("Should I recompile first?", "&yes\n&no", 2) == 1 then + vim.g.dotnet_build_project() + end + return vim.g.dotnet_get_dll_path() + end; + }; + { + -- If you get an "Operation not permitted" error using this, try disabling YAMA: + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + name = "Attach to process"; + type = "cs"; + request = "attach"; + pid = require("dap.utils").pick_process; + args = {}; + }; +} + vim.diagnostic.config({ virtual_text = false; signs = true; diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 714a8f5..b34398c 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -62,6 +62,8 @@ local PKGS = { { url = "https://github.com/Hoffs/omnisharp-extended-lsp.nvim.git" }; { url = "https://github.com/lewis6991/gitsigns.nvim.git" }; { url = "https://github.com/jose-elias-alvarez/null-ls.nvim.git" }; + { url = "https://github.com/mfussenegger/nvim-dap.git" }; + { url = "https://github.com/rcarriga/nvim-dap-ui.git" }; -- Dev container { url = "https://codeberg.org/esensar/nvim-dev-container.git" }; @@ -150,36 +152,7 @@ local function init_plugins() vim.o.foldenable = true require("devcontainer").setup({}) - require("renamer").setup({ - -- The popup title, shown if `border` is true - title = "Rename"; - -- The padding around the popup content - padding = { top = 0; left = 0; bottom = 0; right = 0 }; - -- The minimum width of the popup - min_width = 15; - -- The maximum width of the popup - max_width = 45; - -- Whether or not to shown a border around the popup - border = true; - -- The characters which make up the border - border_chars = { "─"; "│"; "─"; "│"; "╭"; "╮"; "╯"; "╰" }; - -- Whether or not to highlight the current word references through LSP - show_refs = true; - -- Whether or not to add resulting changes to the quickfix list - with_qf_list = true; - -- Whether or not to enter the new name through the UI or Neovim's `input` - -- prompt - with_popup = true; - -- Custom handler to be run after successfully renaming the word. Receives - -- the LSP 'textDocument/rename' raw response as its parameter. - handler = nil; - }) - - require("which-key").setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }) + require("which-key").setup({}) require("nvim-treesitter.configs").setup({ ensure_installed = { "javascript"; "typescript"; "lua"; "c_sharp"; "jsonc" }; |