Add restart-lsp keybinding
This commit is contained in:
parent
cc9843c90e
commit
6d91fd078c
5 changed files with 88 additions and 3 deletions
|
@ -141,6 +141,7 @@ action!(ToggleCodeActions, bool);
|
|||
action!(ConfirmCompletion, Option<usize>);
|
||||
action!(ConfirmCodeAction, Option<usize>);
|
||||
action!(OpenExcerpts);
|
||||
action!(RestartLanguageServer);
|
||||
|
||||
enum DocumentHighlightRead {}
|
||||
enum DocumentHighlightWrite {}
|
||||
|
@ -302,6 +303,7 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
Binding::new("ctrl-space", ShowCompletions, Some("Editor")),
|
||||
Binding::new("cmd-.", ToggleCodeActions(false), Some("Editor")),
|
||||
Binding::new("alt-enter", OpenExcerpts, Some("Editor")),
|
||||
Binding::new("cmd-f10", RestartLanguageServer, Some("Editor")),
|
||||
]);
|
||||
|
||||
cx.add_action(Editor::open_new);
|
||||
|
@ -377,6 +379,7 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
cx.add_action(Editor::show_completions);
|
||||
cx.add_action(Editor::toggle_code_actions);
|
||||
cx.add_action(Editor::open_excerpts);
|
||||
cx.add_action(Editor::restart_language_server);
|
||||
cx.add_async_action(Editor::confirm_completion);
|
||||
cx.add_async_action(Editor::confirm_code_action);
|
||||
cx.add_async_action(Editor::rename);
|
||||
|
@ -4867,6 +4870,19 @@ impl Editor {
|
|||
self.pending_rename.as_ref()
|
||||
}
|
||||
|
||||
fn restart_language_server(&mut self, _: &RestartLanguageServer, cx: &mut ViewContext<Self>) {
|
||||
let project = self.project.clone();
|
||||
if let Some(project) = project {
|
||||
self.buffer.update(cx, |multi_buffer, cx| {
|
||||
for buffer in multi_buffer.all_buffers() {
|
||||
project.update(cx, |project, cx| {
|
||||
project.restart_language_server_for_buffer(&buffer, cx);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn refresh_active_diagnostics(&mut self, cx: &mut ViewContext<Editor>) {
|
||||
if let Some(active_diagnostics) = self.active_diagnostics.as_mut() {
|
||||
let buffer = self.buffer.read(cx).snapshot(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue