From 7727a6f3d4957b453d3646a614183c70c27cb19a Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 25 Jan 2025 16:44:54 -0600 Subject: [PATCH] chore: update configs --- lazy-lock.json | 18 ++--- lua/plugins/debugging.lua | 135 +++++++++++++++++++++++++++++++++++++- lua/plugins/lsp.lua | 1 + lua/plugins/neotest.lua | 96 +++++++++++++++------------ lua/plugins/typr.lua | 6 ++ lua/vim-options.lua | 6 ++ 6 files changed, 210 insertions(+), 52 deletions(-) create mode 100644 lua/plugins/typr.lua diff --git a/lazy-lock.json b/lazy-lock.json index 3d9b57d..744cd4e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -13,23 +13,23 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.icons": { "branch": "main", "commit": "910db5df9724d65371182948f921fce23c2c881e" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "e6645ecfcba3e064446a6def1c10d788c9873f51" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "5d172e8315444dbc32867d1c7b04d8e7e68ec4e1" }, "neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" }, "neotest-dotnet": { "branch": "main", "commit": "5a2fa35c3c6a72cfd3fc6a28b3d1af6e68e6c3a8" }, "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, - "neotest-playwright": { "branch": "master", "commit": "6266945039dac27a354de33d2f2a66e75485d5e9" }, + "neotest-playwright": { "branch": "stevanfreeborn/fix/local-mods", "commit": "3751dc88d39cf135eb569d47f5ef036bc1f1930d" }, "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, "neotest-vitest": { "branch": "main", "commit": "3e338b77700853f725856c37ff5a3cf9295bffae" }, "none-ls.nvim": { "branch": "main", "commit": "ed8f80849ef1ad31c2f74679fafdef7801091247" }, "nuget.nvim": { "branch": "main", "commit": "ce137d6503e96657d133b48946f8739c8600834b" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" }, - "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, - "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, - "nvim-dap-ui": { "branch": "master", "commit": "0d5c37a43bc039c42a0a9bf801e53f77adf06a24" }, - "nvim-lspconfig": { "branch": "master", "commit": "d1871c84b218931cc758dbbde1fec8e90c6d465c" }, + "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, + "nvim-dap": { "branch": "master", "commit": "1c96e487dd4180edc5a3c075ea1f03b6b751ef4f" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, + "nvim-lspconfig": { "branch": "master", "commit": "b4d65bce97795438ab6e1974b3672c17a4865e3c" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-treesitter": { "branch": "master", "commit": "07bd1b53bf465e42d53253b48b7437892d6c45e8" }, + "nvim-treesitter": { "branch": "master", "commit": "51562d44fc6280f92bb9a3d87e7b3cb327377ca5" }, "nvim-treesitter-context": { "branch": "master", "commit": "bece284c5322ddf6946fa4bdc383a2bc033269d7" }, "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "ec1a2431f8872f650a85ed71c24f0715df2e49c2" }, @@ -39,5 +39,7 @@ "telescope-themes": { "branch": "main", "commit": "9b7c368b83b82b53c0a6e9e977f8329e5f1fe269" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" } + "typr": { "branch": "main", "commit": "8904dc09ed4e4a4397fc3a4f2884f11e85d27c5d" }, + "volt": { "branch": "main", "commit": "1a7d6b1dfb2f176715ccc9e838be32d044f8a734" }, + "which-key.nvim": { "branch": "main", "commit": "6cebd86917df559a88de0f806b2989799c6e6423" } } diff --git a/lua/plugins/debugging.lua b/lua/plugins/debugging.lua index 0cc2032..df7ca24 100644 --- a/lua/plugins/debugging.lua +++ b/lua/plugins/debugging.lua @@ -8,7 +8,87 @@ return { local dap = require("dap") local dapui = require("dapui") - dapui.setup() + dapui.setup({ + controls = { + element = "repl", + enabled = true, + icons = { + disconnect = "", + pause = "", + play = "", + run_last = "", + step_back = "", + step_into = "", + step_out = "", + step_over = "", + terminate = "", + }, + }, + element_mappings = {}, + expand_lines = true, + floating = { + border = "rounded", + mappings = { + close = { "q", "" }, + }, + }, + force_buffers = true, + icons = { + collapsed = "", + current_frame = "", + expanded = "", + }, + layouts = { + { + elements = { + { + id = "scopes", + size = 0.25, + }, + { + id = "breakpoints", + size = 0.25, + }, + { + id = "stacks", + size = 0.25, + }, + { + id = "watches", + size = 0.25, + }, + }, + position = "right", + size = 50, + }, + { + elements = { + { + id = "repl", + size = 0.5, + }, + { + id = "console", + size = 0.5, + }, + }, + position = "bottom", + size = 10, + }, + }, + mappings = { + edit = "e", + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + repl = "r", + toggle = "t", + }, + render = { + indent = 1, + max_value_lines = 100, + }, + }) dap.adapters["pwa-node"] = { type = "server", @@ -55,13 +135,64 @@ return { args = { "--interpreter=vscode" }, } + local 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 + + local dotnet_get_dll_path = function() + local request = function() + return vim.fn.input("Path to dll to debug: ", 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( + "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() - return vim.fn.input("Path to dll: ", vim.fn.getcwd(), "file") + if vim.fn.confirm("Rebuild first?", "&yes\n&no", 2) == 1 then + dotnet_build_project() + end + + return dotnet_get_dll_path() end, }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index b7258f4..00774e8 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -47,6 +47,7 @@ return { OrganizeImports = true, }, RoslynExtensionsOptions = { + DocumentAnalysisTimeoutMs = 30000, EnableAnalyzersSupport = true, EnableImportCompletion = true, }, diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index fc5bb11..a1abd29 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -1,54 +1,66 @@ return { - "nvim-neotest/neotest", - dependencies = { - "antoinemadec/FixCursorHold.nvim", - "nvim-neotest/neotest-python", - "nvim-neotest/neotest-jest", - "marilari88/neotest-vitest", - "thenbe/neotest-playwright", - "issafalcon/neotest-dotnet", - }, - config = function() - local neotest = require("neotest") + "nvim-neotest/neotest", + dependencies = { + "antoinemadec/FixCursorHold.nvim", + "nvim-neotest/neotest-python", + "nvim-neotest/neotest-jest", + "marilari88/neotest-vitest", + "thenbe/neotest-playwright", + "issafalcon/neotest-dotnet", + }, + config = function() + local neotest = require("neotest") - neotest.setup({ - log_level = "debug", - adapters = { - require("neotest-python"), - require("neotest-jest"), - require("neotest-vitest"), - require("neotest-playwright").adapter({ - options = { - persist_project_selection = true, - enable_dynamic_test_discovery = true, - preset = "headed", - experimental = { - telescope = { - enable = true, - }, - }, - }, - }), - require("neotest-dotnet")({ - discovery_root = "solution", - }), - }, - }) + neotest.setup({ + log_level = "debug", + adapters = { + require("neotest-python"), + require("neotest-jest"), + require("neotest-vitest"), + require("neotest-playwright").adapter({ + options = { + log_level = "DEBUG", + persist_project_selection = false, + enable_dynamic_test_discovery = true, + preset = "headed", + experimental = { + telescope = { + enable = true, + }, + }, + get_playwright_binary = function() + return vim.loop.cwd() .. "/node_modules/.bin/playwright" + end, + }, + }), + require("neotest-dotnet")({ + dap = { + adapter_name = "coreclr", + }, + discovery_root = "solution", + }), + }, + }) - vim.keymap.set("n", "tr", neotest.run.run, { desc = "Run nearest test" }) - vim.keymap.set("n", "ts", neotest.run.stop, { desc = "Stop nearest test" }) + vim.keymap.set("n", "tr", neotest.run.run, { desc = "Run nearest test" }) - vim.keymap.set("n", "tf", function() - neotest.run.run(vim.fn.expand("%")) - end, { desc = "Run file tests" }) + vim.keymap.set("n", "td", function() + neotest.run.run({ strategy = "dap" }) + end, { desc = "Debug nearest test" }) - vim.keymap.set("n", "to", neotest.output.open, { desc = "Display output" }) + vim.keymap.set("n", "ts", neotest.run.stop, { desc = "Stop nearest test" }) + + vim.keymap.set("n", "tf", function() + neotest.run.run(vim.fn.expand("%")) + end, { desc = "Run file tests" }) + + vim.keymap.set("n", "to", neotest.output.open, { desc = "Display output" }) vim.keymap.set("n", "top", neotest.output_panel.open, { desc = "Display output panel" }) vim.keymap.set("n", "topc", neotest.output_panel.clear, { desc = "Clear output" }) - vim.keymap.set("n", "", neotest.summary.open, { desc = "Display summary" }) + vim.keymap.set("n", "", neotest.summary.open, { desc = "Display summary" }) vim.keymap.set("n", "tsr", neotest.summary.run_marked, { desc = "Run marked tests" }) vim.keymap.set("n", "tsc", neotest.summary.clear_marked, { desc = "Clear marked tests" }) vim.keymap.set("n", "tw", neotest.watch.watch, { desc = "Start watching tests" }) vim.keymap.set("n", "twc", neotest.watch.stop, { desc = "Stop watching tests" }) - end, + end, } diff --git a/lua/plugins/typr.lua b/lua/plugins/typr.lua new file mode 100644 index 0000000..18e0f7a --- /dev/null +++ b/lua/plugins/typr.lua @@ -0,0 +1,6 @@ +return { + "nvzone/typr", + dependencies = "nvzone/volt", + opts = {}, + cmd = { "Typr", "TyprStats" }, +} diff --git a/lua/vim-options.lua b/lua/vim-options.lua index 9ed20d1..d6accbc 100644 --- a/lua/vim-options.lua +++ b/lua/vim-options.lua @@ -18,6 +18,12 @@ vim.keymap.set("v", "y", '"+y', { desc = "Yank to system clipboard" }) vim.keymap.set("n", "ww", ":set wrap!", { desc = "Toggle word wrap" }) +vim.filetype.add({ + extension = { + props = "xml", + } +}) + -- if i am in insert mode and i spam one of these keys -- i probably want to escape insert mode vim.keymap.set("i", "jj", "", { desc = "Escape" })