feat: containsAny / negation in project autosuggest property value filter#2089
Open
kapej42 wants to merge 1 commit into
Open
feat: containsAny / negation in project autosuggest property value filter#2089kapej42 wants to merge 1 commit into
kapej42 wants to merge 1 commit into
Conversation
… value filter
The "Required property value" filter for the project autosuggest (and the
shared wikilink `[[` file suggest) previously only accepted a plain
comma-separated allow-list, matched as an equality set. There was no way to
*exclude* values, so archived/completed/cancelled projects could not be hidden
from the `+` project picker without enumerating every still-active status.
Extend the property value grammar in `matchesProjectProperty` with a small,
backwards-compatible expression syntax:
- `active, planned` -> legacy allow-list (unchanged)
- `containsAny("active", "planned")` -> explicit allow-list
- `!containsAny("completed", "archived")` -> exclude these values
- `not containsAny("done")` / `!completed` -> alternate negation forms
The configured property key remains required: a note that lacks the property
(or whose value is empty) is never suggested, matching the "Required property
key" field semantics. The expression only narrows which existing values are
allowed. Matching stays case-insensitive across string, list, numeric and
boolean values.
Update the settings description/placeholder and the docs accordingly, and add
unit tests covering the new expression forms alongside the existing behavior.
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.
Summary
The Required property value filter for the project autosuggest (the
+project picker during task creation, and the shared
[[wikilink file suggest)previously only accepted a plain comma-separated allow-list, matched as an
equality set. There was no way to exclude values — so to hide archived /
completed / cancelled projects you had to enumerate every still-active status
instead.
This PR adds a small, backwards-compatible expression syntax:
active, plannedcontainsAny("active", "planned")!containsAny("completed", "archived", "cancelled", "done")not containsAny("done")/!completed, archivedThe configured property key stays required: a note that lacks the property
(or whose value is empty) is never suggested, matching the existing "Required
property key" field semantics. The value expression only narrows which existing
values are allowed. Matching remains case-insensitive and works across string,
list, numeric and boolean property values.
Motivation
Filtering projects by a
statusproperty surfaced completed/archived projectsin the
+picker, because the only available operator was "equals one of".!containsAny(...)makes "show every project except the done ones" a one-liner.Changes
src/utils/projectFilterUtils.ts: newparsePropertyValueExpression()and ageneralized
matchesProjectProperty()(allow-list +containsAny+ negation,with the property required to exist).
tests/unit/utils/projectFilterUtils.test.ts: new cases for the expressionforms; existing allow-list cases pass unchanged.
src/i18n/resources/en.ts: updated description + placeholder.docs/settings/task-properties.md: documented the new syntax.Testing
npx jest projectFilter FileSuggest ProjectSelect→ 45 passed.npm run build→ type-check + esbuild succeed.