Skip to content

Commit

Permalink
add timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
matoous committed Mar 31, 2024
1 parent 5390ab7 commit e9c38e7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions helix-lsp/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ use tokio::{
},
};

static DOCUMENT_OPS_TIMEOUT: u64 = 5;

fn workspace_for_uri(uri: lsp::Url) -> WorkspaceFolder {
lsp::WorkspaceFolder {
name: uri
Expand Down Expand Up @@ -759,7 +761,7 @@ impl Client {
}];
let request = self.call_with_timeout::<lsp::request::WillRenameFiles>(
lsp::RenameFilesParams { files },
5,
DOCUMENT_OPS_TIMEOUT,
);

Some(async move {
Expand Down Expand Up @@ -998,11 +1000,13 @@ impl Client {
&self,
text_document: lsp::TextDocumentIdentifier,
) -> Option<impl Future<Output = Result<Vec<lsp::TextEdit>>>> {
let request =
self.call::<lsp::request::WillSaveWaitUntil>(lsp::WillSaveTextDocumentParams {
let request = self.call_with_timeout::<lsp::request::WillSaveWaitUntil>(
lsp::WillSaveTextDocumentParams {
text_document,
reason: TextDocumentSaveReason::MANUAL,
});
},
DOCUMENT_OPS_TIMEOUT,
);

Some(async move {
let json = request.await?;
Expand Down

0 comments on commit e9c38e7

Please sign in to comment.