feat(lsp): schema-aware completion for type / link / fields (REQ-246 slice 1, DD-071, #546)#669
Merged
Merged
Conversation
…fields (REQ-246 slice 1, DD-071, #546) Implements the first slice of REQ-246 (per DD-071): make the rivet LSP's completion schema-aware so humans author correct artifact YAML without memorizing the schema — on the surface that is already "all in common" (the LSP the VSIX and other editors run), no new write surface. `lsp_completion` now delegates to `lsp_schema_completions`, which offers: - artifact `type:` → every schema-declared type (∪ store types), so a new project can complete a type it has not used yet (was: only seen types); - a link's `- type:` under a `links:` block → the link types authorable from the enclosing artifact's type, annotated with their valid targets; - inside a `fields:` block → the enclosing type's declared field names, required ones marked, each carrying its field type + description. Context detection is factored into pure helpers (`lsp_enclosing_artifact_type`, `lsp_current_block_key`) that scan indentation to tell `fields:` from `links:` and resolve the enclosing artifact type, skipping sequence-item levels. Unit-tested directly (5 tests) plus a schema-driven field-completion test against the embedded `common` schema. Follow-on slices (not here): enum field-value completion, per-artifact-type skeleton snippets, an lsp_integration end-to-end completion test. Implements: REQ-246 Refs: FEAT-010
📐 Rivet artifact deltaNo artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First slice of REQ-246 per DD-071: make the rivet LSP completion schema-aware, so humans author correct artifact YAML without memorizing the schema — delivered on the surface that is already "all in common" (the LSP the VSIX and other editors run), no new write surface, YAML stays canonical.
lsp_completionnow delegates tolsp_schema_completions, which offers:type:→ every schema-declared type (∪ store types) — a new project can complete a type it hasn't used yet (was: only already-seen types).- type:under alinks:block → the link types authorable from the enclosing artifact's type, annotated with valid target types.fields:block → the enclosing type's declared field names, required ones marked, each carrying its field type + description.Context detection is factored into pure helpers (
lsp_enclosing_artifact_type,lsp_current_block_key) that scan indentation to distinguishfields:fromlinks:and resolve the enclosing artifact type (skipping sequence-item levels).Verification
commonschema (assertsai-sessionfield names + therequiredmarker).cargo clippy --all-targets -- -D warningsexit 0;cargo fmt --checkclean.Scope / follow-ons (not in this PR)
allowed-values)lsp_integrationend-to-end completion testREQ-246 stays
approved(this is a partial implementation); it advances toverifiedwhen the full DD-071 scope + an integration test land.Implements: REQ-246 · Refs: FEAT-010 · DD-071 (#546)
🤖 Generated with Claude Code