⏺ Done. The shared builtin vocabulary table (delta-1) is implemented and #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "lsp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
verified.
What landed
crates/shared/src/builtins.rs (new) — the zero-dep single source of truth:
roster, #[rustfmt::skip] to keep it a readable one-row-per-line table.
with the documented escape hatch to a complete: bool column.
(completion: completable only).
behavior, accessor filtering).
crates/compiler/src/codegen/lower.rs — #[cfg(test)] mod vocab_invariant:
asserts DET_BUILTINS are Det rows in BUILTINS, and that codegen's full
recognized set (DET_BUILTINS ∪ ARITH_OPS ∪ ORDER_OPS ∪ a small hand-mirrored
STRUCTURAL list) exactly equals the BUILTINS vocabulary.
crates/runtime/src/control.rs — #[cfg(test)] mod vocab_invariant: asserts
det_builtin's arms equal the Det/arity>0 subset of BUILTINS. Referenced only
under #[cfg(test)] — the key to the zero-leak guarantee.
Checkpoints, all met
partition 25/16/10/4 asserted.
recognized_names_equal_shared_vocabulary).
final binary (vs 4 in the intermediate staticlib, dead-stripped at link). The
binary_size footprint gate still passes.
red with a clear set diff; restored to green.
Full suite: 272 tests pass, 0 failures, clippy clean, fmt clean.
One thing worth flagging for when you wire the LSP: the comment I left on
control.rs's det_builtin ("mirrors codegen's DET_BUILTINS") is now backed by an
actual test rather than just prose — so the three-way tie (shared ↔ codegen ↔
runtime) is enforced in just ci, not hoped for. The table is ready for the
plg-lsp crate's completion and hover to consume directly.
verified. What landed crates/shared/src/builtins.rs (new) — the zero-dep single source of truth: - BUILTINS: the 55-row (name, arity, kind, doc) table from the reconciled roster, #[rustfmt::skip] to keep it a readable one-row-per-line table. - BuiltinKind (Control/Inline/Det/Atom) to partition validation. - BuiltinSpec::completable() — the identifier heuristic (not kind-derived), with the documented escape hatch to a complete: bool column. - Accessors lookup, doc (hover: all rows), atom_names/functor_names (completion: completable only). - 5 self-check tests (size/partition, no dupes, every row doc'd, completable behavior, accessor filtering). - Re-exported from lib.rs. crates/compiler/src/codegen/lower.rs — #[cfg(test)] mod vocab_invariant: asserts DET_BUILTINS are Det rows in BUILTINS, and that codegen's full recognized set (DET_BUILTINS ∪ ARITH_OPS ∪ ORDER_OPS ∪ a small hand-mirrored STRUCTURAL list) exactly equals the BUILTINS vocabulary. crates/runtime/src/control.rs — #[cfg(test)] mod vocab_invariant: asserts det_builtin's arms equal the Det/arity>0 subset of BUILTINS. Referenced only under #[cfg(test)] — the key to the zero-leak guarantee. Checkpoints, all met 1. Roster complete — 55 rows, 52 docs ported verbatim from v1, 3 new (, ; ->); partition 25/16/10/4 asserted. 2. codegen test — passes (det_builtins_are_det_rows_in_shared, recognized_names_equal_shared_vocabulary). 3. runtime test — passes (det_dispatch_equals_shared_det_subset). 4. Zero leak into programs — built a real hello-world: 0 doc strings in the final binary (vs 4 in the intermediate staticlib, dead-stripped at link). The binary_size footprint gate still passes. 5. Invariant bites — deleting sort/2 from DET_BUILTINS turned the codegen test red with a clear set diff; restored to green. Full suite: 272 tests pass, 0 failures, clippy clean, fmt clean. One thing worth flagging for when you wire the LSP: the comment I left on control.rs's det_builtin ("mirrors codegen's DET_BUILTINS") is now backed by an actual test rather than just prose — so the three-way tie (shared ↔ codegen ↔ runtime) is enforced in just ci, not hoped for. The table is ready for the plg-lsp crate's completion and hover to consume directly.What shipped completion.rs — three sources, user-shadows-stdlib-shadows-builtin: - Built-ins from plg_shared::builtins::{atom_names, functor_names} — these already apply completable(), so operators and ! are filtered out automatically (the delta-1 payoff: no LSP-side filter needed). - Stdlib predicates parsed once from plg_shared::STDLIB_PL (delta-2 payoff). - User predicates via buffer::parse_best_effort (mid-edit recovery). hover.rs — built-in docs from plg_shared::builtins::doc (the same table codegen/runtime validate against), falling back to rendered user clause heads. main.rs — added completion_provider/hover_provider capabilities and both handlers; dropped the temporary dead_code allows now that buffer and content are live. Verified over real stdio - Completion for mem in a buffer defining member/2: returns member, and ! is absent — confirming the completable() filter works through the whole pipeline. - Hover on user member → **member** (user-defined) with the rendered head member(_0, [...]). - Hover on builtin between/findall → the doc text from the shared table. One honest correction Hovering an operator like =.. returns nothing — word_at_position extracts identifier runs only, so the cursor never resolves to a symbol token. This is exactly v1's behavior (its operator doc entries were unreachable via hover too). I'd initially overstated "hover serves operators"; I corrected both comments and added a test only for the identifier-form case that actually works. Symbol-token hover would be an additive enhancement, noted in the hover.rs header — not part of v1 parity.