From 74e91b5488c90c460bf134793e9ca4fefc633d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Sun, 24 Dec 2023 16:40:09 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(nvim):=20add=20ne?= =?UTF-8?q?otest-adapters=20to=20their=20lang=20extras?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/nvim/lazyvim.json | 2 ++ .config/nvim/lua/plugins/extras/lang/bash.lua | 12 ++++++++ .../nvim/lua/plugins/extras/lang/haskell.lua | 22 +++++--------- .../extras/lang/omnisharp-extended.lua | 15 ++++++++++ .../nvim/lua/plugins/extras/lang/web/php.lua | 12 ++++++++ .../extras/lang/web/typescript-extended.lua | 29 +++++++++++++++++++ .../lua/plugins/extras/test/jest-test.lua | 19 ------------ .../lua/plugins/extras/test/mocha-test.lua | 18 ------------ .../lua/plugins/extras/test/python-test.lua | 9 ------ .../lua/plugins/extras/test/rust-test.lua | 9 ------ .../lua/plugins/extras/test/vitest-test.lua | 9 ------ 11 files changed, 78 insertions(+), 78 deletions(-) create mode 100644 .config/nvim/lua/plugins/extras/lang/omnisharp-extended.lua delete mode 100644 .config/nvim/lua/plugins/extras/test/jest-test.lua delete mode 100644 .config/nvim/lua/plugins/extras/test/mocha-test.lua delete mode 100644 .config/nvim/lua/plugins/extras/test/python-test.lua delete mode 100644 .config/nvim/lua/plugins/extras/test/rust-test.lua delete mode 100644 .config/nvim/lua/plugins/extras/test/vitest-test.lua diff --git a/.config/nvim/lazyvim.json b/.config/nvim/lazyvim.json index ae044107..45d6d9a6 100644 --- a/.config/nvim/lazyvim.json +++ b/.config/nvim/lazyvim.json @@ -43,6 +43,7 @@ "plugins.extras.lang.git", "plugins.extras.lang.markdown-extended", "plugins.extras.lang.python-extended", + "plugins.extras.lang.rust-extended", "plugins.extras.lang.web.css", "plugins.extras.lang.web.html", "plugins.extras.lang.web.typescript-extended", @@ -50,6 +51,7 @@ "plugins.extras.linting.shellcheck", "plugins.extras.lsp.actions-preview", "plugins.extras.lsp.compiler", + "plugins.extras.lsp.file-operations", "plugins.extras.lsp.garbage-day", "plugins.extras.lsp.glance", "plugins.extras.lsp.inc-rename", diff --git a/.config/nvim/lua/plugins/extras/lang/bash.lua b/.config/nvim/lua/plugins/extras/lang/bash.lua index b8bb34e3..0dc99217 100644 --- a/.config/nvim/lua/plugins/extras/lang/bash.lua +++ b/.config/nvim/lua/plugins/extras/lang/bash.lua @@ -22,6 +22,18 @@ return { vim.list_extend(opts.ensure_installed, { "bash-language-server" }) end, }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "rcasia/neotest-bash", + }, + opts = { + adapters = { + ["neotest-haskell"] = {}, + }, + }, + }, { "luckasRanarison/nvim-devdocs", optional = true, diff --git a/.config/nvim/lua/plugins/extras/lang/haskell.lua b/.config/nvim/lua/plugins/extras/lang/haskell.lua index 73f52b06..3b21c6a1 100644 --- a/.config/nvim/lua/plugins/extras/lang/haskell.lua +++ b/.config/nvim/lua/plugins/extras/lang/haskell.lua @@ -15,10 +15,9 @@ return { { "nvim-telescope/telescope.nvim", optional = true }, }, config = function() - local ok, telescope = pcall(require, "telescope") - if ok then - telescope.load_extension("ht") - end + require("lazyvim.util").on_load("telescope.nvim", function() + require("telescope").load_extension("ht") + end) end, }, { @@ -44,9 +43,7 @@ return { { "nvim-neotest/neotest", optional = true, - dependencies = { - { "mrcjkb/neotest-haskell" }, - }, + dependencies = { "mrcjkb/neotest-haskell" }, opts = { adapters = { ["neotest-haskell"] = {}, @@ -64,14 +61,11 @@ return { { "luc-tielen/telescope_hoogle", ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, - dependencies = { - { "nvim-telescope/telescope.nvim" }, - }, + dependencies = { "nvim-telescope/telescope.nvim" }, config = function() - local ok, telescope = pcall(require, "telescope") - if ok then - telescope.load_extension("hoogle") - end + require("lazyvim.util").on_load("telescope.nvim", function() + require("telescope").load_extension("hoogle") + end) end, }, -- Make sure lspconfig doesn't start hls, diff --git a/.config/nvim/lua/plugins/extras/lang/omnisharp-extended.lua b/.config/nvim/lua/plugins/extras/lang/omnisharp-extended.lua new file mode 100644 index 00000000..5fa8399d --- /dev/null +++ b/.config/nvim/lua/plugins/extras/lang/omnisharp-extended.lua @@ -0,0 +1,15 @@ +return { + { import = "lazyvim.plugins.extras.lang.omnisharp" }, + { + "nvim-neotest/neotest", + optiona = true, + dependencies = { + "Issafalcon/neotest-dotnet", + }, + opts = { + adapters = { + ["neotest-dotnet"] = {}, + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/extras/lang/web/php.lua b/.config/nvim/lua/plugins/extras/lang/web/php.lua index 4f8c7133..84593983 100644 --- a/.config/nvim/lua/plugins/extras/lang/web/php.lua +++ b/.config/nvim/lua/plugins/extras/lang/web/php.lua @@ -44,6 +44,18 @@ return { } end, }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "olimorris/neotest-phpunit", + }, + opts = { + adapters = { + ["neotest-phpunit"] = {}, + }, + }, + }, { "luckasRanarison/nvim-devdocs", optional = true, diff --git a/.config/nvim/lua/plugins/extras/lang/web/typescript-extended.lua b/.config/nvim/lua/plugins/extras/lang/web/typescript-extended.lua index c0c2f11a..2a4dc279 100644 --- a/.config/nvim/lua/plugins/extras/lang/web/typescript-extended.lua +++ b/.config/nvim/lua/plugins/extras/lang/web/typescript-extended.lua @@ -74,6 +74,35 @@ return { code_lens = "all", }, }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "nvim-neotest/neotest-jest", + "adrigzr/neotest-mocha", + "marilari88/neotest-vitest", + }, + opts = { + adapters = { + ["neotest-jest"] = { + jestCommand = "npm test --", + jestConfigFile = "custom.jest.config.ts", + env = { CI = true }, + cwd = function() + return vim.fn.getcwd() + end, + }, + ["neotest-mocha"] = { + command = "npm test --", + env = { CI = true }, + cwd = function(path) + return vim.fn.getcwd() + end, + }, + ["neotest-vitest"] = {}, + }, + }, + }, { "luckasRanarison/nvim-devdocs", optional = true, diff --git a/.config/nvim/lua/plugins/extras/test/jest-test.lua b/.config/nvim/lua/plugins/extras/test/jest-test.lua deleted file mode 100644 index 26b9401b..00000000 --- a/.config/nvim/lua/plugins/extras/test/jest-test.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "nvim-neotest/neotest", - dependencies = { - "haydenmeade/neotest-jest", - }, - opts = function(_, opts) - table.insert( - opts.adapters, - require("neotest-jest")({ - jestCommand = "npm test --", - jestConfigFile = "custom.jest.config.ts", - env = { CI = true }, - cwd = function() - return vim.fn.getcwd() - end, - }) - ) - end, -} diff --git a/.config/nvim/lua/plugins/extras/test/mocha-test.lua b/.config/nvim/lua/plugins/extras/test/mocha-test.lua deleted file mode 100644 index 974fda55..00000000 --- a/.config/nvim/lua/plugins/extras/test/mocha-test.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "nvim-neotest/neotest", - dependencies = { - "adrigzr/neotest-mocha", - }, - opts = function(_, opts) - table.insert( - opts.adapters, - require("neotest-mocha")({ - command = "npm test --", - env = { CI = true }, - cwd = function(path) - return vim.fn.getcwd() - end, - }) - ) - end, -} diff --git a/.config/nvim/lua/plugins/extras/test/python-test.lua b/.config/nvim/lua/plugins/extras/test/python-test.lua deleted file mode 100644 index 78fd7d74..00000000 --- a/.config/nvim/lua/plugins/extras/test/python-test.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "nvim-neotest/neotest", - dependencies = { - "nvim-neotest/neotest-python", - }, - opts = function(_, opts) - table.insert(opts.adapters, require("neotest-python")) - end, -} diff --git a/.config/nvim/lua/plugins/extras/test/rust-test.lua b/.config/nvim/lua/plugins/extras/test/rust-test.lua deleted file mode 100644 index 9bd059ee..00000000 --- a/.config/nvim/lua/plugins/extras/test/rust-test.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "nvim-neotest/neotest", - dependencies = { - "rouge8/neotest-rust", - }, - opts = function(_, opts) - table.insert(opts.adapters, require("neotest-rust")) - end, -} diff --git a/.config/nvim/lua/plugins/extras/test/vitest-test.lua b/.config/nvim/lua/plugins/extras/test/vitest-test.lua deleted file mode 100644 index 2c2a706c..00000000 --- a/.config/nvim/lua/plugins/extras/test/vitest-test.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "nvim-neotest/neotest", - dependencies = { - "marilari88/neotest-vitest", - }, - opts = function(_, opts) - table.insert(opts.adapters, require("neotest-vitest")) - end, -}