From fee0624299fe68304da1c6cb4d3a23856237c4fe Mon Sep 17 00:00:00 2001 From: Stanislav Alekseev <43210583+WeetHet@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:39:23 +0200 Subject: [PATCH] Force code actions to be single line (#21409) Addresses #21403 partially. Is consistent with the behaviour in VSCode Before: 391571084-1bef4ef9-b8f5-4c8f-9a32-9c0ab6c91af1 After: Screenshot 2024-12-02 at 18 35 11 Release Notes: - Fixed an issue with multiline code actions' rendering by forcing them to be single line --- crates/editor/src/editor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 69383ceb820deaf3e582d4a089dd4474fcb04cba..2464ce8427161cd532144aa6c8dab8eea812f1ad 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1690,7 +1690,9 @@ impl CodeActionsMenu { }), ) // TASK: It would be good to make lsp_action.title a SharedString to avoid allocating here. - .child(SharedString::from(action.lsp_action.title.clone())) + .child(SharedString::from( + action.lsp_action.title.replace("\n", ""), + )) }) .when_some(action.as_task(), |this, task| { this.on_mouse_down( @@ -1707,7 +1709,7 @@ impl CodeActionsMenu { } }), ) - .child(SharedString::from(task.resolved_label.clone())) + .child(SharedString::from(task.resolved_label.replace("\n", ""))) }) }) .collect()