mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
minor: simplify
This commit is contained in:
parent
6a2a0b7abb
commit
ea9f6920fb
@ -582,9 +582,6 @@ impl Config {
|
|||||||
pub fn code_action_group(&self) -> bool {
|
pub fn code_action_group(&self) -> bool {
|
||||||
self.experimental("codeActionGroup")
|
self.experimental("codeActionGroup")
|
||||||
}
|
}
|
||||||
pub fn experimental_hover_actions(&self) -> bool {
|
|
||||||
self.experimental("hoverActions")
|
|
||||||
}
|
|
||||||
pub fn server_status_notification(&self) -> bool {
|
pub fn server_status_notification(&self) -> bool {
|
||||||
self.experimental("serverStatusNotification")
|
self.experimental("serverStatusNotification")
|
||||||
}
|
}
|
||||||
@ -790,13 +787,13 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn hover_actions(&self) -> HoverActionsConfig {
|
pub fn hover_actions(&self) -> HoverActionsConfig {
|
||||||
|
let enable = self.experimental("hoverActions") && self.data.hoverActions_enable;
|
||||||
HoverActionsConfig {
|
HoverActionsConfig {
|
||||||
implementations: self.data.hoverActions_enable
|
implementations: enable && self.data.hoverActions_implementations,
|
||||||
&& self.data.hoverActions_implementations,
|
references: enable && self.data.hoverActions_references,
|
||||||
references: self.data.hoverActions_enable && self.data.hoverActions_references,
|
run: enable && self.data.hoverActions_run,
|
||||||
run: self.data.hoverActions_enable && self.data.hoverActions_run,
|
debug: enable && self.data.hoverActions_debug,
|
||||||
debug: self.data.hoverActions_enable && self.data.hoverActions_debug,
|
goto_type_def: enable && self.data.hoverActions_gotoTypeDef,
|
||||||
goto_type_def: self.data.hoverActions_enable && self.data.hoverActions_gotoTypeDef,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn highlighting_strings(&self) -> bool {
|
pub fn highlighting_strings(&self) -> bool {
|
||||||
|
@ -882,7 +882,11 @@ pub(crate) fn handle_hover(
|
|||||||
contents: HoverContents::Markup(to_proto::markup_content(info.info.markup)),
|
contents: HoverContents::Markup(to_proto::markup_content(info.info.markup)),
|
||||||
range: Some(range),
|
range: Some(range),
|
||||||
},
|
},
|
||||||
actions: prepare_hover_actions(&snap, &info.info.actions),
|
actions: if snap.config.hover_actions().none() {
|
||||||
|
Vec::new()
|
||||||
|
} else {
|
||||||
|
prepare_hover_actions(&snap, &info.info.actions)
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Some(hover))
|
Ok(Some(hover))
|
||||||
@ -1594,10 +1598,6 @@ fn prepare_hover_actions(
|
|||||||
snap: &GlobalStateSnapshot,
|
snap: &GlobalStateSnapshot,
|
||||||
actions: &[HoverAction],
|
actions: &[HoverAction],
|
||||||
) -> Vec<lsp_ext::CommandLinkGroup> {
|
) -> Vec<lsp_ext::CommandLinkGroup> {
|
||||||
if snap.config.hover_actions().none() || !snap.config.experimental_hover_actions() {
|
|
||||||
return Vec::new();
|
|
||||||
}
|
|
||||||
|
|
||||||
actions
|
actions
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|it| match it {
|
.filter_map(|it| match it {
|
||||||
|
Loading…
Reference in New Issue
Block a user