View Source cure_lsp_type_holes (cure v0.7.0)
Type Holes - Interactive Type Inference
Provides Idris-style type holes where you can write:
?hole- Named hole (e.g.,?returnType)_- Anonymous hole
Features
- Hover on hole - Shows inferred type
- Code action - "Fill in hole with: List(Int)"
- SMT-based inference - Uses type checker + constraint solving
Usage Examples
Return Type Hole
def double_list(numbers: List(Int)): ? =
map(numbers, fn(x) -> x * 2 end)
% Hover shows: ?returnType :: List(Int)
% Code action: Fill in return typeParameter Type Hole
def process(x: _): Int =
x + 1
% Infers: x :: IntExpression Type Hole
let result: ? = compute_value()
% Shows inferred type from compute_valueImplementation
Type holes are detected during parsing and marked in the AST. The LSP provides:
- Diagnostics (info-level) for each hole
- Hover information with inferred type
- Code action to fill in the type