mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
minor: add missing definitions of lsp_ext::InlayHintLabel
This commit is contained in:
parent
62265ee9cb
commit
119ba82e4b
3 changed files with 22 additions and 4 deletions
|
@ -255,7 +255,7 @@ impl InlayHintKind {
|
|||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct InlayHint {
|
||||
pub label: String,
|
||||
pub label: InlayHintLabel,
|
||||
pub position: Position,
|
||||
pub kind: Option<InlayHintKind>,
|
||||
pub tooltip: Option<String>,
|
||||
|
@ -263,6 +263,24 @@ pub struct InlayHint {
|
|||
pub padding_right: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum InlayHintLabel {
|
||||
String(String),
|
||||
Parts(Vec<InlayHintLabelPart>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct InlayHintLabelPart {
|
||||
pub value: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tooltip: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub location: Option<lsp_types::LocationLink>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub command: Option<lsp_types::Command>,
|
||||
}
|
||||
pub enum Ssr {}
|
||||
|
||||
impl Request for Ssr {
|
||||
|
|
|
@ -419,11 +419,11 @@ pub(crate) fn inlay_hint(
|
|||
inlay_hint: InlayHint,
|
||||
) -> lsp_ext::InlayHint {
|
||||
lsp_ext::InlayHint {
|
||||
label: match inlay_hint.kind {
|
||||
label: lsp_ext::InlayHintLabel::String(match inlay_hint.kind {
|
||||
InlayKind::ParameterHint if render_colons => format!("{}:", inlay_hint.label),
|
||||
InlayKind::TypeHint if render_colons => format!(": {}", inlay_hint.label),
|
||||
_ => inlay_hint.label.to_string(),
|
||||
},
|
||||
}),
|
||||
position: match inlay_hint.kind {
|
||||
InlayKind::ParameterHint => position(line_index, inlay_hint.range.start()),
|
||||
InlayKind::TypeHint | InlayKind::ChainingHint => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!---
|
||||
lsp_ext.rs hash: e32fdde032ff6ebc
|
||||
lsp_ext.rs hash: 854109e98d02a780
|
||||
|
||||
If you need to change the above hash to make the test pass, please check if you
|
||||
need to adjust this doc as well and ping this issue:
|
||||
|
|
Loading…
Reference in a new issue