bug: templates without condition field will always match, even if tags don't match
tobias-haenel opened this issue · comments
Neovim version (nvim -v)
0.9.4
Operating system/version
ArchLinux (Linux 6.6.8)
Describe the bug
Trying to run templates with a matching set of tags, will also display templates without condition fields, even if their tags don't overlap with the searched tags.
What is the severity of this bug?
tolerable (can work around it)
Steps To Reproduce
- register several task templates without a
condition
field and with different tags (e.g.tags = {"a"} / {"b"}
) with
require("overseer").register_template
- Run
require("overseer").run_template{tags={"a"}, first=false)
- Check the returned templates
Expected Behavior
A template should only be displayed for selection when its tags overlap with the searched tags.
Minimal example file
No response
Minimal init.lua
No response
Additional context
Proposed fix: remove line 62 to 64 in condition_matches
and default initialise condition
with an empty table or default initialise all template condition fields with an empty table
overseer.nvim/lua/overseer/template/init.lua
Lines 61 to 113 in 78e8933
Should be fixed!