Skip to main content

Module capability_fixes

Module capability_fixes 

Source
Expand description

#852 (capability-aware quick-fixes): the codeAction producers that repair resolution/boundary diagnostics by editing a unit’s header — add consumes for an unconsumed cross-context call, and the Bynk analogue of auto-import (add uses/add consumes) for an unresolved name that the binding index places in a mixable commons or a consumable context.

Unlike the crate::code_actions quick-fixes — which render structured bynk_syntax::error::Suggestions authored at the diagnosis site — these are computed here: the fix’s location is a unit-header edit that only exists once the buffer is reparsed, and (for auto-import) the resolution is a whole-project query over the committed ProjectIndex, neither of which is available at the per-unit checker diagnosis site. Like the extract module, the current buffer is reparsed fresh each call (no cached AST); edits are versioned against the analysed document version, so a drifted buffer rejects them (§3.10’s rule).

Keying, as in code_actions, is on the diagnostic’s span: the unresolved name / unconsumed chain is read straight from the source at that span (never re-derived from the message text), so the fix stays anchored to exactly what the compiler flagged.

Functions§

header_quick_fixes
Quick-fixes that add a uses/consumes clause to the current unit’s header, for every resolution diagnostic whose span intersects requested. index is the committed round’s binding index; the current unit’s own declarations are excluded as candidates (a name that already resolves locally is not “unresolved”).