Skip to content

Query editor: autocomplete payee and narration values #2272

Description

@sdr-nemoriaq

Feature request

The query editor already autocompletes account names when typing a BQL query. It would be very useful to also autocomplete payee (and optionally narration) string values.

Use case

When writing a query like:

SELECT date, narration, position
WHERE payee = "..."
ORDER BY date DESC

...there is currently no way to discover or complete the payee string. You need to know the exact name. For ledgers with many suppliers/payees (e.g. a business with 80+ counterparties) this makes the query interface much less useful.

Proposed behaviour

When the cursor is inside a string literal that follows payee = or payee =~, the editor suggests matching payee values from the ledger — the same way account names are suggested after account = or in WHERE account ~ "...".

Similarly for narration, though payee is the higher-priority case.

Prior art in the codebase

Account autocomplete is already implemented — payee values are a natural extension of the same mechanism. The unique payee list is cheap to derive from the entries at ledger-load time.

Environment

  • Fava 1.29
  • Beancount 2.3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions