⏺ Done — 10 tests pass (new predicate_names test included), clippy -D warnings #11

Merged
navicore merged 1 commit from completion into main 2026-06-16 16:19:59 +00:00
Owner

and fmt clean.

What changed:

  • Session::predicate_names() parses the buffer and returns the predicates the
    user has defined or declared — clause heads (facts and rule heads, via
    Term::functor_arity) plus :- dynamic declarations (from ProgramDirectives) —
    resolved to names, sorted and deduped. It reuses the real parser (no shadow
    logic), and degrades to empty on a mid-edit parse error.
  • complete() now threads those names into completion::candidates(&prefix,
    &preds) instead of the empty slice. So Tab completes session-defined predicates
    alongside builtins/stdlib.

Concretely, after defining parent/2 and ancestor/2, typing anc now
completes to ancestor — previously it only worked if the name happened to
collide with a builtin/stdlib predicate. The test pins exactly this: a buffer
of a fact + a rule + a :- dynamic decl + a 0-arity fact yields ["ancestor",
"extra", "parent", "test"].

This closes review #3 (PR #8 checkpoint 7) — completion now covers builtins +
stdlib + buffer predicates, which is the full set the design called for. It
also confirms the value of the per-clause buffer landing first: extracting
predicate names was a clean parse-and-resolve, no string heuristics.

The parked list is now down to :edit (suspend → $EDITOR → recompile) and
;-paging for multiple solutions whenever you want them.

and fmt clean. What changed: - Session::predicate_names() parses the buffer and returns the predicates the user has defined or declared — clause heads (facts and rule heads, via Term::functor_arity) plus :- dynamic declarations (from ProgramDirectives) — resolved to names, sorted and deduped. It reuses the real parser (no shadow logic), and degrades to empty on a mid-edit parse error. - complete() now threads those names into completion::candidates(&prefix, &preds) instead of the empty slice. So Tab completes session-defined predicates alongside builtins/stdlib. Concretely, after defining parent/2 and ancestor/2, typing anc<Tab> now completes to ancestor — previously it only worked if the name happened to collide with a builtin/stdlib predicate. The test pins exactly this: a buffer of a fact + a rule + a :- dynamic decl + a 0-arity fact yields ["ancestor", "extra", "parent", "test"]. This closes review #3 (PR #8 checkpoint 7) — completion now covers builtins + stdlib + buffer predicates, which is the full set the design called for. It also confirms the value of the per-clause buffer landing first: extracting predicate names was a clean parse-and-resolve, no string heuristics. The parked list is now down to :edit (suspend → $EDITOR → recompile) and ;-paging for multiple solutions whenever you want them.
⏺ Done — 10 tests pass (new predicate_names test included), clippy -D warnings
All checks were successful
CI - Linux / CI - Linux x86_64 (pull_request) Successful in 1m5s
0f4f81ef11
and fmt clean.

  What changed:
  - Session::predicate_names() parses the buffer and returns the predicates the
  user has defined or declared — clause heads (facts and rule heads, via
  Term::functor_arity) plus :- dynamic declarations (from ProgramDirectives) —
  resolved to names, sorted and deduped. It reuses the real parser (no shadow
  logic), and degrades to empty on a mid-edit parse error.
  - complete() now threads those names into completion::candidates(&prefix,
  &preds) instead of the empty slice. So Tab completes session-defined predicates
  alongside builtins/stdlib.

  Concretely, after defining parent/2 and ancestor/2, typing anc<Tab> now
  completes to ancestor — previously it only worked if the name happened to
  collide with a builtin/stdlib predicate. The test pins exactly this: a buffer
  of a fact + a rule + a :- dynamic decl + a 0-arity fact yields ["ancestor",
  "extra", "parent", "test"].

  This closes review #3 (PR #8 checkpoint 7) — completion now covers builtins +
  stdlib + buffer predicates, which is the full set the design called for. It
  also confirms the value of the per-clause buffer landing first: extracting
  predicate names was a clean parse-and-resolve, no string heuristics.

  The parked list is now down to :edit (suspend → $EDITOR → recompile) and
  ;-paging for multiple solutions whenever you want them.
navicore deleted branch completion 2026-06-16 16:19:59 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-prolog!11
No description provided.