fix(parse): position-independent inline metadata parsing (#164)
Some checks failed
quality / changes (push) Has been cancelled
test / Test (Neovim nightly) (push) Has been cancelled
test / Test (Neovim stable) (push) Has been cancelled
quality / Lua Format Check (push) Has been cancelled
quality / Lua Lint Check (push) Has been cancelled
quality / Lua Type Check (push) Has been cancelled
quality / Markdown Format Check (push) Has been cancelled

Problem: `parse.body()` scanned tokens right-to-left and broke on the
first non-metadata token, so metadata only worked at the trailing end
of a line. `due:tomorrow Fix the bug` silently failed to parse the
due date.

Solution: Replace the right-to-left `while` loop with a single
left-to-right pass that extracts metadata tokens from any position.
Duplicate metadata tokens are dropped with a `log.warn`. Update docs
and tests accordingly.
This commit is contained in:
Barrett Ruth 2026-03-13 20:48:18 -04:00
parent 6e220797b9
commit f3ef1ca0db
3 changed files with 33 additions and 3 deletions

View file

@ -664,7 +664,7 @@ On `:w`, the description becomes `Buy milk`, the due date is stored as
placed under the `Errands` category header.
Only the first occurrence of each metadata type is consumed — duplicate
tokens are silently dropped.
tokens are dropped with a warning.
Omnifunc completion is available for `due:`, `cat:`, and `rec:` token types.
In insert mode, type the token prefix and press `<C-x><C-o>` to see