aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_db/src/lib.rs')
-rw-r--r--crates/ra_db/src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs
index bf567721a..68b9a7143 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -6,6 +6,7 @@ use std::{panic, sync::Arc};
6 6
7use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc}; 7use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc};
8use relative_path::RelativePathBuf; 8use relative_path::RelativePathBuf;
9use ra_prof::profile;
9 10
10pub use ::salsa as salsa; 11pub use ::salsa as salsa;
11pub use crate::{ 12pub use crate::{
@@ -72,6 +73,7 @@ pub trait SourceDatabase: CheckCanceled + std::fmt::Debug {
72 #[salsa::input] 73 #[salsa::input]
73 fn file_text(&self, file_id: FileId) -> Arc<String>; 74 fn file_text(&self, file_id: FileId) -> Arc<String>;
74 // Parses the file into the syntax tree. 75 // Parses the file into the syntax tree.
76 #[salsa::invoke(parse_query)]
75 fn parse(&self, file_id: FileId) -> TreeArc<SourceFile>; 77 fn parse(&self, file_id: FileId) -> TreeArc<SourceFile>;
76 /// Path to a file, relative to the root of its source root. 78 /// Path to a file, relative to the root of its source root.
77 #[salsa::input] 79 #[salsa::input]
@@ -96,7 +98,8 @@ fn source_root_crates(db: &impl SourceDatabase, id: SourceRootId) -> Arc<Vec<Cra
96 Arc::new(res) 98 Arc::new(res)
97} 99}
98 100
99fn parse(db: &impl SourceDatabase, file_id: FileId) -> TreeArc<SourceFile> { 101fn parse_query(db: &impl SourceDatabase, file_id: FileId) -> TreeArc<SourceFile> {
102 let _p = profile("parse_query");
100 let text = db.file_text(file_id); 103 let text = db.file_text(file_id);
101 SourceFile::parse(&*text) 104 SourceFile::parse(&*text)
102} 105}