diff options
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r-- | crates/ide/src/lib.rs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 57f3581b6..aaf9b3b4b 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -45,8 +45,8 @@ mod status; | |||
45 | mod syntax_highlighting; | 45 | mod syntax_highlighting; |
46 | mod syntax_tree; | 46 | mod syntax_tree; |
47 | mod typing; | 47 | mod typing; |
48 | mod link_rewrite; | ||
49 | mod markdown_remove; | 48 | mod markdown_remove; |
49 | mod doc_links; | ||
50 | 50 | ||
51 | use std::sync::Arc; | 51 | use std::sync::Arc; |
52 | 52 | ||
@@ -77,7 +77,10 @@ pub use crate::{ | |||
77 | hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, | 77 | hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, |
78 | inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, | 78 | inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, |
79 | markup::Markup, | 79 | markup::Markup, |
80 | references::{Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult}, | 80 | prime_caches::PrimeCachesProgress, |
81 | references::{ | ||
82 | Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, RenameError, | ||
83 | }, | ||
81 | runnables::{Runnable, RunnableKind, TestId}, | 84 | runnables::{Runnable, RunnableKind, TestId}, |
82 | syntax_highlighting::{ | 85 | syntax_highlighting::{ |
83 | Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, | 86 | Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, |
@@ -221,8 +224,11 @@ impl Analysis { | |||
221 | self.with_db(|db| status::status(&*db, file_id)) | 224 | self.with_db(|db| status::status(&*db, file_id)) |
222 | } | 225 | } |
223 | 226 | ||
224 | pub fn prime_caches(&self, files: Vec<FileId>) -> Cancelable<()> { | 227 | pub fn prime_caches<F>(&self, cb: F) -> Cancelable<()> |
225 | self.with_db(|db| prime_caches::prime_caches(db, files)) | 228 | where |
229 | F: Fn(PrimeCachesProgress) + Sync + std::panic::UnwindSafe, | ||
230 | { | ||
231 | self.with_db(move |db| prime_caches::prime_caches(db, &cb)) | ||
226 | } | 232 | } |
227 | 233 | ||
228 | /// Gets the text of the source file. | 234 | /// Gets the text of the source file. |
@@ -382,6 +388,14 @@ impl Analysis { | |||
382 | self.with_db(|db| hover::hover(db, position, links_in_hover, markdown)) | 388 | self.with_db(|db| hover::hover(db, position, links_in_hover, markdown)) |
383 | } | 389 | } |
384 | 390 | ||
391 | /// Return URL(s) for the documentation of the symbol under the cursor. | ||
392 | pub fn external_docs( | ||
393 | &self, | ||
394 | position: FilePosition, | ||
395 | ) -> Cancelable<Option<doc_links::DocumentationLink>> { | ||
396 | self.with_db(|db| doc_links::external_docs(db, &position)) | ||
397 | } | ||
398 | |||
385 | /// Computes parameter information for the given call expression. | 399 | /// Computes parameter information for the given call expression. |
386 | pub fn call_info(&self, position: FilePosition) -> Cancelable<Option<CallInfo>> { | 400 | pub fn call_info(&self, position: FilePosition) -> Cancelable<Option<CallInfo>> { |
387 | self.with_db(|db| call_info::call_info(db, position)) | 401 | self.with_db(|db| call_info::call_info(db, position)) |
@@ -490,7 +504,7 @@ impl Analysis { | |||
490 | &self, | 504 | &self, |
491 | position: FilePosition, | 505 | position: FilePosition, |
492 | new_name: &str, | 506 | new_name: &str, |
493 | ) -> Cancelable<Option<RangeInfo<SourceChange>>> { | 507 | ) -> Cancelable<Result<RangeInfo<SourceChange>, RenameError>> { |
494 | self.with_db(|db| references::rename(db, position, new_name)) | 508 | self.with_db(|db| references::rename(db, position, new_name)) |
495 | } | 509 | } |
496 | 510 | ||