From 7fd6a41127dc9a60efe703f7d588f8555b8bffc6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 8 Dec 2018 21:18:29 +0300 Subject: Refactor symbol resolve API Introduce ReferenceResolution to avoid nesting to many non-nominal types. --- crates/ra_analysis/tests/tests.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/tests') diff --git a/crates/ra_analysis/tests/tests.rs b/crates/ra_analysis/tests/tests.rs index 05ad687ae..889b568b9 100644 --- a/crates/ra_analysis/tests/tests.rs +++ b/crates/ra_analysis/tests/tests.rs @@ -23,7 +23,10 @@ fn approximate_resolve_works_in_items() { let symbols = analysis.approximately_resolve_symbol(pos).unwrap().unwrap(); assert_eq_dbg( - r#"([23; 26), [(FileId(1), FileSymbol { name: "Foo", node_range: [0; 11), kind: STRUCT_DEF })])"#, + r#"ReferenceResolution { + reference_range: [23; 26), + resolves_to: [(FileId(1), FileSymbol { name: "Foo", node_range: [0; 11), kind: STRUCT_DEF })] + }"#, &symbols, ); } @@ -41,7 +44,10 @@ fn test_resolve_module() { let symbols = analysis.approximately_resolve_symbol(pos).unwrap().unwrap(); assert_eq_dbg( - r#"([4; 7), [(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })])"#, + r#"ReferenceResolution { + reference_range: [4; 7), + resolves_to: [(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })] + }"#, &symbols, ); @@ -56,7 +62,10 @@ fn test_resolve_module() { let symbols = analysis.approximately_resolve_symbol(pos).unwrap().unwrap(); assert_eq_dbg( - r#"([4; 7), [(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })])"#, + r#"ReferenceResolution { + reference_range: [4; 7), + resolves_to: [(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })] + }"#, &symbols, ); } -- cgit v1.2.3