diff --git a/lazy-lock.json b/lazy-lock.json index 34722d7..e0336c8 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, - "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, @@ -36,17 +35,16 @@ "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "a3d69bd63fc98f640815f94b797bf978e9193022" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, - "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, - "noice.nvim": { "branch": "main", "commit": "2626b4a49340e4eae24a388468ac98680fc24532" }, + "noice.nvim": { "branch": "main", "commit": "203f74adaae11d47440a667555b4af9156be807b" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "f134063618a65cad4d7415fddbd96ff7e0c5b4ae" }, - "nvim-dap": { "branch": "master", "commit": "29d1f8814fa4fcc194ec574de998a42a22ebbe4a" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "22a3b4c70641802587a6a0994894225e7815398b" }, + "nvim-dap": { "branch": "master", "commit": "cc92b054720a96170eca6bd9bdedd43d2b0a7a8a" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-jdtls": { "branch": "master", "commit": "c4279b8ffce9b64eb302056d78dfebc2968a49bc" }, - "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, + "nvim-lint": { "branch": "master", "commit": "8e9562de7261e5b862c631958df616e1a65552cd" }, "nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, @@ -59,9 +57,10 @@ "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "e87554285f581047b1bf236794b0eb812b444b87" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "project.nvim": { "branch": "main", "commit": "9cc719f455295e7a2fc7340d4fd87327f3fe15ca" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, - "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, + "smart-splits.nvim": { "branch": "master", "commit": "5910b386aca2ea7adb63812ba43815b1d97b37ad" }, "symbols-outline.nvim": { "branch": "master", "commit": "964c5902243446124417a3a9e9454f5ef032cc36" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index aaba41c..05ae309 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -40,29 +40,41 @@ M = { "nvim-lua/plenary.nvim", "antoinemadec/FixCursorHold.nvim", "nvim-treesitter/nvim-treesitter", - "andy-bell101/neotest-java", + "rcasia/neotest-java", }, - -- enabled = vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" or false, - config = function() - require("auto-jdtls.create_maven_project") - require("neotest").setup({ + opts = function() + return { adapters = { require("neotest-java"), }, - }) + } end, - -- stylua: ignore - keys = { - { "T","",desc="  Test"}, - { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, - { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, - { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, - { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, - { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, - { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, - { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, - { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, - }, + enabled = vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" or false, + config = function(_, opts) + -- get neotest namespace (api call creates or returns namespace) + local neotest_ns = vim.api.nvim_create_namespace("neotest") + vim.diagnostic.config({ + virtual_text = { + format = function(diagnostic) + local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "") + return message + end, + }, + }, neotest_ns) + require("neotest").setup(opts) + end, + -- stylua: ignore + keys = { + { "T","",desc="  Test"}, + { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, + { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, + { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, + { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, + { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, + { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, + { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, + { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, + }, }, { "rockerBOO/symbols-outline.nvim", @@ -106,6 +118,37 @@ M = { { "Js", "SymbolsOutline", desc = "Toggle Outline" }, }, }, + -- project.nvim [project search + auto cd] + -- https://github.com/ahmedkhalf/project.nvim + { + "zeioth/project.nvim", + cmd = "ProjectRoot", + ft = { "java" }, + opts = { + -- How to find root directory + patterns = { + "build.gradle", + "pom.xml", + }, + -- Don't list the next projects + exclude_dirs = { + "~/", + }, + silent_chdir = true, + manual_mode = false, + + -- Don't chdir for certain buffers + exclude_chdir = { + filetype = { "", "OverseerList", "alpha" }, + buftype = { "nofile", "terminal" }, + }, + + --ignore_lsp = { "lua_ls" }, + }, + config = function(_, opts) + require("project_nvim").setup(opts) + end, + }, } return M