From 63953e0b9eed6f05199e936ed16ba5d35b7f5430 Mon Sep 17 00:00:00 2001 From: TheoCorn <68430877+TheoCorn@users.noreply.github.com> Date: Wed, 31 Jul 2024 23:40:00 +0200 Subject: [PATCH] fix :move panic when starting a new language server (#11387) * fix move panic * change location of is initialized check --- helix-view/src/editor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 4249db1d..1708b3b4 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1376,6 +1376,11 @@ impl Editor { } let is_dir = new_path.is_dir(); for ls in self.language_servers.iter_clients() { + // A new language server might have been started in `set_doc_path` and won't + // be initialized yet. Skip the `did_rename` notification for this server. + if !ls.is_initialized() { + continue; + } if let Some(notification) = ls.did_rename(old_path, &new_path, is_dir) { tokio::spawn(notification); };