Allow canceling in-progress language server work (e.g. cargo check
) (#13173)
Release Notes: - Added a more detailed message in place of the generic `checking...` messages when Rust-analyzer is running. - Added a rate limit for language server status messages, to reduce noisiness of those updates. - Added a `cancel language server work` action which will cancel long-running language server tasks. --------- Co-authored-by: Richard <richard@zed.dev>
This commit is contained in:
parent
f489c8b79f
commit
7003b0f211
15 changed files with 308 additions and 164 deletions
|
@ -169,6 +169,7 @@ gpui::actions!(
|
|||
AddSelectionBelow,
|
||||
Backspace,
|
||||
Cancel,
|
||||
CancelLanguageServerWork,
|
||||
ConfirmRename,
|
||||
ContextMenuFirst,
|
||||
ContextMenuLast,
|
||||
|
|
|
@ -9494,6 +9494,20 @@ impl Editor {
|
|||
}
|
||||
}
|
||||
|
||||
fn cancel_language_server_work(
|
||||
&mut self,
|
||||
_: &CancelLanguageServerWork,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
if let Some(project) = self.project.clone() {
|
||||
self.buffer.update(cx, |multi_buffer, cx| {
|
||||
project.update(cx, |project, cx| {
|
||||
project.cancel_language_server_work_for_buffers(multi_buffer.all_buffers(), cx);
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn show_character_palette(&mut self, _: &ShowCharacterPalette, cx: &mut ViewContext<Self>) {
|
||||
cx.show_character_palette();
|
||||
}
|
||||
|
|
|
@ -341,6 +341,7 @@ impl EditorElement {
|
|||
}
|
||||
});
|
||||
register_action(view, cx, Editor::restart_language_server);
|
||||
register_action(view, cx, Editor::cancel_language_server_work);
|
||||
register_action(view, cx, Editor::show_character_palette);
|
||||
register_action(view, cx, |editor, action, cx| {
|
||||
if let Some(task) = editor.confirm_completion(action, cx) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue