silverbullet icon indicating copy to clipboard operation
silverbullet copied to clipboard

Query both top level tasks and subtasks using Live Query

Open OIDAM98 opened this issue 1 year ago • 3 comments

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 Screenshot 2023-11-29 at 3 03 25 p m

If you try to just query the tasks with no sub tasks by doing: #query task where nested = empty select name nested Screenshot 2023-11-29 at 3 04 26 p m 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 name and also the nested property.
  • any task that has a sub task, breaks the default render strategy for Live Query, as shown here: Screenshot 2023-11-29 at 3 07 55 p m

OIDAM98 avatar Nov 29 '23 21:11 OIDAM98

A few things:

  • What version of SilverBullet are you running, because the nested attribute 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 your order by also shouldn't work, but should probably be order by name, also empty is not a valid value, but should probably be null

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

zefhemel avatar Nov 30 '23 08:11 zefhemel

  • oh, will update the syntax to Live Queries then. Using /query brings 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 latest tag, 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 😞

OIDAM98 avatar Nov 30 '23 14:11 OIDAM98

+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.

devzero avatar Jan 24 '24 22:01 devzero