From a2845bb1f59e5f3d9f41012ace70037b783468ce Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 27 May 2019 14:41:14 +0300 Subject: check cancellation when expanding macros --- crates/ra_hir/src/ids.rs | 1 + crates/ra_lsp_server/tests/heavy_tests/main.rs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 2eb7f0da0..5c3799e95 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs @@ -61,6 +61,7 @@ impl HirFileId { db: &impl DefDatabase, file_id: HirFileId, ) -> Option> { + db.check_canceled(); let _p = profile("parse_or_expand_query"); match file_id.0 { HirFileIdRepr::File(file_id) => Some(db.parse(file_id).syntax().to_owned()), diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index 3c2dc08ed..f61048aaf 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs @@ -365,7 +365,6 @@ fn main() {{}} librs, libs )); server.wait_until_workspace_is_loaded(); - eprintln!("workspace loaded"); for i in 0..10 { server.notification::(DidOpenTextDocumentParams { text_document: TextDocumentItem { @@ -376,7 +375,6 @@ fn main() {{}} }, }); } - eprintln!("docs opened"); let start = std::time::Instant::now(); server.request::( TextDocumentPositionParams { @@ -407,5 +405,6 @@ fn main() {{}} } }), ); - eprintln!("handled: {:?}", start.elapsed()); + let elapsed = start.elapsed(); + assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed); } -- cgit v1.2.3