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:
Max Brunsfeld 2022-07-08 16:58:12 -07:00 committed by GitHub
commit 5bafabcb8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3818,7 +3818,8 @@ impl Project {
}
if let Some(edit) = action.lsp_action.edit {
Self::deserialize_workspace_edit(
if edit.changes.is_some() || edit.document_changes.is_some() {
return Self::deserialize_workspace_edit(
this,
edit,
push_to_history,
@ -3826,8 +3827,11 @@ impl Project {
lang_server.clone(),
&mut cx,
)
.await
} else if let Some(command) = action.lsp_action.command {
.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();