Skip to content

Commit

Permalink
Realised test adapters should really have separted adapter name and p…
Browse files Browse the repository at this point in the history
…kg name as some have special cases, e.g. rusteanvim
  • Loading branch information
atropos112 committed Nov 16, 2024
1 parent 353a708 commit 1b467c3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions lua/atro/config/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ return {
},
python = {
test_adapter = {
author = "nvim-neotest",
name = "neotest-python",
pkg_name = "nvim-neotest/neotest-python",
adapter_name = "neotest-python",
config = {
justMyCode = false,
},
Expand Down Expand Up @@ -70,8 +70,8 @@ return {
rust = {
dap_package = "codelldb",
test_adapter = {
author = "rouge8",
name = "neotest-rust",
pkg_name = "mrkjkb/rustaceanvim",
adapter_name = "rustaceanvim.neotest",
},
formatters = { "rustfmt" },
-- INFO: rustaceanvim plugin takes care of this
Expand Down Expand Up @@ -108,8 +108,8 @@ return {
},
go = {
test_adapter = {
author = "nvim-neotest",
name = "neotest-go",
pkg_name = "nvim-neotest/neotest-go",
adapter_name = "neotest-go",
},
formatters = { "gofmt", "goimports" },
dap_package = "dlv",
Expand Down Expand Up @@ -153,8 +153,8 @@ return {
},
c_sharp = {
test_adapter = {
author = "Issafalcon",
name = "neotest-dotnet",
pkg_name = "nvim-neotest/neotest-dotnet",
adapter_name = "neotest-dotnet",
},
formatters = { "csharpier" },
dap_package = "netcoredbg",
Expand Down
4 changes: 2 additions & 2 deletions lua/atro/config/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pcall(require, "dap")
---@field skip_install boolean | nil Skip installing the lsp even if it is not installed

---@class TestAdapter
---@field name string Name of the test adapter
---@field author string Author of the test adapter
---@field pkg_name string Name of the package to install as a dependency of neotest
---@field adapter_name string Name of the adapter to use, its what is added to require("neotest").adapters
---@field config table<string, any> | nil Configuration for the test adapter

---@enum LogLevel
Expand Down
2 changes: 1 addition & 1 deletion lua/atro/plugins/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ return {
-- Github Copilot
{
"zbirenbaum/copilot.lua",
event = "LspAttach",
event = "VeryLazy",
config = function()
require("copilot").setup({
suggestion = {
Expand Down
6 changes: 3 additions & 3 deletions lua/atro/plugins/testing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local neotest_deps = function()
}
for _, cfg in pairs(GCONF.languages) do
if cfg.test_adapter then
table.insert(deps, cfg.test_adapter.author .. "/" .. cfg.test_adapter.name)
table.insert(deps, cfg.test_adapter.pkg_name)
end
end
log:debug("Constructing neotest dependencies: " .. require("atro.utils").lst_to_str(deps))
Expand Down Expand Up @@ -86,8 +86,8 @@ return {
local adapters = {}
for lang, cfg in pairs(GCONF.languages) do
if cfg.test_adapter then
log:with({ language = lang }):debug("Including test adapter " .. cfg.test_adapter.author .. "/" .. cfg.test_adapter.name)
table.insert(adapters, require(cfg.test_adapter.name)(cfg.test_adapter.config or {}))
log:with({ language = lang }):debug("Including test adapter " .. cfg.test_adapter.adapter_name)
table.insert(adapters, require(cfg.test_adapter.adapter_name)(cfg.test_adapter.config or {}))
end
end

Expand Down

0 comments on commit 1b467c3

Please sign in to comment.