mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Make Analysis api cancellable
This commit is contained in:
parent
a8e37ddbc8
commit
dbbb0beb3e
8 changed files with 107 additions and 87 deletions
|
@ -195,7 +195,7 @@ fn foo() {
|
|||
edit.insert(offset, ".".to_string());
|
||||
let before = edit.finish().apply(&before);
|
||||
let (analysis, file_id) = single_file(&before);
|
||||
if let Some(result) = analysis.on_dot_typed(FilePosition { offset, file_id }) {
|
||||
if let Some(result) = analysis.on_dot_typed(FilePosition { offset, file_id }).unwrap() {
|
||||
assert_eq!(result.source_file_edits.len(), 1);
|
||||
let actual = result.source_file_edits[0].edit.apply(&before);
|
||||
assert_eq_text!(after, &actual);
|
||||
|
@ -377,7 +377,7 @@ fn foo() {
|
|||
fn apply_on_enter(before: &str) -> Option<String> {
|
||||
let (offset, before) = extract_offset(before);
|
||||
let (analysis, file_id) = single_file(&before);
|
||||
let result = analysis.on_enter(FilePosition { offset, file_id })?;
|
||||
let result = analysis.on_enter(FilePosition { offset, file_id }).unwrap()?;
|
||||
|
||||
assert_eq!(result.source_file_edits.len(), 1);
|
||||
let actual = result.source_file_edits[0].edit.apply(&before);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue