Skip to content

Commit f749e9c

Browse files
bors[bot]matklad
andauthored
Merge #9712
9712: minor: simplify r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 6a2a0b7 + ea9f692 commit f749e9c

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

crates/rust-analyzer/src/config.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,6 @@ impl Config {
582582
pub fn code_action_group(&self) -> bool {
583583
self.experimental("codeActionGroup")
584584
}
585-
pub fn experimental_hover_actions(&self) -> bool {
586-
self.experimental("hoverActions")
587-
}
588585
pub fn server_status_notification(&self) -> bool {
589586
self.experimental("serverStatusNotification")
590587
}
@@ -790,13 +787,13 @@ impl Config {
790787
}
791788
}
792789
pub fn hover_actions(&self) -> HoverActionsConfig {
790+
let enable = self.experimental("hoverActions") && self.data.hoverActions_enable;
793791
HoverActionsConfig {
794-
implementations: self.data.hoverActions_enable
795-
&& self.data.hoverActions_implementations,
796-
references: self.data.hoverActions_enable && self.data.hoverActions_references,
797-
run: self.data.hoverActions_enable && self.data.hoverActions_run,
798-
debug: self.data.hoverActions_enable && self.data.hoverActions_debug,
799-
goto_type_def: self.data.hoverActions_enable && self.data.hoverActions_gotoTypeDef,
792+
implementations: enable && self.data.hoverActions_implementations,
793+
references: enable && self.data.hoverActions_references,
794+
run: enable && self.data.hoverActions_run,
795+
debug: enable && self.data.hoverActions_debug,
796+
goto_type_def: enable && self.data.hoverActions_gotoTypeDef,
800797
}
801798
}
802799
pub fn highlighting_strings(&self) -> bool {

crates/rust-analyzer/src/handlers.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,11 @@ pub(crate) fn handle_hover(
882882
contents: HoverContents::Markup(to_proto::markup_content(info.info.markup)),
883883
range: Some(range),
884884
},
885-
actions: prepare_hover_actions(&snap, &info.info.actions),
885+
actions: if snap.config.hover_actions().none() {
886+
Vec::new()
887+
} else {
888+
prepare_hover_actions(&snap, &info.info.actions)
889+
},
886890
};
887891

888892
Ok(Some(hover))
@@ -1594,10 +1598,6 @@ fn prepare_hover_actions(
15941598
snap: &GlobalStateSnapshot,
15951599
actions: &[HoverAction],
15961600
) -> Vec<lsp_ext::CommandLinkGroup> {
1597-
if snap.config.hover_actions().none() || !snap.config.experimental_hover_actions() {
1598-
return Vec::new();
1599-
}
1600-
16011601
actions
16021602
.iter()
16031603
.filter_map(|it| match it {

0 commit comments

Comments
 (0)