obsidian-tasks-group / obsidian-tasks

Task management for the Obsidian knowledge base.
https://publish.obsidian.md/tasks/
MIT License
2.41k stars 225 forks source link

Make 'explain' show the effect of Line Continuations and Placeholders #2349

Open claremacrae opened 11 months ago

claremacrae commented 11 months ago

⚠️ Please check that this feature request hasn't been suggested before.

🔖 Feature description

Explaining dates

Currently, explain gives really useful information to translate strings like today in queries into the date value that is actually used:

For example this:

starts after 2 years ago

is explained as:

Explanation of this Tasks code block query:

starts after 2 years ago =>
  start date is after 2020-10-21 (Wednesday 21st October 2020) OR no start date

(Not) Explaining line continuations

\ and \\ at the end of lines are not explained:

Example with \

For example this query:

(priority is highest) OR       \
    (priority is lowest)

... runs this search:

Explanation of this Tasks code block query:

(priority is highest) OR (priority is lowest) =>
  OR (At least one of):
    priority is highest
    priority is lowest

Example with \\

And this query:

description includes \\

... runs this search:

Explanation of this Tasks code block query:

description includes \

(Not) Explaining placeholders

Placeholders are not visible in explanations

For example this:

path includes {{query.file.path}}
root includes {{query.file.root}}
folder includes {{query.file.folder}}
filename includes {{query.file.filename}}

description includes Some Cryptic String {{! Inline comments are removed before search }}

is explained as:

Explanation of this Tasks code block query:

path includes some/sample/file path.md

root includes some/

folder includes some/sample/

filename includes file path.md

description includes Some Cryptic String

✔️ Solution

Adjust the parsing code that it has the ability to show:

  1. The original query line (or lines, if there is a line continuation characters)
  2. The line after merging line-continuations
  3. The line after applying placeholders

And then display the unique set of values...

And so on...

❓ Alternatives

No response

📝 Additional Context

No response

claremacrae commented 6 months ago

https://github.com/obsidian-tasks-group/obsidian-tasks/pull/2711 fixed this for filters.

Now the same is needed for group by function and sort by function.