aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-23 16:53:56 +0100
committerGitHub <[email protected]>2020-06-23 16:53:56 +0100
commit0c12c4f9609ee72487af9b55a558b01af73ffe3e (patch)
tree29be52a980b4cae72f46a48c48135a15e31641e0 /crates/ra_assists/src
parent7aa66371ee3e8b31217513204c8b4f683584419d (diff)
parentdad1333b48c38bc7a5628fc0ff5304d003776a85 (diff)
Merge #4976
4976: New VFS r=matklad a=matklad Still a draft, but mostly working already. Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/tests.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs
index 62dd3547f..55576813f 100644
--- a/crates/ra_assists/src/tests.rs
+++ b/crates/ra_assists/src/tests.rs
@@ -1,10 +1,8 @@
1mod generated; 1mod generated;
2 2
3use std::sync::Arc;
4
5use hir::Semantics; 3use hir::Semantics;
6use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; 4use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
7use ra_ide_db::{symbol_index::SymbolsDatabase, RootDatabase}; 5use ra_ide_db::RootDatabase;
8use ra_syntax::TextRange; 6use ra_syntax::TextRange;
9use test_utils::{ 7use test_utils::{
10 assert_eq_text, extract_offset, extract_range, extract_range_or_offset, RangeOrOffset, 8 assert_eq_text, extract_offset, extract_range, extract_range_or_offset, RangeOrOffset,
@@ -13,11 +11,7 @@ use test_utils::{
13use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists}; 11use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists};
14 12
15pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { 13pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) {
16 let (mut db, file_id) = RootDatabase::with_single_file(text); 14 RootDatabase::with_single_file(text)
17 // FIXME: ideally, this should be done by the above `RootDatabase::with_single_file`,
18 // but it looks like this might need specialization? :(
19 db.set_local_roots(Arc::new(vec![db.file_source_root(file_id)]));
20 (db, file_id)
21} 15}
22 16
23pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) { 17pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) {
@@ -72,8 +66,7 @@ enum ExpectedResult<'a> {
72 66
73fn check(handler: Handler, before: &str, expected: ExpectedResult) { 67fn check(handler: Handler, before: &str, expected: ExpectedResult) {
74 let (text_without_caret, file_with_caret_id, range_or_offset, db) = if before.contains("//-") { 68 let (text_without_caret, file_with_caret_id, range_or_offset, db) = if before.contains("//-") {
75 let (mut db, position) = RootDatabase::with_position(before); 69 let (db, position) = RootDatabase::with_position(before);
76 db.set_local_roots(Arc::new(vec![db.file_source_root(position.file_id)]));
77 ( 70 (
78 db.file_text(position.file_id).as_ref().to_owned(), 71 db.file_text(position.file_id).as_ref().to_owned(),
79 position.file_id, 72 position.file_id,