feat: add TQ_ignore_this_file frontmatter property#3786
feat: add TQ_ignore_this_file frontmatter property#3786beauraines wants to merge 12 commits intoobsidian-tasks-group:mainfrom
Conversation
Add it.failing() tests for a new isIgnored() method on TasksFile that checks the TQ_ignore_this_file frontmatter property. Tests cover: - No frontmatter - Property not present - Property true/false - Case-insensitive lookup Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add isIgnored() method to TasksFile that checks the TQ_ignore_this_file frontmatter property. Returns true when the property is set to true, with case-insensitive lookup matching existing property conventions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add it.failing() test that verifies FileParser.parseFileContent() returns no tasks when TQ_ignore_this_file: true is set in the file's frontmatter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add early return in FileParser.parseFileContent() when the file has TQ_ignore_this_file: true in its frontmatter. Tasks from ignored files will not be indexed and won't appear in task query results. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Check TQ_ignore_this_file in EditorSuggestorPopup.onTrigger() and return null to suppress autocomplete suggestions in files marked as ignored. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Check TQ_ignore_this_file in LivePreviewExtension.handleClickEvent() using editorInfoField to access file metadata. When the file is ignored, return false without calling event.preventDefault(), allowing Obsidian's default checkbox toggle (plain check/uncheck) to handle the click. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add TQ_ignore_this_file to the queryProperties array in QueryFileDefaults so that Obsidian registers it as a checkbox type via metadataTypeManager. This gives users the proper toggle UI in the Properties view. The property uses a new Handler.None type since it doesn't generate query instructions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the MetaBind toggle widget for TQ_ignore_this_file so it appears in the documentation and test vault alongside other TQ_ properties. Update approval test files for the new widget. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
completes
3. Build the plugin and add it to the test vault: resources/sample_vaults/Tasks-Demo/
4. Open the test vault in Obsidian
5. Open each of these files, and run the 'Tasks: Add all Query File Defaults properties' command,
and set its value to be consistent with the existing properties:
- Test Data/query_file_defaults_all_options_false.md
- Test Data/query_file_defaults_all_options_null.md
- Test Data/query_file_defaults_all_options_true.md
6. Sort the properties in each file in alphabetical order
7. Run the 'Tasks: Add all Query File Defaults properties' command, to update query_file_defaults_all_options_*.json
8. Run the tests, to update all inline snapshots and approved files.
…dian-tasks into feat/tq-ignore-this-file
Add two test files to the Tasks-Demo vault: - Ignore This File Property.md: has TQ_ignore_this_file set to true, all tasks should be ignored by the plugin - Ignore This File Property - Normal File.md: control file without the property, tasks should behave normally Both include a warning to check that no Global Filter is set before testing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the new TQ_ignore_this_file frontmatter property in its own section, explaining its purpose and how it differs from query-level filtering and other TQ_ properties. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
Hi @beauraines, just to note that My intention was to use |
claremacrae
left a comment
There was a problem hiding this comment.
I know this is still a draft, so no hurry to fix these - but I noticed them when doing a quick look through the code...
There was a problem hiding this comment.
Please do not commit changes to the built plugin - they have high chances of causing conflicts with other branches, so I only update resources/sample_vaults/Tasks-Demo/.obsidian/plugins/obsidian-tasks-plugin/* with released versions of the plugin.
There was a problem hiding this comment.
And here too - Please do not commit changes to the built plugin - they have high chances of causing conflicts with other branches, so I only update resources/sample_vaults/Tasks-Demo/.obsidian/plugins/obsidian-tasks-plugin/* with released versions of the plugin.
|
I couldn't resist having a play with this, and I really like the behaviour! Huge thanks for working on this... |



Types of changes
feat- non-breaking change which adds functionality)feat!!orfix!!- fix or feature that would cause existing functionality to not work as expected)fix- non-breaking change which fixes an issue)i18n- additions or improvements to the translations - see Support a new language)docs- improvements to any documentation content for users)vault- improvements to the Tasks-Demo sample vault)contrib- any improvements to documentation content for contributors - see Contributing to Tasks)Internal changes:
refactor- non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)test- additions and improvements to unit tests and the smoke tests)chore- examples include GitHub Actions, issue templates)Description
Adds a new frontmatter property
TQ_ignore_this_filethat makes Tasks completely ignore a file. When set totrue, Tasks will not index any tasks in the file, the autocomplete popup will not activate, and checkbox clicks in Live Preview are handled natively by Obsidian.This gives users a simple, self-documenting way to opt out of Tasks processing on a per-file basis — useful for files with checklists, packing lists, templates, or other non-task checkboxes.
Closes #3642
Motivation and Context
Users have requested a way to disable Tasks processing for specific files without having to maintain a global filter or add query-level exclusions. A frontmatter property is the most natural location for this, as it lives in the file itself and is immediately visible to anyone reading it.
How has this been tested?
TasksFile.isIgnored()(true, false, missing, non-boolean values)FileParserreturning no tasks when file is ignoredScreenshots (if appropriate)
Checklist
mainbranch.yarn run lint.Terms