generated from mrcjkb/nvim-lua-nix-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): ability to filter plugin searches by handlers (#68)
- Loading branch information
Showing
4 changed files
with
87 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
vim.g.lz_n = { | ||
load = function() end, | ||
} | ||
local lz = require("lz.n") | ||
|
||
---@type lz.n.PluginSpec | ||
local cmd_testplugin = { | ||
"lookup_testplugin", | ||
cmd = "Telescope", | ||
} | ||
lz.load(cmd_testplugin) | ||
|
||
---@type lz.n.PluginSpec | ||
local colorscheme_testplugin = { | ||
"lookup_testplugin", | ||
colorscheme = "sweetie", | ||
} | ||
lz.load(colorscheme_testplugin) | ||
|
||
describe("lookup", function() | ||
it("can influence which handlers to search", function() | ||
local result = lz.lookup("lookup_testplugin", { filter = "cmd" }) | ||
assert.is_not_nil(result and result.cmd) | ||
result = lz.lookup("lookup_testplugin", { filter = "colorscheme" }) | ||
assert.is_not_nil(result and result.colorscheme) | ||
end) | ||
it("can influence the order in which handlers are searched", function() | ||
local result = lz.lookup("lookup_testplugin", { filter = { "cmd", "colorscheme" } }) | ||
assert.is_not_nil(result and result.cmd) | ||
result = lz.lookup("lookup_testplugin", { filter = { "colorscheme", "cmd" } }) | ||
assert.is_not_nil(result and result.colorscheme) | ||
end) | ||
end) |