mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-11 21:00:35 +00:00
💄
This commit is contained in:
parent
d0b5c654aa
commit
c8fb8e2859
1 changed files with 126 additions and 126 deletions
|
@ -2460,150 +2460,150 @@ impl Element<Editor> for EditorElement {
|
|||
dispatch_context,
|
||||
Some(editor.focus_handle.clone()),
|
||||
|_, cx| {
|
||||
handle_action(cx, Editor::move_left);
|
||||
handle_action(cx, Editor::move_right);
|
||||
handle_action(cx, Editor::move_down);
|
||||
handle_action(cx, Editor::move_up);
|
||||
register_action(cx, Editor::move_left);
|
||||
register_action(cx, Editor::move_right);
|
||||
register_action(cx, Editor::move_down);
|
||||
register_action(cx, Editor::move_up);
|
||||
// on_action(cx, Editor::new_file); todo!()
|
||||
// on_action(cx, Editor::new_file_in_direction); todo!()
|
||||
handle_action(cx, Editor::cancel);
|
||||
handle_action(cx, Editor::newline);
|
||||
handle_action(cx, Editor::newline_above);
|
||||
handle_action(cx, Editor::newline_below);
|
||||
handle_action(cx, Editor::backspace);
|
||||
handle_action(cx, Editor::delete);
|
||||
handle_action(cx, Editor::tab);
|
||||
handle_action(cx, Editor::tab_prev);
|
||||
handle_action(cx, Editor::indent);
|
||||
handle_action(cx, Editor::outdent);
|
||||
handle_action(cx, Editor::delete_line);
|
||||
handle_action(cx, Editor::join_lines);
|
||||
handle_action(cx, Editor::sort_lines_case_sensitive);
|
||||
handle_action(cx, Editor::sort_lines_case_insensitive);
|
||||
handle_action(cx, Editor::reverse_lines);
|
||||
handle_action(cx, Editor::shuffle_lines);
|
||||
handle_action(cx, Editor::convert_to_upper_case);
|
||||
handle_action(cx, Editor::convert_to_lower_case);
|
||||
handle_action(cx, Editor::convert_to_title_case);
|
||||
handle_action(cx, Editor::convert_to_snake_case);
|
||||
handle_action(cx, Editor::convert_to_kebab_case);
|
||||
handle_action(cx, Editor::convert_to_upper_camel_case);
|
||||
handle_action(cx, Editor::convert_to_lower_camel_case);
|
||||
handle_action(cx, Editor::delete_to_previous_word_start);
|
||||
handle_action(cx, Editor::delete_to_previous_subword_start);
|
||||
handle_action(cx, Editor::delete_to_next_word_end);
|
||||
handle_action(cx, Editor::delete_to_next_subword_end);
|
||||
handle_action(cx, Editor::delete_to_beginning_of_line);
|
||||
handle_action(cx, Editor::delete_to_end_of_line);
|
||||
handle_action(cx, Editor::cut_to_end_of_line);
|
||||
handle_action(cx, Editor::duplicate_line);
|
||||
handle_action(cx, Editor::move_line_up);
|
||||
handle_action(cx, Editor::move_line_down);
|
||||
handle_action(cx, Editor::transpose);
|
||||
handle_action(cx, Editor::cut);
|
||||
handle_action(cx, Editor::copy);
|
||||
handle_action(cx, Editor::paste);
|
||||
handle_action(cx, Editor::undo);
|
||||
handle_action(cx, Editor::redo);
|
||||
handle_action(cx, Editor::move_page_up);
|
||||
handle_action(cx, Editor::move_page_down);
|
||||
handle_action(cx, Editor::next_screen);
|
||||
handle_action(cx, Editor::scroll_cursor_top);
|
||||
handle_action(cx, Editor::scroll_cursor_center);
|
||||
handle_action(cx, Editor::scroll_cursor_bottom);
|
||||
handle_action(cx, |editor, _: &LineDown, cx| {
|
||||
register_action(cx, Editor::cancel);
|
||||
register_action(cx, Editor::newline);
|
||||
register_action(cx, Editor::newline_above);
|
||||
register_action(cx, Editor::newline_below);
|
||||
register_action(cx, Editor::backspace);
|
||||
register_action(cx, Editor::delete);
|
||||
register_action(cx, Editor::tab);
|
||||
register_action(cx, Editor::tab_prev);
|
||||
register_action(cx, Editor::indent);
|
||||
register_action(cx, Editor::outdent);
|
||||
register_action(cx, Editor::delete_line);
|
||||
register_action(cx, Editor::join_lines);
|
||||
register_action(cx, Editor::sort_lines_case_sensitive);
|
||||
register_action(cx, Editor::sort_lines_case_insensitive);
|
||||
register_action(cx, Editor::reverse_lines);
|
||||
register_action(cx, Editor::shuffle_lines);
|
||||
register_action(cx, Editor::convert_to_upper_case);
|
||||
register_action(cx, Editor::convert_to_lower_case);
|
||||
register_action(cx, Editor::convert_to_title_case);
|
||||
register_action(cx, Editor::convert_to_snake_case);
|
||||
register_action(cx, Editor::convert_to_kebab_case);
|
||||
register_action(cx, Editor::convert_to_upper_camel_case);
|
||||
register_action(cx, Editor::convert_to_lower_camel_case);
|
||||
register_action(cx, Editor::delete_to_previous_word_start);
|
||||
register_action(cx, Editor::delete_to_previous_subword_start);
|
||||
register_action(cx, Editor::delete_to_next_word_end);
|
||||
register_action(cx, Editor::delete_to_next_subword_end);
|
||||
register_action(cx, Editor::delete_to_beginning_of_line);
|
||||
register_action(cx, Editor::delete_to_end_of_line);
|
||||
register_action(cx, Editor::cut_to_end_of_line);
|
||||
register_action(cx, Editor::duplicate_line);
|
||||
register_action(cx, Editor::move_line_up);
|
||||
register_action(cx, Editor::move_line_down);
|
||||
register_action(cx, Editor::transpose);
|
||||
register_action(cx, Editor::cut);
|
||||
register_action(cx, Editor::copy);
|
||||
register_action(cx, Editor::paste);
|
||||
register_action(cx, Editor::undo);
|
||||
register_action(cx, Editor::redo);
|
||||
register_action(cx, Editor::move_page_up);
|
||||
register_action(cx, Editor::move_page_down);
|
||||
register_action(cx, Editor::next_screen);
|
||||
register_action(cx, Editor::scroll_cursor_top);
|
||||
register_action(cx, Editor::scroll_cursor_center);
|
||||
register_action(cx, Editor::scroll_cursor_bottom);
|
||||
register_action(cx, |editor, _: &LineDown, cx| {
|
||||
editor.scroll_screen(&ScrollAmount::Line(1.), cx)
|
||||
});
|
||||
handle_action(cx, |editor, _: &LineUp, cx| {
|
||||
register_action(cx, |editor, _: &LineUp, cx| {
|
||||
editor.scroll_screen(&ScrollAmount::Line(-1.), cx)
|
||||
});
|
||||
handle_action(cx, |editor, _: &HalfPageDown, cx| {
|
||||
register_action(cx, |editor, _: &HalfPageDown, cx| {
|
||||
editor.scroll_screen(&ScrollAmount::Page(0.5), cx)
|
||||
});
|
||||
handle_action(cx, |editor, _: &HalfPageUp, cx| {
|
||||
register_action(cx, |editor, _: &HalfPageUp, cx| {
|
||||
editor.scroll_screen(&ScrollAmount::Page(-0.5), cx)
|
||||
});
|
||||
handle_action(cx, |editor, _: &PageDown, cx| {
|
||||
register_action(cx, |editor, _: &PageDown, cx| {
|
||||
editor.scroll_screen(&ScrollAmount::Page(1.), cx)
|
||||
});
|
||||
handle_action(cx, |editor, _: &PageUp, cx| {
|
||||
register_action(cx, |editor, _: &PageUp, cx| {
|
||||
editor.scroll_screen(&ScrollAmount::Page(-1.), cx)
|
||||
});
|
||||
handle_action(cx, Editor::move_to_previous_word_start);
|
||||
handle_action(cx, Editor::move_to_previous_subword_start);
|
||||
handle_action(cx, Editor::move_to_next_word_end);
|
||||
handle_action(cx, Editor::move_to_next_subword_end);
|
||||
handle_action(cx, Editor::move_to_beginning_of_line);
|
||||
handle_action(cx, Editor::move_to_end_of_line);
|
||||
handle_action(cx, Editor::move_to_start_of_paragraph);
|
||||
handle_action(cx, Editor::move_to_end_of_paragraph);
|
||||
handle_action(cx, Editor::move_to_beginning);
|
||||
handle_action(cx, Editor::move_to_end);
|
||||
handle_action(cx, Editor::select_up);
|
||||
handle_action(cx, Editor::select_down);
|
||||
handle_action(cx, Editor::select_left);
|
||||
handle_action(cx, Editor::select_right);
|
||||
handle_action(cx, Editor::select_to_previous_word_start);
|
||||
handle_action(cx, Editor::select_to_previous_subword_start);
|
||||
handle_action(cx, Editor::select_to_next_word_end);
|
||||
handle_action(cx, Editor::select_to_next_subword_end);
|
||||
handle_action(cx, Editor::select_to_beginning_of_line);
|
||||
handle_action(cx, Editor::select_to_end_of_line);
|
||||
handle_action(cx, Editor::select_to_start_of_paragraph);
|
||||
handle_action(cx, Editor::select_to_end_of_paragraph);
|
||||
handle_action(cx, Editor::select_to_beginning);
|
||||
handle_action(cx, Editor::select_to_end);
|
||||
handle_action(cx, Editor::select_all);
|
||||
handle_action(cx, |editor, action, cx| {
|
||||
register_action(cx, Editor::move_to_previous_word_start);
|
||||
register_action(cx, Editor::move_to_previous_subword_start);
|
||||
register_action(cx, Editor::move_to_next_word_end);
|
||||
register_action(cx, Editor::move_to_next_subword_end);
|
||||
register_action(cx, Editor::move_to_beginning_of_line);
|
||||
register_action(cx, Editor::move_to_end_of_line);
|
||||
register_action(cx, Editor::move_to_start_of_paragraph);
|
||||
register_action(cx, Editor::move_to_end_of_paragraph);
|
||||
register_action(cx, Editor::move_to_beginning);
|
||||
register_action(cx, Editor::move_to_end);
|
||||
register_action(cx, Editor::select_up);
|
||||
register_action(cx, Editor::select_down);
|
||||
register_action(cx, Editor::select_left);
|
||||
register_action(cx, Editor::select_right);
|
||||
register_action(cx, Editor::select_to_previous_word_start);
|
||||
register_action(cx, Editor::select_to_previous_subword_start);
|
||||
register_action(cx, Editor::select_to_next_word_end);
|
||||
register_action(cx, Editor::select_to_next_subword_end);
|
||||
register_action(cx, Editor::select_to_beginning_of_line);
|
||||
register_action(cx, Editor::select_to_end_of_line);
|
||||
register_action(cx, Editor::select_to_start_of_paragraph);
|
||||
register_action(cx, Editor::select_to_end_of_paragraph);
|
||||
register_action(cx, Editor::select_to_beginning);
|
||||
register_action(cx, Editor::select_to_end);
|
||||
register_action(cx, Editor::select_all);
|
||||
register_action(cx, |editor, action, cx| {
|
||||
editor.select_all_matches(action, cx).log_err();
|
||||
});
|
||||
handle_action(cx, Editor::select_line);
|
||||
handle_action(cx, Editor::split_selection_into_lines);
|
||||
handle_action(cx, Editor::add_selection_above);
|
||||
handle_action(cx, Editor::add_selection_below);
|
||||
handle_action(cx, |editor, action, cx| {
|
||||
register_action(cx, Editor::select_line);
|
||||
register_action(cx, Editor::split_selection_into_lines);
|
||||
register_action(cx, Editor::add_selection_above);
|
||||
register_action(cx, Editor::add_selection_below);
|
||||
register_action(cx, |editor, action, cx| {
|
||||
editor.select_next(action, cx).log_err();
|
||||
});
|
||||
handle_action(cx, |editor, action, cx| {
|
||||
register_action(cx, |editor, action, cx| {
|
||||
editor.select_previous(action, cx).log_err();
|
||||
});
|
||||
handle_action(cx, Editor::toggle_comments);
|
||||
handle_action(cx, Editor::select_larger_syntax_node);
|
||||
handle_action(cx, Editor::select_smaller_syntax_node);
|
||||
handle_action(cx, Editor::move_to_enclosing_bracket);
|
||||
handle_action(cx, Editor::undo_selection);
|
||||
handle_action(cx, Editor::redo_selection);
|
||||
handle_action(cx, Editor::go_to_diagnostic);
|
||||
handle_action(cx, Editor::go_to_prev_diagnostic);
|
||||
handle_action(cx, Editor::go_to_hunk);
|
||||
handle_action(cx, Editor::go_to_prev_hunk);
|
||||
handle_action(cx, Editor::go_to_definition);
|
||||
handle_action(cx, Editor::go_to_definition_split);
|
||||
handle_action(cx, Editor::go_to_type_definition);
|
||||
handle_action(cx, Editor::go_to_type_definition_split);
|
||||
handle_action(cx, Editor::fold);
|
||||
handle_action(cx, Editor::fold_at);
|
||||
handle_action(cx, Editor::unfold_lines);
|
||||
handle_action(cx, Editor::unfold_at);
|
||||
handle_action(cx, Editor::fold_selected_ranges);
|
||||
handle_action(cx, Editor::show_completions);
|
||||
handle_action(cx, Editor::toggle_code_actions);
|
||||
register_action(cx, Editor::toggle_comments);
|
||||
register_action(cx, Editor::select_larger_syntax_node);
|
||||
register_action(cx, Editor::select_smaller_syntax_node);
|
||||
register_action(cx, Editor::move_to_enclosing_bracket);
|
||||
register_action(cx, Editor::undo_selection);
|
||||
register_action(cx, Editor::redo_selection);
|
||||
register_action(cx, Editor::go_to_diagnostic);
|
||||
register_action(cx, Editor::go_to_prev_diagnostic);
|
||||
register_action(cx, Editor::go_to_hunk);
|
||||
register_action(cx, Editor::go_to_prev_hunk);
|
||||
register_action(cx, Editor::go_to_definition);
|
||||
register_action(cx, Editor::go_to_definition_split);
|
||||
register_action(cx, Editor::go_to_type_definition);
|
||||
register_action(cx, Editor::go_to_type_definition_split);
|
||||
register_action(cx, Editor::fold);
|
||||
register_action(cx, Editor::fold_at);
|
||||
register_action(cx, Editor::unfold_lines);
|
||||
register_action(cx, Editor::unfold_at);
|
||||
register_action(cx, Editor::fold_selected_ranges);
|
||||
register_action(cx, Editor::show_completions);
|
||||
register_action(cx, Editor::toggle_code_actions);
|
||||
// on_action(cx, Editor::open_excerpts); todo!()
|
||||
handle_action(cx, Editor::toggle_soft_wrap);
|
||||
handle_action(cx, Editor::toggle_inlay_hints);
|
||||
handle_action(cx, Editor::reveal_in_finder);
|
||||
handle_action(cx, Editor::copy_path);
|
||||
handle_action(cx, Editor::copy_relative_path);
|
||||
handle_action(cx, Editor::copy_highlight_json);
|
||||
handle_action(cx, |editor, action, cx| {
|
||||
register_action(cx, Editor::toggle_soft_wrap);
|
||||
register_action(cx, Editor::toggle_inlay_hints);
|
||||
register_action(cx, Editor::reveal_in_finder);
|
||||
register_action(cx, Editor::copy_path);
|
||||
register_action(cx, Editor::copy_relative_path);
|
||||
register_action(cx, Editor::copy_highlight_json);
|
||||
register_action(cx, |editor, action, cx| {
|
||||
editor
|
||||
.format(action, cx)
|
||||
.map(|task| task.detach_and_log_err(cx));
|
||||
});
|
||||
handle_action(cx, Editor::restart_language_server);
|
||||
handle_action(cx, Editor::show_character_palette);
|
||||
register_action(cx, Editor::restart_language_server);
|
||||
register_action(cx, Editor::show_character_palette);
|
||||
// on_action(cx, Editor::confirm_completion); todo!()
|
||||
handle_action(cx, |editor, action, cx| {
|
||||
register_action(cx, |editor, action, cx| {
|
||||
editor
|
||||
.confirm_code_action(action, cx)
|
||||
.map(|task| task.detach_and_log_err(cx));
|
||||
|
@ -2611,13 +2611,13 @@ impl Element<Editor> for EditorElement {
|
|||
// on_action(cx, Editor::rename); todo!()
|
||||
// on_action(cx, Editor::confirm_rename); todo!()
|
||||
// on_action(cx, Editor::find_all_references); todo!()
|
||||
handle_action(cx, Editor::next_copilot_suggestion);
|
||||
handle_action(cx, Editor::previous_copilot_suggestion);
|
||||
handle_action(cx, Editor::copilot_suggest);
|
||||
handle_action(cx, Editor::context_menu_first);
|
||||
handle_action(cx, Editor::context_menu_prev);
|
||||
handle_action(cx, Editor::context_menu_next);
|
||||
handle_action(cx, Editor::context_menu_last);
|
||||
register_action(cx, Editor::next_copilot_suggestion);
|
||||
register_action(cx, Editor::previous_copilot_suggestion);
|
||||
register_action(cx, Editor::copilot_suggest);
|
||||
register_action(cx, Editor::context_menu_first);
|
||||
register_action(cx, Editor::context_menu_prev);
|
||||
register_action(cx, Editor::context_menu_next);
|
||||
register_action(cx, Editor::context_menu_last);
|
||||
},
|
||||
)
|
||||
});
|
||||
|
@ -4154,7 +4154,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: Pixels) -> f32 {
|
|||
// }
|
||||
// }
|
||||
|
||||
fn handle_action<T: Action>(
|
||||
fn register_action<T: Action>(
|
||||
cx: &mut ViewContext<Editor>,
|
||||
listener: impl Fn(&mut Editor, &T, &mut ViewContext<Editor>) + 'static,
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue