feat: Add visual debugging aids for Tasks developers #1695
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add two hidden settings to help developers understand what is going on behind the scenes in the plugin's code.
Note that if sorting is disabled manually in the settings, the
explain
instruction does report this.From the additions to the CONTRIBUTING file:
How do I enable hidden debugging/visualisation facilities?
There are some hidden Tasks settings options to turn on some hidden facilities to aid visualising the behaviour of the plugin.
The default values are:
The
data.json
file needs to be edited manually to turn these on: The options are not exposed in the settings UI.This is what these options do:
ignoreSortInstructions
:showTaskHiddenData
:task.sectionStart
task.sectionIndex
task.precedingHeader
task.path
task.originalMarkdown
🐛 4 . 6 . 'Steps to world domination' . 'ACME.md'
'
- [ ] #task Feed the baby 🔽 📅 2021-11-21
'Motivation and Context
I have been spending many hours understanding how the
task.sectionStart
andtask.sectionIndex
values change under a myriad of different scenarios, and it has been tremendously helpful to see the values displayed directly in Obsidian, rather than having to read through reams of console debug output.How has this been tested?
In the test vault, in Obsidian.
Screenshots (if appropriate)
The following screenshot gives a wealth of information about the behaviour of the plugin:
1
: I had believed that thetask.sectionStart
was the 0-based line number of the previous heading, but this shows that it is the 0-based line number at the start of the list containing the task2
: When toggling tasks rendered in Reading mode, we cannot rely ontask.precedingHeader
as it is not populated3
: When toggling embedded tasks in Reading mode, we also cannot rely on thetask.sectionStart
andtask.sectionIndex
values, as they are 0Types of changes
Changes visible to users:
feat
- non-breaking change which adds functionality)Internal changes:
test
- additions and improvements to unit tests and the smoke tests)Checklist
yarn run lint
.Terms