editor: Add Organize Imports Action (#25793)
Closes #10004 This PR adds support for the organize imports action. Previously, you had to manually configure it in the settings and then use format to run it. Note: Default key binding will be `alt-shift-o` which is similar to VSCode's organize import. Also, because `cmd-shift-o` is taken by outline picker. Todo: - [x] Initial working - [x] Handle remote - [x] Handle multi buffer - [x] Can we make it generic for executing any code action? Release Notes: - Added `editor:OrganizeImports` action to organize imports (sort, remove unused, etc) for supported LSPs. You can trigger it by using the `alt-shift-o` key binding.
This commit is contained in:
parent
e4e758db3a
commit
fad4df5e70
10 changed files with 408 additions and 4 deletions
|
@ -3029,6 +3029,18 @@ impl Project {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn apply_code_action_kind(
|
||||
&self,
|
||||
buffers: HashSet<Entity<Buffer>>,
|
||||
kind: CodeActionKind,
|
||||
push_to_history: bool,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<ProjectTransaction>> {
|
||||
self.lsp_store.update(cx, |lsp_store, cx| {
|
||||
lsp_store.apply_code_action_kind(buffers, kind, push_to_history, cx)
|
||||
})
|
||||
}
|
||||
|
||||
fn prepare_rename_impl(
|
||||
&mut self,
|
||||
buffer: Entity<Buffer>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue