Intra-doc links rustdoc feature is soon to be shipped with the stable rust toolchain: rust-lang/rust#43466
I propose to add a feature for their support in ide.
The simplest and useful thing that I miss is the ability to navigate to the linked symbol definition in the source code.
Suppose we have the following:
/// Blah, .. [`foo`]
pub fn bar() { }
/// You might want to see [`std::fs::read()`] too.
pub fn foo() { }
I suggest that when we hover over [`foo`] symbol in the doc comment we can use goto-declaration/definition and the editor should open the file and the line where the referenced symbol is located, in this case it should be the same file, function foo.
The link in pub fn foo() documentation should also be actionable and direct us to the source code of std::fs::read function.
We might also want to highlight (via semantic tokens) that the given link is an intra-doc link (maybe even preserving the information about the symbol kind (function/variable/struct/trait...)).
The initial implementation of this feature might just use the current path resolving instrumentation of rust-analyzer and this will already be very useful, after that we might also support path disambiguation syntax of intra-doc links, maybe even suggest completions?
Intra-doc links rustdoc feature is soon to be shipped with the stable rust toolchain: rust-lang/rust#43466
I propose to add a feature for their support in ide.
The simplest and useful thing that I miss is the ability to navigate to the linked symbol definition in the source code.
Suppose we have the following:
I suggest that when we hover over
[`foo`]symbol in the doc comment we can usegoto-declaration/definitionand the editor should open the file and the line where the referenced symbol is located, in this case it should be the same file, functionfoo.The link in
pub fn foo()documentation should also be actionable and direct us to the source code ofstd::fs::readfunction.We might also want to highlight (via semantic tokens) that the given link is an intra-doc link (maybe even preserving the information about the symbol kind (function/variable/struct/trait...)).
The initial implementation of this feature might just use the current path resolving instrumentation of rust-analyzer and this will already be very useful, after that we might also support path disambiguation syntax of intra-doc links, maybe even suggest completions?