mirror of https://github.com/astral-sh/ruff
[ty] Make inlay hint clickable in playground (#21656)
This commit is contained in:
parent
761031f729
commit
7c7f8d1a17
|
|
@ -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]
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
})),
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue