mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
check cancellation when expanding macros
This commit is contained in:
parent
0d2f97e83e
commit
a2845bb1f5
2 changed files with 3 additions and 3 deletions
|
@ -61,6 +61,7 @@ impl HirFileId {
|
||||||
db: &impl DefDatabase,
|
db: &impl DefDatabase,
|
||||||
file_id: HirFileId,
|
file_id: HirFileId,
|
||||||
) -> Option<TreeArc<SyntaxNode>> {
|
) -> Option<TreeArc<SyntaxNode>> {
|
||||||
|
db.check_canceled();
|
||||||
let _p = profile("parse_or_expand_query");
|
let _p = profile("parse_or_expand_query");
|
||||||
match file_id.0 {
|
match file_id.0 {
|
||||||
HirFileIdRepr::File(file_id) => Some(db.parse(file_id).syntax().to_owned()),
|
HirFileIdRepr::File(file_id) => Some(db.parse(file_id).syntax().to_owned()),
|
||||||
|
|
|
@ -365,7 +365,6 @@ fn main() {{}}
|
||||||
librs, libs
|
librs, libs
|
||||||
));
|
));
|
||||||
server.wait_until_workspace_is_loaded();
|
server.wait_until_workspace_is_loaded();
|
||||||
eprintln!("workspace loaded");
|
|
||||||
for i in 0..10 {
|
for i in 0..10 {
|
||||||
server.notification::<DidOpenTextDocument>(DidOpenTextDocumentParams {
|
server.notification::<DidOpenTextDocument>(DidOpenTextDocumentParams {
|
||||||
text_document: TextDocumentItem {
|
text_document: TextDocumentItem {
|
||||||
|
@ -376,7 +375,6 @@ fn main() {{}}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
eprintln!("docs opened");
|
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
server.request::<OnEnter>(
|
server.request::<OnEnter>(
|
||||||
TextDocumentPositionParams {
|
TextDocumentPositionParams {
|
||||||
|
@ -407,5 +405,6 @@ fn main() {{}}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
eprintln!("handled: {:?}", start.elapsed());
|
let elapsed = start.elapsed();
|
||||||
|
assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue