Expand description
JSON key completion for col->'<cursor>' / col->>'<cursor>'
chains.
Two sources of keys: same-buffer jsonb literal examples (harvested
by a cheap non-parsing scanner), and โ when a live catalog is
available โ Column.json_keys recorded for the resolved column.
Extracted from engine.rs (was inline there) โ pure code motion,
no behavior change.
Functionsยง
- json_
path_ keys_ at - When the cursor sits inside the literal of
<expr>->'<cursor>or<expr>->>'<cursor>, return the JSON keys observed in same-buffer jsonb literals ('{"key":...}') so the user can autocomplete instead of guessing. Handles chained paths:col->'a'->'b'->'<cursor>'walks into nested objects of the harvested literals and surfaces only the keys present at depth a.b. Returns None outside this context. - json_
path_ keys_ at_ with_ catalog - Like
json_path_keys_atbut also consultsColumn.json_keysfrom the catalog. When the cursor sits on acol->'...'chain whose head resolves to a known jsonb column with stored top-level keys, surface those even when the buffer has no example literal to harvest.