/// Retrieve a link to documentation for the given symbol.
Retrieve a link to documentation for the given symbol.
Retrieve a link to documentation for the given symbol .
pub(crate) fn external_docs(
    db: &RootDatabase,
    position: &FilePosition,
) -> Option<DocumentationLink> {
    let sema = Semantics::new(db);
    let file = sema.parse(position.file_id).syntax().clone();
    let token = pick_best(file.token_at_offset(position.offset))?;
    let token = sema.descend_into_macros(token);
    let node = token.parent();
    let definition = match_ast! {
        match node {
            ast::NameRef(name_ref) => NameRefClass::classify(&sema, &name_ref).map(|d| d.referenced(sema.db)),
            ast::Name(name) => NameClass::classify(&sema, &name).map(|d| d.referenced_or_defined(sema.db)),
            _ => None,
        }
    };
    get_doc_link(db, definition?)
}
pub ( crate ) fn external_docs ( db : & RootDatabase , position : & FilePosition , ) -> Option < DocumentationLink > { let sema = Semantics :: new ( db ) ; let file = sema . parse ( position . file_id ) . syntax ( ) . clone ( ) ; let token = pick_best ( file . token_at_offset ( position . offset ) ) ? ; let token = sema . descend_into_macros ( token ) ; let node = token . parent ( ) ; let definition = match_ast ! { match node { ast NameRef ( name_ref ) NameRefClass classify ( sema name_ref ) map ( d d referenced ( sema db ) ) ast Name ( name ) NameClass classify ( sema name ) map ( d d referenced_or_defined ( sema db ) ) None } } ; get_doc_link ( db , definition ? ) }
Retrieve a link to documentation for the given symbol.
Retrieve a link to documentation for the given symbol .
db
&RootDatabase
position
&FilePosition