Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional history for rename_symbol #10932

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions helix-term/src/commands/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,11 +1029,12 @@ pub fn rename_symbol(cx: &mut Context) {
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 {
Expand Down Expand Up @@ -1070,6 +1071,7 @@ pub fn rename_symbol(cx: &mut Context) {
}

let (view, doc) = current_ref!(cx.editor);
let history_register = cx.register;

if doc
.language_servers_with_feature(LanguageServerFeature::RenameSymbol)
Expand Down Expand Up @@ -1112,14 +1114,14 @@ pub fn rename_symbol(cx: &mut Context) {
}
};

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);
}
}
Expand Down
Loading