Skip to content

feat(completion): extend filter completion beyond Identity/Object Index/Array Index #114

@ynqa

Description

@ynqa

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:

  1. jnv loads completion candidates incrementally (lazy-loading style) so startup and readline interaction stay responsive, even for large JSON inputs.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions