diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_analysis/src/completion/mod.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/db.rs | 8 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/module/mod.rs | 4 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/query_definitions.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 18 | ||||
-rw-r--r-- | crates/ra_analysis/src/symbol_index.rs | 2 |
6 files changed, 18 insertions, 18 deletions
diff --git a/crates/ra_analysis/src/completion/mod.rs b/crates/ra_analysis/src/completion/mod.rs index 67ec9a735..844dabb19 100644 --- a/crates/ra_analysis/src/completion/mod.rs +++ b/crates/ra_analysis/src/completion/mod.rs | |||
@@ -29,7 +29,7 @@ pub(crate) fn completions( | |||
29 | db: &db::RootDatabase, | 29 | db: &db::RootDatabase, |
30 | position: FilePosition, | 30 | position: FilePosition, |
31 | ) -> Cancelable<Option<Vec<CompletionItem>>> { | 31 | ) -> Cancelable<Option<Vec<CompletionItem>>> { |
32 | let original_file = db.file_syntax(position.file_id); | 32 | let original_file = db.source_file(position.file_id); |
33 | // Insert a fake ident to get a valid parse tree | 33 | // Insert a fake ident to get a valid parse tree |
34 | let file = { | 34 | let file = { |
35 | let edit = AtomEdit::insert(position.offset, "intellijRulezz".to_string()); | 35 | let edit = AtomEdit::insert(position.offset, "intellijRulezz".to_string()); |
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs index 0901c2bba..11154cc65 100644 --- a/crates/ra_analysis/src/db.rs +++ b/crates/ra_analysis/src/db.rs | |||
@@ -117,7 +117,7 @@ salsa::database_storage! { | |||
117 | fn crate_graph() for crate::input::CrateGraphQuery; | 117 | fn crate_graph() for crate::input::CrateGraphQuery; |
118 | } | 118 | } |
119 | impl SyntaxDatabase { | 119 | impl SyntaxDatabase { |
120 | fn file_syntax() for FileSyntaxQuery; | 120 | fn source_file() for SourceFileQuery; |
121 | fn file_lines() for FileLinesQuery; | 121 | fn file_lines() for FileLinesQuery; |
122 | } | 122 | } |
123 | impl symbol_index::SymbolsDatabase { | 123 | impl symbol_index::SymbolsDatabase { |
@@ -139,8 +139,8 @@ salsa::database_storage! { | |||
139 | 139 | ||
140 | salsa::query_group! { | 140 | salsa::query_group! { |
141 | pub(crate) trait SyntaxDatabase: crate::input::FilesDatabase + BaseDatabase { | 141 | pub(crate) trait SyntaxDatabase: crate::input::FilesDatabase + BaseDatabase { |
142 | fn file_syntax(file_id: FileId) -> SourceFileNode { | 142 | fn source_file(file_id: FileId) -> SourceFileNode { |
143 | type FileSyntaxQuery; | 143 | type SourceFileQuery; |
144 | } | 144 | } |
145 | fn file_lines(file_id: FileId) -> Arc<LineIndex> { | 145 | fn file_lines(file_id: FileId) -> Arc<LineIndex> { |
146 | type FileLinesQuery; | 146 | type FileLinesQuery; |
@@ -148,7 +148,7 @@ salsa::query_group! { | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | fn file_syntax(db: &impl SyntaxDatabase, file_id: FileId) -> SourceFileNode { | 151 | fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> SourceFileNode { |
152 | let text = db.file_text(file_id); | 152 | let text = db.file_text(file_id); |
153 | SourceFileNode::parse(&*text) | 153 | SourceFileNode::parse(&*text) |
154 | } | 154 | } |
diff --git a/crates/ra_analysis/src/hir/module/mod.rs b/crates/ra_analysis/src/hir/module/mod.rs index a6b7a5466..83f176b32 100644 --- a/crates/ra_analysis/src/hir/module/mod.rs +++ b/crates/ra_analysis/src/hir/module/mod.rs | |||
@@ -49,7 +49,7 @@ impl Module { | |||
49 | db: &impl HirDatabase, | 49 | db: &impl HirDatabase, |
50 | position: FilePosition, | 50 | position: FilePosition, |
51 | ) -> Cancelable<Option<Module>> { | 51 | ) -> Cancelable<Option<Module>> { |
52 | let file = db.file_syntax(position.file_id); | 52 | let file = db.source_file(position.file_id); |
53 | let module_source = match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) | 53 | let module_source = match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) |
54 | { | 54 | { |
55 | Some(m) if !m.has_semi() => ModuleSource::new_inline(db, position.file_id, m), | 55 | Some(m) if !m.has_semi() => ModuleSource::new_inline(db, position.file_id, m), |
@@ -346,7 +346,7 @@ impl ModuleSource { | |||
346 | pub(crate) fn resolve(self, db: &impl HirDatabase) -> ModuleSourceNode { | 346 | pub(crate) fn resolve(self, db: &impl HirDatabase) -> ModuleSourceNode { |
347 | match self { | 347 | match self { |
348 | ModuleSource::SourceFile(file_id) => { | 348 | ModuleSource::SourceFile(file_id) => { |
349 | let syntax = db.file_syntax(file_id); | 349 | let syntax = db.source_file(file_id); |
350 | ModuleSourceNode::SourceFile(syntax.ast().owned()) | 350 | ModuleSourceNode::SourceFile(syntax.ast().owned()) |
351 | } | 351 | } |
352 | ModuleSource::Module(item_id) => { | 352 | ModuleSource::Module(item_id) => { |
diff --git a/crates/ra_analysis/src/hir/query_definitions.rs b/crates/ra_analysis/src/hir/query_definitions.rs index 6c633e9ab..e7fba5d72 100644 --- a/crates/ra_analysis/src/hir/query_definitions.rs +++ b/crates/ra_analysis/src/hir/query_definitions.rs | |||
@@ -38,7 +38,7 @@ pub(super) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { | 40 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { |
41 | let source_file = db.file_syntax(file_id); | 41 | let source_file = db.source_file(file_id); |
42 | let source_file = source_file.borrowed(); | 42 | let source_file = source_file.borrowed(); |
43 | let mut res = SourceFileItems::default(); | 43 | let mut res = SourceFileItems::default(); |
44 | source_file | 44 | source_file |
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index e3b78bb1a..c86bc111a 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -18,7 +18,7 @@ use salsa::{Database, ParallelDatabase}; | |||
18 | 18 | ||
19 | use crate::{ | 19 | use crate::{ |
20 | completion::{completions, CompletionItem}, | 20 | completion::{completions, CompletionItem}, |
21 | db::{self, FileSyntaxQuery, SyntaxDatabase}, | 21 | db::{self, SourceFileQuery, SyntaxDatabase}, |
22 | hir::{ | 22 | hir::{ |
23 | self, | 23 | self, |
24 | FnSignatureInfo, | 24 | FnSignatureInfo, |
@@ -189,7 +189,7 @@ impl fmt::Debug for AnalysisImpl { | |||
189 | 189 | ||
190 | impl AnalysisImpl { | 190 | impl AnalysisImpl { |
191 | pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { | 191 | pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { |
192 | self.db.file_syntax(file_id) | 192 | self.db.source_file(file_id) |
193 | } | 193 | } |
194 | pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> { | 194 | pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> { |
195 | self.db.file_lines(file_id) | 195 | self.db.file_lines(file_id) |
@@ -220,7 +220,7 @@ impl AnalysisImpl { | |||
220 | .collect() | 220 | .collect() |
221 | }; | 221 | }; |
222 | self.db | 222 | self.db |
223 | .query(FileSyntaxQuery) | 223 | .query(SourceFileQuery) |
224 | .sweep(salsa::SweepStrategy::default().discard_values()); | 224 | .sweep(salsa::SweepStrategy::default().discard_values()); |
225 | Ok(query.search(&buf)) | 225 | Ok(query.search(&buf)) |
226 | } | 226 | } |
@@ -270,7 +270,7 @@ impl AnalysisImpl { | |||
270 | &self, | 270 | &self, |
271 | position: FilePosition, | 271 | position: FilePosition, |
272 | ) -> Cancelable<Vec<(FileId, FileSymbol)>> { | 272 | ) -> Cancelable<Vec<(FileId, FileSymbol)>> { |
273 | let file = self.db.file_syntax(position.file_id); | 273 | let file = self.db.source_file(position.file_id); |
274 | let syntax = file.syntax(); | 274 | let syntax = file.syntax(); |
275 | if let Some(name_ref) = find_node_at_offset::<ast::NameRef>(syntax, position.offset) { | 275 | if let Some(name_ref) = find_node_at_offset::<ast::NameRef>(syntax, position.offset) { |
276 | if let Some(fn_descr) = | 276 | if let Some(fn_descr) = |
@@ -322,7 +322,7 @@ impl AnalysisImpl { | |||
322 | } | 322 | } |
323 | 323 | ||
324 | pub fn find_all_refs(&self, position: FilePosition) -> Vec<(FileId, TextRange)> { | 324 | pub fn find_all_refs(&self, position: FilePosition) -> Vec<(FileId, TextRange)> { |
325 | let file = self.db.file_syntax(position.file_id); | 325 | let file = self.db.source_file(position.file_id); |
326 | // Find the binding associated with the offset | 326 | // Find the binding associated with the offset |
327 | let (binding, descr) = match find_binding(&self.db, &file, position) { | 327 | let (binding, descr) = match find_binding(&self.db, &file, position) { |
328 | None => return Vec::new(), | 328 | None => return Vec::new(), |
@@ -365,13 +365,13 @@ impl AnalysisImpl { | |||
365 | file_id: FileId, | 365 | file_id: FileId, |
366 | symbol: FileSymbol, | 366 | symbol: FileSymbol, |
367 | ) -> Cancelable<Option<String>> { | 367 | ) -> Cancelable<Option<String>> { |
368 | let file = self.db.file_syntax(file_id); | 368 | let file = self.db.source_file(file_id); |
369 | 369 | ||
370 | Ok(symbol.docs(&file)) | 370 | Ok(symbol.docs(&file)) |
371 | } | 371 | } |
372 | 372 | ||
373 | pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { | 373 | pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { |
374 | let syntax = self.db.file_syntax(file_id); | 374 | let syntax = self.db.source_file(file_id); |
375 | 375 | ||
376 | let mut res = ra_editor::diagnostics(&syntax) | 376 | let mut res = ra_editor::diagnostics(&syntax) |
377 | .into_iter() | 377 | .into_iter() |
@@ -459,7 +459,7 @@ impl AnalysisImpl { | |||
459 | &self, | 459 | &self, |
460 | position: FilePosition, | 460 | position: FilePosition, |
461 | ) -> Cancelable<Option<(FnSignatureInfo, Option<usize>)>> { | 461 | ) -> Cancelable<Option<(FnSignatureInfo, Option<usize>)>> { |
462 | let file = self.db.file_syntax(position.file_id); | 462 | let file = self.db.source_file(position.file_id); |
463 | let syntax = file.syntax(); | 463 | let syntax = file.syntax(); |
464 | 464 | ||
465 | // Find the calling expression and it's NameRef | 465 | // Find the calling expression and it's NameRef |
@@ -470,7 +470,7 @@ impl AnalysisImpl { | |||
470 | let file_symbols = self.index_resolve(name_ref)?; | 470 | let file_symbols = self.index_resolve(name_ref)?; |
471 | for (fn_file_id, fs) in file_symbols { | 471 | for (fn_file_id, fs) in file_symbols { |
472 | if fs.kind == FN_DEF { | 472 | if fs.kind == FN_DEF { |
473 | let fn_file = self.db.file_syntax(fn_file_id); | 473 | let fn_file = self.db.source_file(fn_file_id); |
474 | if let Some(fn_def) = find_node_at_offset(fn_file.syntax(), fs.node_range.start()) { | 474 | if let Some(fn_def) = find_node_at_offset(fn_file.syntax(), fs.node_range.start()) { |
475 | let descr = hir::Function::guess_from_source(&*self.db, fn_file_id, fn_def); | 475 | let descr = hir::Function::guess_from_source(&*self.db, fn_file_id, fn_def); |
476 | if let Some(descriptor) = descr.signature_info(&*self.db) { | 476 | if let Some(descriptor) = descr.signature_info(&*self.db) { |
diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs index a6937d7f2..747b34e38 100644 --- a/crates/ra_analysis/src/symbol_index.rs +++ b/crates/ra_analysis/src/symbol_index.rs | |||
@@ -32,7 +32,7 @@ salsa::query_group! { | |||
32 | 32 | ||
33 | fn file_symbols(db: &impl SyntaxDatabase, file_id: FileId) -> Cancelable<Arc<SymbolIndex>> { | 33 | fn file_symbols(db: &impl SyntaxDatabase, file_id: FileId) -> Cancelable<Arc<SymbolIndex>> { |
34 | db.check_canceled()?; | 34 | db.check_canceled()?; |
35 | let syntax = db.file_syntax(file_id); | 35 | let syntax = db.source_file(file_id); |
36 | Ok(Arc::new(SymbolIndex::for_file(file_id, syntax))) | 36 | Ok(Arc::new(SymbolIndex::for_file(file_id, syntax))) |
37 | } | 37 | } |
38 | 38 | ||