feat: identify tasks by property key regardless of value#2139
Open
jcconnects wants to merge 1 commit into
Open
feat: identify tasks by property key regardless of value#2139jcconnects wants to merge 1 commit into
jcconnects wants to merge 1 commit into
Conversation
When identifying tasks by a frontmatter property, allow leaving the task property value empty to mean "match any value": a note is treated as a task whenever the configured property key is present with a non-empty value, regardless of what that value is (e.g. identify tasks by `status` alone). Previously property-based identification required both a property name and an exact value, so a field like `status` whose value changes over time could not be used as the sole task marker. An empty value now maps to an existence check, which also aligns the detection path with the generated Bases filters that already treat an empty value as "exists / not empty". A present-but-empty value (empty string, whitespace, null, or empty array) does not count as a task, matching the Bases filter semantics. Providing a value keeps the existing exact-match behavior unchanged. Update the task property value setting description across all locales and add unit tests covering the match-any, exact-match, and empty/absent cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2138
What
Allow identifying tasks by a frontmatter property key alone, regardless of its value. In property identification mode, leaving the Task property value field empty now means "match any value": a note is treated as a task whenever the configured property key is present with a non-empty value.
Previously, property-based identification required both a property name and an exact value (
frontmatter[name] === value), so a field likestatus— whose value changes over time (open,in-progress,done, …) — could not be used as the sole task marker.Why
Common workflows mark a note as actionable by the presence of a field such as
status, while the value carries state that changes over time. Requiring a fixed value forces a redundant second identifying field or enumerating every possible value (which isn't supported). See #2138 for the full use case.This also aligns the detection path with TaskNotes' own generated Bases filters, which already treat an empty value as an "exists / not empty" condition (
note["<prop>"] && note["<prop>"] != "" && note["<prop>"] != null) rather than an equality check.Behavior
null, empty array) does not count — matching the Bases filter semantics.someand boolean (true/false) handling.No new settings or UI surface — just the existing Task property value field left blank. Its help text is updated across all locales to explain the empty = match-any behavior.
Changes
src/utils/taskIdentification.ts—isTaskFrontmattertreats an empty configured value as a key-existence check via a newhasNonEmptyValuehelper; non-empty values keep exact-match behavior.src/i18n/resources/*.ts— updatedtaskPropertyValuedescription in all 9 locales; i18n state/manifest updated for that key only.tests/unit/utils/TaskManager.isTaskFile.test.ts— added cases for match-any (present with any value), present-but-empty, absent, array values, exact-match, and the no-property-name guard.Testing
tsc --noEmitpasses.npm testfor the task-identification and i18n suites passes (existing + new cases).node scripts/i18n-manager.mjs verifypasses (all locales up to date, 0 stale).