From 96a4eb84838d4cbfb9313968278985ea1986a3bc Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Tue, 22 Mar 2022 23:25:40 +0900 Subject: Remove more push_layer calls --- helix-term/src/commands/lsp.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'helix-term/src/commands') diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 308ff829..530e528a 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -11,7 +11,7 @@ use helix_view::editor::Action; use crate::{ compositor::{self, Compositor}, - ui::{self, overlay::overlayed, FileLocation, FilePicker, Popup, Prompt, PromptEvent}, + ui::{self, overlay::overlayed, FileLocation, FilePicker, Popup, PromptEvent}, }; use std::borrow::Cow; @@ -138,9 +138,7 @@ pub fn symbol_picker(cx: &mut Context) { cx.callback( future, - move |editor: &mut Editor, - compositor: &mut Compositor, - response: Option| { + move |editor, compositor, response: Option| { if let Some(symbols) = response { // lsp has two ways to represent symbols (flat/nested) // convert the nested variant to flat, so that we have a homogeneous list @@ -172,9 +170,7 @@ pub fn workspace_symbol_picker(cx: &mut Context) { cx.callback( future, - move |_editor: &mut Editor, - compositor: &mut Compositor, - response: Option>| { + move |_editor, compositor, response: Option>| { if let Some(symbols) = response { let picker = sym_picker(symbols, current_url, offset_encoding); compositor.push(Box::new(overlayed(picker))) @@ -208,9 +204,7 @@ pub fn code_action(cx: &mut Context) { cx.callback( future, - move |editor: &mut Editor, - compositor: &mut Compositor, - response: Option| { + move |editor, compositor, response: Option| { let actions = match response { Some(a) => a, None => return, @@ -613,7 +607,7 @@ pub fn hover(cx: &mut Context) { cx.callback( future, - move |editor: &mut Editor, compositor: &mut Compositor, response: Option| { + move |editor, compositor, response: Option| { if let Some(hover) = response { // hover.contents / .range <- used for visualizing @@ -650,7 +644,8 @@ pub fn hover(cx: &mut Context) { ); } pub fn rename_symbol(cx: &mut Context) { - let prompt = Prompt::new( + ui::prompt( + cx, "rename-to:".into(), None, ui::completers::none, @@ -670,5 +665,4 @@ pub fn rename_symbol(cx: &mut Context) { apply_workspace_edit(cx.editor, offset_encoding, &edits); }, ); - cx.push_layer(Box::new(prompt)); } -- cgit v1.2.3-70-g09d2