Skip to content

feat: add TQ_ignore_this_file frontmatter property#3786

Draft
beauraines wants to merge 12 commits intoobsidian-tasks-group:mainfrom
beauraines:feat/tq-ignore-this-file
Draft

feat: add TQ_ignore_this_file frontmatter property#3786
beauraines wants to merge 12 commits intoobsidian-tasks-group:mainfrom
beauraines:feat/tq-ignore-this-file

Conversation

@beauraines
Copy link

Types of changes

Internal changes:

  • Refactor (prefix: refactor - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
  • Tests (prefix: test - additions and improvements to unit tests and the smoke tests)
  • Infrastructure (prefix: chore - examples include GitHub Actions, issue templates)

Description

Adds a new frontmatter property TQ_ignore_this_file that makes Tasks completely ignore a file. When set to true, 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?

  • Unit tests for TasksFile.isIgnored() (true, false, missing, non-boolean values)
  • Unit test for FileParser returning no tasks when file is ignored
  • Manual testing files added to the sample vault for side-by-side comparison
  • Manual verification in Obsidian: tasks not indexed, autocomplete disabled, Live Preview checkboxes handled natively

Screenshots (if appropriate)

Checklist

  • My code changes are on a branch, and not on the main branch.
  • My code follows the code style of this project and passes yarn run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change has adequate Unit Test coverage.

Terms

beauraines and others added 12 commits February 26, 2026 08:41
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.
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>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2026

@claremacrae
Copy link
Collaborator

Hi @beauraines, just to note that TQ_ stands for Tasks Query. The TQ_ values all affect the behaviour of searches.

My intention was to use TP_ for controlling Tasks Parsing, to separate the concerns.

Copy link
Collaborator

@claremacrae claremacrae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@claremacrae
Copy link
Collaborator

I couldn't resist having a play with this, and I really like the behaviour!

Huge thanks for working on this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a per-note frontmatter property value to disable or enable Tasks plugin [was 'Exclude Folders']

2 participants