mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-25 16:09:44 +00:00
Merge pull request #1314 from zed-industries/code-action-with-edit-and-command
Run code action's commands if their edits are empty
This commit is contained in:
commit
5bafabcb8e
1 changed files with 18 additions and 14 deletions
|
@ -3818,16 +3818,20 @@ impl Project {
|
|||
}
|
||||
|
||||
if let Some(edit) = action.lsp_action.edit {
|
||||
Self::deserialize_workspace_edit(
|
||||
this,
|
||||
edit,
|
||||
push_to_history,
|
||||
lsp_adapter.clone(),
|
||||
lang_server.clone(),
|
||||
&mut cx,
|
||||
)
|
||||
.await
|
||||
} else if let Some(command) = action.lsp_action.command {
|
||||
if edit.changes.is_some() || edit.document_changes.is_some() {
|
||||
return Self::deserialize_workspace_edit(
|
||||
this,
|
||||
edit,
|
||||
push_to_history,
|
||||
lsp_adapter.clone(),
|
||||
lang_server.clone(),
|
||||
&mut cx,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(command) = action.lsp_action.command {
|
||||
this.update(&mut cx, |this, _| {
|
||||
this.last_workspace_edits_by_language_server
|
||||
.remove(&lang_server.server_id());
|
||||
|
@ -3839,14 +3843,14 @@ impl Project {
|
|||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
Ok(this.update(&mut cx, |this, _| {
|
||||
return Ok(this.update(&mut cx, |this, _| {
|
||||
this.last_workspace_edits_by_language_server
|
||||
.remove(&lang_server.server_id())
|
||||
.unwrap_or_default()
|
||||
}))
|
||||
} else {
|
||||
Ok(ProjectTransaction::default())
|
||||
}));
|
||||
}
|
||||
|
||||
Ok(ProjectTransaction::default())
|
||||
})
|
||||
} else if let Some(project_id) = self.remote_id() {
|
||||
let client = self.client.clone();
|
||||
|
|
Loading…
Reference in a new issue