mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Improve namespace parsing comment
This commit is contained in:
parent
7bd48a63f6
commit
a7a00a87fd
1 changed files with 7 additions and 1 deletions
|
@ -423,6 +423,12 @@ static MACROS: ([&str; 1], [&str; 1]) = (["macro"], ["!"]);
|
||||||
|
|
||||||
impl Namespace {
|
impl Namespace {
|
||||||
/// Extract the specified namespace from an intra-doc-link if one exists.
|
/// Extract the specified namespace from an intra-doc-link if one exists.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// * `struct MyStruct` -> `Namespace::Types`
|
||||||
|
/// * `panic!` -> `Namespace::Macros`
|
||||||
|
/// * `fn@from_intra_spec` -> `Namespace::Values`
|
||||||
fn from_intra_spec(s: &str) -> Option<Self> {
|
fn from_intra_spec(s: &str) -> Option<Self> {
|
||||||
[
|
[
|
||||||
(Namespace::Types, (TYPES.0.iter(), TYPES.1.iter())),
|
(Namespace::Types, (TYPES.0.iter(), TYPES.1.iter())),
|
||||||
|
@ -532,7 +538,7 @@ fn try_resolve_intra(
|
||||||
get_doc_url(db, &krate)?
|
get_doc_url(db, &krate)?
|
||||||
.join(&format!("{}/", krate.display_name(db)?))
|
.join(&format!("{}/", krate.display_name(db)?))
|
||||||
.ok()?
|
.ok()?
|
||||||
.join(&path.segments.iter().map(|name| format!("{}", name)).join("/"))
|
.join(&path.segments.iter().map(|name| name.to_string()).join("/"))
|
||||||
.ok()?
|
.ok()?
|
||||||
.join(&get_symbol_filename(db, &Definition::ModuleDef(def))?)
|
.join(&get_symbol_filename(db, &Definition::ModuleDef(def))?)
|
||||||
.ok()?
|
.ok()?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue