mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Merge #5917
5917: Add a command to open docs for the symbol under the cursor r=matklad a=zacps #### Todo - [ ] Decide if there should be a default keybind or context menu entry - [x] Figure out how to get the documentation path for methods and other non-top-level defs - [x] Design the protocol extension. In future we'll probably want parameters for local/remote documentation URLs, so that should maybe be done in this PR? - [x] Code organisation - [x] Tests Co-authored-by: Zac Pullar-Strecker <zacmps@gmail.com>
This commit is contained in:
commit
518f6d7724
17 changed files with 403 additions and 32 deletions
|
@ -45,8 +45,8 @@ mod status;
|
|||
mod syntax_highlighting;
|
||||
mod syntax_tree;
|
||||
mod typing;
|
||||
mod link_rewrite;
|
||||
mod markdown_remove;
|
||||
mod doc_links;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -384,6 +384,14 @@ impl Analysis {
|
|||
self.with_db(|db| hover::hover(db, position, links_in_hover, markdown))
|
||||
}
|
||||
|
||||
/// Return URL(s) for the documentation of the symbol under the cursor.
|
||||
pub fn external_docs(
|
||||
&self,
|
||||
position: FilePosition,
|
||||
) -> Cancelable<Option<doc_links::DocumentationLink>> {
|
||||
self.with_db(|db| doc_links::external_docs(db, &position))
|
||||
}
|
||||
|
||||
/// Computes parameter information for the given call expression.
|
||||
pub fn call_info(&self, position: FilePosition) -> Cancelable<Option<CallInfo>> {
|
||||
self.with_db(|db| call_info::call_info(db, position))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue