fix(neotest): properly detect __call. Fixes #847

This commit is contained in:
Folke Lemaitre 2023-05-28 12:52:22 +02:00
parent b68311eb6d
commit 0e671ad7fa
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -57,9 +57,10 @@ return {
elseif config ~= false then
local adapter = require(name)
if type(config) == "table" and not vim.tbl_isempty(config) then
local meta = getmetatable(adapter)
if adapter.setup then
adapter.setup(config)
elseif adapter.__call then
elseif meta and meta.__call then
adapter(config)
else
error("Adapter " .. name .. " does not support setup")