[ty] Make inlay hint clickable in playground (#21656)

This commit is contained in:
Micha Reiser 2025-11-27 13:29:11 +01:00 committed by GitHub
parent 761031f729
commit 7c7f8d1a17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -493,6 +493,19 @@ impl Workspace {
self.position_encoding, self.position_encoding,
), ),
kind: hint.kind.into(), kind: hint.kind.into(),
text_edits: hint
.text_edits
.into_iter()
.map(|edit| TextEdit {
range: Range::from_text_range(
edit.range,
&index,
&source,
self.position_encoding,
),
new_text: edit.new_text,
})
.collect(),
}) })
.collect()) .collect())
} }
@ -1110,6 +1123,9 @@ pub struct InlayHint {
pub position: Position, pub position: Position,
pub kind: InlayHintKind, pub kind: InlayHintKind,
#[wasm_bindgen(getter_with_clone)]
pub text_edits: Vec<TextEdit>,
} }
#[wasm_bindgen] #[wasm_bindgen]

View File

@ -463,6 +463,10 @@ class PlaygroundServer
column: hint.position.column, column: hint.position.column,
}, },
kind: mapInlayHintKind(hint.kind), kind: mapInlayHintKind(hint.kind),
textEdits: hint.text_edits.map((edit: TextEdit) => ({
range: tyRangeToMonacoRange(edit.range),
text: edit.new_text,
})),
})), })),
}; };
} }