@@ -2,7 +2,9 @@ use crate::{theme::Theme, tree::Tree, Document, DocumentId, RegisterSelection, V
2use tui::layout::Rect;
2use tui::layout::Rect;
3use tui::terminal::CursorKind;
3use tui::terminal::CursorKind;
5+use futures_util::future;
5use std::path::PathBuf;
6use std::path::PathBuf;
7+use std::time::Duration;
7use slotmap::SlotMap;
9use slotmap::SlotMap;
@@ -270,4 +272,22 @@ impl Editor {
270 (None, CursorKind::Hidden)
272 (None, CursorKind::Hidden)
276+ /// Closes language servers with timeout. The default timeout is 500 ms, use
277+ /// `timeout` parameter to override this.
278+ pub async fn close_language_servers(
280+ timeout: Option<u64>,
281+ ) -> Result<(), tokio::time::error::Elapsed> {
282+ tokio::time::timeout(
283+ Duration::from_millis(timeout.unwrap_or(500)),
285+ self.language_servers
287+ .map(|client| client.force_shutdown()),