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:
bors[bot] 2020-10-12 07:38:24 +00:00 committed by GitHub
commit 518f6d7724
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 403 additions and 32 deletions

View file

@ -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))