From 12dda5fa1b94cf3f9eff05625ac276839c757e08 Mon Sep 17 00:00:00 2001 From: Ihnat Date: Fri, 23 Aug 2024 20:44:34 +0300 Subject: [PATCH] Add `Format Buffer` action to mouse context menu (#16080) Closes #15891 Release Notes: - Added "Format Buffer" action to the right-click menu within a buffer. --------- Co-authored-by: Marshall Bowers --- crates/editor/src/mouse_context_menu.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rs index 9c8cf85dda78adaf25adc91c2fd2c1c70def75d0..113035c86321bf6acab35424c92e3987093e43c8 100644 --- a/crates/editor/src/mouse_context_menu.rs +++ b/crates/editor/src/mouse_context_menu.rs @@ -1,11 +1,10 @@ use std::ops::Range; -use crate::GoToDeclaration; use crate::{ - selections_collection::SelectionsCollection, Copy, CopyPermalinkToLine, Cut, DisplayPoint, - DisplaySnapshot, Editor, EditorMode, FindAllReferences, GoToDefinition, GoToImplementation, - GoToTypeDefinition, Paste, Rename, RevealInFileManager, SelectMode, ToDisplayPoint, - ToggleCodeActions, + actions::Format, selections_collection::SelectionsCollection, Copy, CopyPermalinkToLine, Cut, + DisplayPoint, DisplaySnapshot, Editor, EditorMode, FindAllReferences, GoToDeclaration, + GoToDefinition, GoToImplementation, GoToTypeDefinition, Paste, Rename, RevealInFileManager, + SelectMode, ToDisplayPoint, ToggleCodeActions, }; use gpui::prelude::FluentBuilder; use gpui::{DismissEvent, Pixels, Point, Subscription, View, ViewContext}; @@ -174,6 +173,7 @@ pub fn deploy_context_menu( deployed_from_indicator: None, }), ) + .action("Format Buffer", Box::new(Format)) .separator() .action("Cut", Box::new(Cut)) .action("Copy", Box::new(Copy))