Skip to content

Commit a2845bb

Browse files
committed
check cancellation when expanding macros
1 parent 0d2f97e commit a2845bb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

crates/ra_hir/src/ids.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ impl HirFileId {
6161
db: &impl DefDatabase,
6262
file_id: HirFileId,
6363
) -> Option<TreeArc<SyntaxNode>> {
64+
db.check_canceled();
6465
let _p = profile("parse_or_expand_query");
6566
match file_id.0 {
6667
HirFileIdRepr::File(file_id) => Some(db.parse(file_id).syntax().to_owned()),

crates/ra_lsp_server/tests/heavy_tests/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ fn main() {{}}
365365
librs, libs
366366
));
367367
server.wait_until_workspace_is_loaded();
368-
eprintln!("workspace loaded");
369368
for i in 0..10 {
370369
server.notification::<DidOpenTextDocument>(DidOpenTextDocumentParams {
371370
text_document: TextDocumentItem {
@@ -376,7 +375,6 @@ fn main() {{}}
376375
},
377376
});
378377
}
379-
eprintln!("docs opened");
380378
let start = std::time::Instant::now();
381379
server.request::<OnEnter>(
382380
TextDocumentPositionParams {
@@ -407,5 +405,6 @@ fn main() {{}}
407405
}
408406
}),
409407
);
410-
eprintln!("handled: {:?}", start.elapsed());
408+
let elapsed = start.elapsed();
409+
assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed);
411410
}

0 commit comments

Comments
 (0)