From 113d8e1f3df677811ee89d7bb3252206b16db0e9 Mon Sep 17 00:00:00 2001 From: Donovan Date: Mon, 12 May 2025 09:20:32 -0500 Subject: [PATCH] update neotest and treesitter --- lazy-lock.json | 33 ++++---- lua/dkelly/plugins/neotest.lua | 60 +++++++++----- lua/dkelly/plugins/treesitter.lua | 128 ++++++++++++++++++++---------- 3 files changed, 143 insertions(+), 78 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 8ebce68..cba2f01 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,8 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "CopilotChat.nvim": { "branch": "main", "commit": "75653259442a8eb895abfc70d7064e07aeb7134c" }, - "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "CopilotChat.nvim": { "branch": "main", "commit": "4dce4d2fc185a935024511811139b68e91b2d2a8" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, @@ -9,20 +10,21 @@ "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" }, - "copilot.lua": { "branch": "master", "commit": "a5c390f8d8e85b501b22dcb2f30e0cbbd69d5ff0" }, + "conform.nvim": { "branch": "master", "commit": "374aaf384e2e841607b8e2fe63fa3ad01d111c91" }, + "copilot.lua": { "branch": "master", "commit": "2fe34db04570f6c47db0b752ca421a49b7357c03" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "1796c7cedfe7e5dd20096c5d7b8b753d8f8d22eb" }, + "gitsigns.nvim": { "branch": "main", "commit": "43b0c856ae5f32a195d83f4a27fe21d63e6c966c" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" }, "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" }, - "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, - "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, - "neotest": { "branch": "master", "commit": "6267dcd577aa519c828d2526b05844770d3a2c6a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "62f821a14e20f3f2ee358cd44d0b3d299a508e72" }, + "mason.nvim": { "branch": "main", "commit": "7c7318e8bae7e3536ef6b9e86b9e38e74f2e125e" }, + "neotest": { "branch": "master", "commit": "2d9011396c43fa1d40221e6b6c3be5eb001427a9" }, "neotest-go": { "branch": "main", "commit": "92950ad7be2ca02a41abca5c6600ff6ffaf5b5d6" }, + "neotest-golang": { "branch": "main", "commit": "5d1fdb068914ac23593495e71ecf9b1fad309b45" }, "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, @@ -32,17 +34,16 @@ "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" }, - "nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" }, - "nvim-lspconfig": { "branch": "master", "commit": "46434074f188e6bfccf9d9153dd8be6b1381498b" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-tree.lua": { "branch": "master", "commit": "582ae48c9e43d2bcd55dfcc8e2e7a1f29065d924" }, - "nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" }, + "nvim-tree.lua": { "branch": "master", "commit": "e7d1b7dadc62fe2eccc17d814354b0a5688621ce" }, + "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, + "nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" }, + "nvim-web-devicons": { "branch": "master", "commit": "f1420728f59843eb2ef084406b3d0201a0a0932d" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, - "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, diff --git a/lua/dkelly/plugins/neotest.lua b/lua/dkelly/plugins/neotest.lua index 728a95a..64cb667 100644 --- a/lua/dkelly/plugins/neotest.lua +++ b/lua/dkelly/plugins/neotest.lua @@ -3,10 +3,14 @@ return { { "nvim-neotest/neotest", dependencies = { + "nvim-neotest/nvim-nio", "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", "nvim-treesitter/nvim-treesitter", "nvim-neotest/neotest-go", "nvim-neotest/neotest-python", + "fredrikaverpil/neotest-golang", + "leoluz/nvim-dap-go", }, config = function() require("neotest").setup({ @@ -14,29 +18,45 @@ return { require("neotest-python")({ dap = { justMyCode = false }, }), - require("neotest-go")({}), - }, - icons = { - running = "", - passed = "", - failed = "", - skipped = "", - }, - output = { - enabled = true, - open_on_run = true, - open = "botright split | resize 15", + require("neotest-golang")({ + dap = { justMyCode = false }, + }), }, }) - local map = vim.keymap.set - map("n", "tr", require("neotest").run.run, { desc = "Run nearest test" }) - map("n", "tF", function() - require("neotest").run.run(vim.fn.expand("%")) - end, { desc = "Run tests in file" }) - map("n", "ts", require("neotest").run.stop, { desc = "Stop test" }) - map("n", "to", require("neotest").output_panel.toggle, { desc = "Toggle test output" }) - map("n", "tS", require("neotest").summary.toggle, { desc = "Toggle test summary" }) + vim.keymap.set("n", "tr", function() + require("neotest").run.run({ + suite = false, + testify = true, + }) + end, { desc = "Debug: Running Nearest Test" }) + + vim.keymap.set("n", "tv", function() + require("neotest").summary.toggle() + end, { desc = "Debug: Summary Toggle" }) + + vim.keymap.set("n", "ts", function() + require("neotest").run.run({ + suite = true, + testify = true, + }) + end, { desc = "Debug: Running Test Suite" }) + + vim.keymap.set("n", "td", function() + require("neotest").run.run({ + suite = false, + testify = true, + strategy = "dap", + }) + end, { desc = "Debug: Debug Nearest Test" }) + + vim.keymap.set("n", "to", function() + require("neotest").output.open() + end, { desc = "Debug: Open test output" }) + + vim.keymap.set("n", "ta", function() + require("neotest").run.run(vim.fn.getcwd()) + end, { desc = "Debug: Open test output" }) end, }, } diff --git a/lua/dkelly/plugins/treesitter.lua b/lua/dkelly/plugins/treesitter.lua index 28f7292..d05dab2 100644 --- a/lua/dkelly/plugins/treesitter.lua +++ b/lua/dkelly/plugins/treesitter.lua @@ -1,44 +1,88 @@ return { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPre", "BufNewFile" }, - build = ":TSUpdate", - dependencies = { - "windwp/nvim-ts-autotag", - }, - config = function() - local treesitter = require("nvim-treesitter.configs") - treesitter.setup({ - highlight = { enable = true }, - indent = { enable = true }, - autotag = { enable = true }, - ensure_installed = { - -- Main programming languages - "bash", "c", "cpp", "css", "go", "html", "javascript", "json", "lua", - "make", "markdown", "markdown_inline", "python", "regex", "ruby", - "rust", "toml", "tsx", "typescript", "vim", - -- Popular config and data formats - "dockerfile", "git_config", "gitignore", "gitattributes", - "graphql", "ini", "sql", "xml", "csv", "mermaid", - -- Infra/DevOps/Cloud - "terraform", "hcl", - -- Scripting/misc - "perl", "r", "powershell", "fish", - -- System - "cmake", "nix", - -- Other Neovim-related - "vimdoc", - "yaml", - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - }) - end, + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "nvim-treesitter/nvim-treesitter-refactor", + "windwp/nvim-ts-autotag", + }, + config = function() + local treesitter = require("nvim-treesitter.configs") + treesitter.setup({ + highlight = { enable = true }, + indent = { enable = true }, + autotag = { enable = true }, + refactor = { + highlight_definitions = { + enable = true, + clear_on_cursor_move = true, -- Optional: clearer behavior + }, + navigation = { + enable = true, + keymaps = { + goto_next_usage = "]r", + goto_previous_usage = "[r", + }, + }, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + ensure_installed = { + -- Main programming languages + "bash", + "c", + "cpp", + "css", + "go", + "dart", + "html", + "javascript", + "json", + "lua", + "make", + "markdown", + "markdown_inline", + "python", + "regex", + "ruby", + "rust", + "toml", + "tsx", + "typescript", + "vim", + -- Popular config and data formats + "dockerfile", + "git_config", + "gitignore", + "gitattributes", + "graphql", + "ini", + "sql", + "xml", + "csv", + "mermaid", + -- Infra/DevOps/Cloud + "terraform", + "hcl", + -- Scripting/misc + "perl", + "r", + "powershell", + "fish", + -- System + "cmake", + "nix", + -- Other Neovim-related + "vimdoc", + "yaml", + }, + }) + end, } -