mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
Optional history for rename_symbol (#10932)
Fix #10560 by accepting an optional history register for the rename_symbol command.
This commit is contained in:
parent
9123d3fbb8
commit
62655e97f1
@ -1029,11 +1029,12 @@ fn get_prefill_from_lsp_response(
|
||||
fn create_rename_prompt(
|
||||
editor: &Editor,
|
||||
prefill: String,
|
||||
history_register: Option<char>,
|
||||
language_server_id: Option<LanguageServerId>,
|
||||
) -> Box<ui::Prompt> {
|
||||
let prompt = ui::Prompt::new(
|
||||
"rename-to:".into(),
|
||||
None,
|
||||
history_register,
|
||||
ui::completers::none,
|
||||
move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
|
||||
if event != PromptEvent::Validate {
|
||||
@ -1070,6 +1071,7 @@ fn create_rename_prompt(
|
||||
}
|
||||
|
||||
let (view, doc) = current_ref!(cx.editor);
|
||||
let history_register = cx.register;
|
||||
|
||||
if doc
|
||||
.language_servers_with_feature(LanguageServerFeature::RenameSymbol)
|
||||
@ -1112,14 +1114,14 @@ fn create_rename_prompt(
|
||||
}
|
||||
};
|
||||
|
||||
let prompt = create_rename_prompt(editor, prefill, Some(ls_id));
|
||||
let prompt = create_rename_prompt(editor, prefill, history_register, Some(ls_id));
|
||||
|
||||
compositor.push(prompt);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
let prefill = get_prefill_from_word_boundary(cx.editor);
|
||||
let prompt = create_rename_prompt(cx.editor, prefill, None);
|
||||
let prompt = create_rename_prompt(cx.editor, prefill, history_register, None);
|
||||
cx.push_layer(prompt);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user