diff options
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 43c8bea71..5d8acf9df 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -25,6 +25,7 @@ mod call_info; | |||
25 | mod syntax_highlighting; | 25 | mod syntax_highlighting; |
26 | mod parent_module; | 26 | mod parent_module; |
27 | mod rename; | 27 | mod rename; |
28 | mod impls; | ||
28 | 29 | ||
29 | #[cfg(test)] | 30 | #[cfg(test)] |
30 | mod marks; | 31 | mod marks; |
@@ -58,6 +59,13 @@ pub use ra_ide_api_light::{ | |||
58 | pub use ra_db::{ | 59 | pub use ra_db::{ |
59 | Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId | 60 | Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId |
60 | }; | 61 | }; |
62 | pub use hir::Documentation; | ||
63 | |||
64 | // We use jemalloc mainly to get heap usage statistics, actual performance | ||
65 | // differnece is not measures. | ||
66 | #[cfg(feature = "jemalloc")] | ||
67 | #[global_allocator] | ||
68 | static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; | ||
61 | 69 | ||
62 | pub type Cancelable<T> = Result<T, Canceled>; | 70 | pub type Cancelable<T> = Result<T, Canceled>; |
63 | 71 | ||
@@ -260,7 +268,7 @@ impl<T> RangeInfo<T> { | |||
260 | #[derive(Debug)] | 268 | #[derive(Debug)] |
261 | pub struct CallInfo { | 269 | pub struct CallInfo { |
262 | pub label: String, | 270 | pub label: String, |
263 | pub doc: Option<String>, | 271 | pub doc: Option<Documentation>, |
264 | pub parameters: Vec<String>, | 272 | pub parameters: Vec<String>, |
265 | pub active_parameter: Option<usize>, | 273 | pub active_parameter: Option<usize>, |
266 | } | 274 | } |
@@ -286,6 +294,10 @@ impl AnalysisHost { | |||
286 | self.db.apply_change(change) | 294 | self.db.apply_change(change) |
287 | } | 295 | } |
288 | 296 | ||
297 | pub fn maybe_collect_garbage(&mut self) { | ||
298 | self.db.maybe_collect_garbage(); | ||
299 | } | ||
300 | |||
289 | pub fn collect_garbage(&mut self) { | 301 | pub fn collect_garbage(&mut self) { |
290 | self.db.collect_garbage(); | 302 | self.db.collect_garbage(); |
291 | } | 303 | } |
@@ -405,6 +417,13 @@ impl Analysis { | |||
405 | self.with_db(|db| goto_definition::goto_definition(db, position)) | 417 | self.with_db(|db| goto_definition::goto_definition(db, position)) |
406 | } | 418 | } |
407 | 419 | ||
420 | pub fn goto_implementation( | ||
421 | &self, | ||
422 | position: FilePosition, | ||
423 | ) -> Cancelable<Option<RangeInfo<Vec<NavigationTarget>>>> { | ||
424 | self.with_db(|db| impls::goto_implementation(db, position)) | ||
425 | } | ||
426 | |||
408 | /// Finds all usages of the reference at point. | 427 | /// Finds all usages of the reference at point. |
409 | pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> { | 428 | pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> { |
410 | self.with_db(|db| db.find_all_refs(position)) | 429 | self.with_db(|db| db.find_all_refs(position)) |