Background
Current completion is intentionally scoped to a JSON-path-level subset:
This subset was chosen pragmatically: these completions can be derived directly from runtime JSON shape (path enumeration) without introducing a dedicated jq parser, error-tolerant AST recovery, or other complex semantic analysis.
Current design and why
Following that scoped approach, the current completion pipeline has two key properties:
-
jnv loads completion candidates incrementally (lazy-loading style) so startup and readline interaction stay responsive, even for large JSON inputs.
-
The path-enumeration logic itself is delegated to promkit (get_all_paths), and jnv builds completion behavior on top of that result set.
Lazy loading for JSON Paths
jnv uses a shared SuggestionStore so the editor can consume completion candidates while loading is still in progress.
How it works:
- The store is wrapped as
Arc<Mutex<...>> (SharedSuggestionStore), so loading tasks and UI/editor logic can access the same state safely.
- A background task incrementally inserts discovered paths into
store.paths.
- Progress (
loaded_path_count, is_complete) is updated in the same shared state.
- The editor side reads from this shared store (
collect_matches) and can show partial results immediately.
Path enumeration delegated to promkit (get_all_paths)
jnv does not implement its own path-enumeration engine.
Instead, it delegates JSON path extraction to promkit and builds completion behavior on top of those paths.
What we want to improve
- Expand completion beyond JSON-path-only cases into broader jq contexts.
- Support context-aware completion in pipeline/editing flows (e.g. after
|, inside partially typed expressions).
- Optimize candidate ordering/ranking so the most relevant items appear first.
Constraints
- Preserve current responsiveness characteristics (non-blocking interaction, incremental loading).
References
Background
Current completion is intentionally scoped to a JSON-path-level subset:
This subset was chosen pragmatically: these completions can be derived directly from runtime JSON shape (path enumeration) without introducing a dedicated jq parser, error-tolerant AST recovery, or other complex semantic analysis.
Current design and why
Following that scoped approach, the current completion pipeline has two key properties:
jnvloads completion candidates incrementally (lazy-loading style) so startup and readline interaction stay responsive, even for large JSON inputs.The path-enumeration logic itself is delegated to
promkit(get_all_paths), andjnvbuilds completion behavior on top of that result set.Lazy loading for JSON Paths
jnvuses a sharedSuggestionStoreso the editor can consume completion candidates while loading is still in progress.How it works:
Arc<Mutex<...>>(SharedSuggestionStore), so loading tasks and UI/editor logic can access the same state safely.store.paths.loaded_path_count,is_complete) is updated in the same shared state.collect_matches) and can show partial results immediately.Path enumeration delegated to
promkit(get_all_paths)jnvdoes not implement its own path-enumeration engine.Instead, it delegates JSON path extraction to promkit and builds completion behavior on top of those paths.
jnvwrapper (get_all_paths)jnvcall site tojsonz::get_all_pathspromkitimplementation (get_all_paths)What we want to improve
|, inside partially typed expressions).Constraints
References