aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-01-31 03:36:36 +0000
committerBlaž Hrastnik2022-01-31 07:04:58 +0000
commitf7f55143a1c8f8f643c4ca59d8c4beb9612ef0bb (patch)
tree58760c28d47c591eeb98096358e8acbf3cafdbcd /helix-term/src/commands.rs
parent4c996f43dfb81bc7438f2e24447c0370f1f4a97a (diff)
Improve code action picker by displaying it inline
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 9d140662..96acb424 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3482,12 +3482,17 @@ pub fn code_action(cx: &mut Context) {
cx.callback(
future,
- move |_editor: &mut Editor,
+ move |editor: &mut Editor,
compositor: &mut Compositor,
response: Option<lsp::CodeActionResponse>| {
if let Some(actions) = response {
+ if actions.is_empty() {
+ editor.set_status("No code actions available".to_owned());
+ return;
+ }
+
let picker = Picker::new(
- true,
+ false,
actions,
|action| match action {
lsp::CodeActionOrCommand::CodeAction(action) => {
@@ -3515,7 +3520,8 @@ pub fn code_action(cx: &mut Context) {
}
},
);
- compositor.push(Box::new(picker))
+ let popup = Popup::new("code-action", picker);
+ compositor.push(Box::new(popup))
}
},
)