Skip to content

feat(lsp): schema-aware completion for type / link / fields (REQ-246 slice 1, DD-071, #546)#669

Merged
avrabe merged 1 commit into
mainfrom
feat/req-246-lsp-schema-completion
Jul 7, 2026
Merged

feat(lsp): schema-aware completion for type / link / fields (REQ-246 slice 1, DD-071, #546)#669
avrabe merged 1 commit into
mainfrom
feat/req-246-lsp-schema-completion

Conversation

@avrabe

@avrabe avrabe commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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_completion now delegates to lsp_schema_completions, which offers:

  • artifact type: → every schema-declared type (∪ store types) — a new project can complete a type it hasn't used yet (was: only already-seen types).
  • a link's - type: under a links: block → the link types authorable from the enclosing artifact's type, annotated with valid target types.
  • 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 distinguish fields: from links: and resolve the enclosing artifact type (skipping sequence-item levels).

Verification

  • 5 unit tests: 4 context-detection cases + a schema-driven field-completion test against the embedded common schema (asserts ai-session field names + the required marker).
  • cargo clippy --all-targets -- -D warnings exit 0; cargo fmt --check clean.

Scope / follow-ons (not in this PR)

  • enum field-value completion (fields with allowed-values)
  • per-artifact-type skeleton snippets
  • an lsp_integration end-to-end completion test

REQ-246 stays approved (this is a partial implementation); it advances to verified when the full DD-071 scope + an integration test land.

Implements: REQ-246 · Refs: FEAT-010 · DD-071 (#546)

🤖 Generated with Claude Code

…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
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

📐 Rivet artifact delta

No artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph.

@avrabe avrabe merged commit 1404d94 into main Jul 7, 2026
26 of 28 checks passed
@avrabe avrabe deleted the feat/req-246-lsp-schema-completion branch July 7, 2026 19:31
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant