Skip to content

feat: containsAny / negation in project autosuggest property value filter#2089

Open
kapej42 wants to merge 1 commit into
callumalpass:mainfrom
kapej42:feat/project-autosuggest-exclude-filter
Open

feat: containsAny / negation in project autosuggest property value filter#2089
kapej42 wants to merge 1 commit into
callumalpass:mainfrom
kapej42:feat/project-autosuggest-exclude-filter

Conversation

@kapej42

@kapej42 kapej42 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

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:

Input Meaning
active, planned legacy allow-list (unchanged)
containsAny("active", "planned") explicit allow-list
!containsAny("completed", "archived", "cancelled", "done") exclude these values
not containsAny("done") / !completed, archived alternate negation forms

The 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 status property surfaced completed/archived projects
in 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: new parsePropertyValueExpression() and a
    generalized matchesProjectProperty() (allow-list + containsAny + negation,
    with the property required to exist).
  • tests/unit/utils/projectFilterUtils.test.ts: new cases for the expression
    forms; 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.

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

1 participant