aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/imp.rs
diff options
context:
space:
mode:
authorDJMcNab <[email protected]>2018-12-08 16:02:23 +0000
committerAleksey Kladov <[email protected]>2018-12-08 16:28:10 +0000
commitf88e0700e6c4a9b195739154f8683704762df1bd (patch)
treef263d568056f88be01fbd6d4e67f967b71645b60 /crates/ra_analysis/src/imp.rs
parent6d548d944fade78edd474433b2436bae3237737e (diff)
Add a better text for hover and stop duplicating work done in approximatelly_resolve_symbol
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r--crates/ra_analysis/src/imp.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index e9af98474..07357fc84 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -323,6 +323,17 @@ impl AnalysisImpl {
323 323
324 Ok(symbol.docs(&file)) 324 Ok(symbol.docs(&file))
325 } 325 }
326 pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable<Option<String>> {
327 let file = self.db.source_file(file_id);
328 let result = match (symbol.description(&file), symbol.docs(&file)) {
329 (Some(desc), Some(docs)) => Some("```rust\n".to_string() + &*desc + "\n```\n\n" + &*docs),
330 (Some(desc), None) => Some("```rust\n".to_string() + &*desc + "\n```"),
331 (None, Some(docs)) => Some(docs),
332 _ => None,
333 };
334
335 Ok(result)
336 }
326 337
327 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { 338 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
328 let syntax = self.db.source_file(file_id); 339 let syntax = self.db.source_file(file_id);