aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/src/db.rs1
-rw-r--r--crates/ra_analysis/src/imp.rs25
-rw-r--r--crates/ra_analysis/src/lib.rs7
3 files changed, 2 insertions, 31 deletions
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs
index 036e284bf..b072a5eba 100644
--- a/crates/ra_analysis/src/db.rs
+++ b/crates/ra_analysis/src/db.rs
@@ -91,7 +91,6 @@ salsa::database_storage! {
91 fn file_item() for hir::db::FileItemQuery; 91 fn file_item() for hir::db::FileItemQuery;
92 fn input_module_items() for hir::db::InputModuleItemsQuery; 92 fn input_module_items() for hir::db::InputModuleItemsQuery;
93 fn item_map() for hir::db::ItemMapQuery; 93 fn item_map() for hir::db::ItemMapQuery;
94 fn fn_syntax() for hir::db::FnSyntaxQuery;
95 fn submodules() for hir::db::SubmodulesQuery; 94 fn submodules() for hir::db::SubmodulesQuery;
96 fn infer() for hir::db::InferQuery; 95 fn infer() for hir::db::InferQuery;
97 fn type_for_def() for hir::db::TypeForDefQuery; 96 fn type_for_def() for hir::db::TypeForDefQuery;
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 0471a2fca..e6663810d 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -7,10 +7,7 @@ use rayon::prelude::*;
7use salsa::{Database, ParallelDatabase}; 7use salsa::{Database, ParallelDatabase};
8 8
9use hir::{ 9use hir::{
10 self, 10 self, FnSignatureInfo, Problem, source_binder,
11 FnSignatureInfo,
12 Problem,
13 source_binder,
14}; 11};
15use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; 12use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase};
16use ra_editor::{self, FileSymbol, find_node_at_offset, LineIndex, LocalEdit, Severity}; 13use ra_editor::{self, FileSymbol, find_node_at_offset, LineIndex, LocalEdit, Severity};
@@ -123,9 +120,6 @@ impl AnalysisHostImpl {
123 .query(ra_db::SourceFileQuery) 120 .query(ra_db::SourceFileQuery)
124 .sweep(salsa::SweepStrategy::default().discard_values()); 121 .sweep(salsa::SweepStrategy::default().discard_values());
125 self.db 122 self.db
126 .query(hir::db::FnSyntaxQuery)
127 .sweep(salsa::SweepStrategy::default().discard_values());
128 self.db
129 .query(hir::db::SourceFileItemsQuery) 123 .query(hir::db::SourceFileItemsQuery)
130 .sweep(salsa::SweepStrategy::default().discard_values()); 124 .sweep(salsa::SweepStrategy::default().discard_values());
131 self.db 125 self.db
@@ -332,16 +326,6 @@ impl AnalysisImpl {
332 Ok(Some((binding, descr))) 326 Ok(Some((binding, descr)))
333 } 327 }
334 } 328 }
335
336 pub fn doc_comment_for(
337 &self,
338 file_id: FileId,
339 symbol: FileSymbol,
340 ) -> Cancelable<Option<String>> {
341 let file = self.db.source_file(file_id);
342
343 Ok(symbol.docs(&file))
344 }
345 pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable<Option<String>> { 329 pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable<Option<String>> {
346 let file = self.db.source_file(file_id); 330 let file = self.db.source_file(file_id);
347 let result = match (symbol.description(&file), symbol.docs(&file)) { 331 let result = match (symbol.description(&file), symbol.docs(&file)) {
@@ -507,12 +491,7 @@ impl AnalysisImpl {
507 let file = self.db.source_file(file_id); 491 let file = self.db.source_file(file_id);
508 let syntax = file.syntax(); 492 let syntax = file.syntax();
509 let node = find_covering_node(syntax, range); 493 let node = find_covering_node(syntax, range);
510 let parent_fn = node.ancestors().filter_map(FnDef::cast).next(); 494 let parent_fn = ctry!(node.ancestors().find_map(FnDef::cast));
511 let parent_fn = if let Some(p) = parent_fn {
512 p
513 } else {
514 return Ok(None);
515 };
516 let function = ctry!(source_binder::function_from_source( 495 let function = ctry!(source_binder::function_from_source(
517 &*self.db, file_id, parent_fn 496 &*self.db, file_id, parent_fn
518 )?); 497 )?);
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 476d1b438..65c3eb3ec 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -323,13 +323,6 @@ impl Analysis {
323 pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> { 323 pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> {
324 self.imp.find_all_refs(position) 324 self.imp.find_all_refs(position)
325 } 325 }
326 pub fn doc_comment_for(
327 &self,
328 file_id: FileId,
329 symbol: FileSymbol,
330 ) -> Cancelable<Option<String>> {
331 self.imp.doc_comment_for(file_id, symbol)
332 }
333 pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable<Option<String>> { 326 pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable<Option<String>> {
334 self.imp.doc_text_for(file_id, symbol) 327 self.imp.doc_text_for(file_id, symbol)
335 } 328 }