Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/fixture.rs')
| -rw-r--r-- | crates/ide/src/fixture.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs index 35c219cadd..700f4dc955 100644 --- a/crates/ide/src/fixture.rs +++ b/crates/ide/src/fixture.rs @@ -1,4 +1,5 @@ //! Utilities for creating `Analysis` instances for tests. +use hir::db::DefDatabase; use ide_db::base_db::fixture::ChangeFixture; use test_utils::{extract_annotations, RangeOrOffset}; @@ -8,6 +9,7 @@ use crate::{Analysis, AnalysisHost, FileId, FilePosition, FileRange}; pub(crate) fn file(ra_fixture: &str) -> (Analysis, FileId) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); + host.db.set_enable_proc_attr_macros(true); host.db.apply_change(change_fixture.change); (host.analysis(), change_fixture.files[0]) } @@ -16,6 +18,7 @@ pub(crate) fn file(ra_fixture: &str) -> (Analysis, FileId) { pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); + host.db.set_enable_proc_attr_macros(true); host.db.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let offset = range_or_offset.expect_offset(); @@ -26,6 +29,7 @@ pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); + host.db.set_enable_proc_attr_macros(true); host.db.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let range = range_or_offset.expect_range(); @@ -36,6 +40,7 @@ pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { pub(crate) fn range_or_position(ra_fixture: &str) -> (Analysis, FileId, RangeOrOffset) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); + host.db.set_enable_proc_attr_macros(true); host.db.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); (host.analysis(), file_id, range_or_offset) @@ -45,6 +50,7 @@ pub(crate) fn range_or_position(ra_fixture: &str) -> (Analysis, FileId, RangeOrO pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(FileRange, String)>) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); + host.db.set_enable_proc_attr_macros(true); host.db.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let offset = range_or_offset.expect_offset(); |