obsidian-tasks icon indicating copy to clipboard operation
obsidian-tasks copied to clipboard

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

Open claremacrae opened this issue 1 year ago • 1 comments

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

  • [X] I searched previous Ideas in Discussions didn't find any similar feature requests.
  • [X] I searched previous Issues didn't find any similar feature requests.
  • [X] I am only requesting a single feature. Multiple changes should be split into individual requests, with links between them.
  • [X] I believe my requested feature will be generally applicable to other users, not just me: it is not uniquely tied to my personal workflow.

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

  • If all 3 are the sample, only show 1
  • If there were no placeholders, show 1 and 2

And so on...

❓ Alternatives

No response

📝 Additional Context

No response

claremacrae avatar Oct 19 '23 16:10 claremacrae

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.

claremacrae avatar Mar 16 '24 22:03 claremacrae