silverbullet
silverbullet copied to clipboard
Query both top level tasks and subtasks using Live Query
Taking the following list of tasks:
- [ ] hello
- [ ] this is a task
- [ ] this is another task
- [ ] with a subtask
- [ ] complete this before test
- [ ] test of a sub sub task
Right now, you can query all tasks that have at least a sub task with:
#query task where nested != empty select name nested
If you try to just query the tasks with no sub tasks by doing:
#query task where nested = empty select name nested
You can see that sub tasks are also marked as top level tasks.
Also, two current bugs:
- for top level tasks that have sub tasks, Live Query return the sub tasks as part of the
nameand also thenestedproperty. - any task that has a sub task, breaks the default render strategy for Live Query, as shown here:
A few things:
- What version of SilverBullet are you running, because the
nestedattribute was removed quite a while ago - Potentially related to the previous one, but please switch to Live Queries (your examples are directives): https://silverbullet.md/Live%20Queries
- Your example queries contain a lot of invalid syntax, for instance
page = /testing-nested/should really use the=~operator:page =~ /testing-nested/, a select clause takes names with commas, e.g.select name, nested, and yourorder byalso shouldn't work, but should probably beorder by name, alsoemptyis not a valid value, but should probably benull
Generally I do see the need for nested querying of tasks (as well as items, probably) so I'll think on how to do that
-
oh, will update the syntax to Live Queries then. Using
/querybrings up the directives still, so I thought they were renamed. Will update the syntax as well, the comma in the select didn't work, it caused issues that's why I removed it. -
I'm using the latest version. I know it's bad to do it but have it running in docker using the
latesttag, and updated it today. The nested attribute is still available in directives, will let you know when switching to Live Query
EDIT
Just updated the Directives to Live Queries, and nested attribute is not available, but can still use it in the Directives counterpart of the queries.
Had to restart properly silverbullet for the /query command to use Live Queries instead of Directives.
Thanks for the help.
Maybe adding a metadata like task-level and updating it whenever it's indented can do the trick? Don't know enough ts to help with this one 😞
+1 for this feature -- maybe have the task objects point to a parent task if it is a subtask? and possibly indicate if all subtasks are marked off or not? I'd find this very useful.