1
1
//! Utilities for creating `Analysis` instances for tests.
2
- use hir:: db:: DefDatabase ;
3
2
use ide_db:: base_db:: fixture:: ChangeFixture ;
4
3
use test_utils:: { extract_annotations, RangeOrOffset } ;
5
4
@@ -9,7 +8,7 @@ use crate::{Analysis, AnalysisHost, FileId, FilePosition, FileRange};
9
8
pub ( crate ) fn file ( ra_fixture : & str ) -> ( Analysis , FileId ) {
10
9
let mut host = AnalysisHost :: default ( ) ;
11
10
let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
12
- host. db . set_enable_proc_attr_macros ( true ) ;
11
+ host. db . enable_proc_attr_macros ( ) ;
13
12
host. db . apply_change ( change_fixture. change ) ;
14
13
( host. analysis ( ) , change_fixture. files [ 0 ] )
15
14
}
@@ -18,7 +17,7 @@ pub(crate) fn file(ra_fixture: &str) -> (Analysis, FileId) {
18
17
pub ( crate ) fn position ( ra_fixture : & str ) -> ( Analysis , FilePosition ) {
19
18
let mut host = AnalysisHost :: default ( ) ;
20
19
let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
21
- host. db . set_enable_proc_attr_macros ( true ) ;
20
+ host. db . enable_proc_attr_macros ( ) ;
22
21
host. db . apply_change ( change_fixture. change ) ;
23
22
let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
24
23
let offset = range_or_offset. expect_offset ( ) ;
@@ -29,7 +28,7 @@ pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) {
29
28
pub ( crate ) fn range ( ra_fixture : & str ) -> ( Analysis , FileRange ) {
30
29
let mut host = AnalysisHost :: default ( ) ;
31
30
let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
32
- host. db . set_enable_proc_attr_macros ( true ) ;
31
+ host. db . enable_proc_attr_macros ( ) ;
33
32
host. db . apply_change ( change_fixture. change ) ;
34
33
let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
35
34
let range = range_or_offset. expect_range ( ) ;
@@ -40,7 +39,7 @@ pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) {
40
39
pub ( crate ) fn range_or_position ( ra_fixture : & str ) -> ( Analysis , FileId , RangeOrOffset ) {
41
40
let mut host = AnalysisHost :: default ( ) ;
42
41
let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
43
- host. db . set_enable_proc_attr_macros ( true ) ;
42
+ host. db . enable_proc_attr_macros ( ) ;
44
43
host. db . apply_change ( change_fixture. change ) ;
45
44
let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
46
45
( host. analysis ( ) , file_id, range_or_offset)
@@ -50,7 +49,7 @@ pub(crate) fn range_or_position(ra_fixture: &str) -> (Analysis, FileId, RangeOrO
50
49
pub ( crate ) fn annotations ( ra_fixture : & str ) -> ( Analysis , FilePosition , Vec < ( FileRange , String ) > ) {
51
50
let mut host = AnalysisHost :: default ( ) ;
52
51
let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
53
- host. db . set_enable_proc_attr_macros ( true ) ;
52
+ host. db . enable_proc_attr_macros ( ) ;
54
53
host. db . apply_change ( change_fixture. change ) ;
55
54
let ( file_id, range_or_offset) = change_fixture. file_position . expect ( "expected a marker ($0)" ) ;
56
55
let offset = range_or_offset. expect_offset ( ) ;
@@ -71,7 +70,7 @@ pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(Fil
71
70
pub ( crate ) fn annotations_without_marker ( ra_fixture : & str ) -> ( Analysis , Vec < ( FileRange , String ) > ) {
72
71
let mut host = AnalysisHost :: default ( ) ;
73
72
let change_fixture = ChangeFixture :: parse ( ra_fixture) ;
74
- host. db . set_enable_proc_attr_macros ( true ) ;
73
+ host. db . enable_proc_attr_macros ( ) ;
75
74
host. db . apply_change ( change_fixture. change ) ;
76
75
77
76
let annotations = change_fixture
0 commit comments