Skip to content

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

@claremacrae

Description

@claremacrae

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

  • I searched previous Ideas in Discussions didn't find any similar feature requests.
  • I searched previous Issues didn't find any similar feature requests.
  • I am only requesting a single feature. Multiple changes should be split into individual requests, with links between them.
  • 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

Metadata

Metadata

Assignees

Labels

scope: explainAbout the `explain` instruction which generates explanations of tasks query blockstype: enhancementNew feature or request

Type

No type

Projects

Status

🎉 Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions