-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
A-hoverhover featurehover featureA-macromacro expansionmacro expansionC-enhancementCategory: enhancementCategory: enhancement
Description
It'd be nice if external documentation could show up in hover tooltips
#[doc = include_str!("MyThing.md")] // doesn't work
#[doc = "this works fine already" ]
struct MyThing;#[doc = include_str!(...)] attributes are currently thrown away here:
https://github.com/rust-analyzer/rust-analyzer/blob/355a4bdb883ee9edc1c32b553fcf91c302b3df19/crates/hir_def/src/attr.rs#L696-L707
Hacking together a new branch is easy enough:
} else if let Some(ast::Expr::MacroCall(call)) = ast.expr() {
if call.path()?.segment()?.name_ref()?.text() == "include_str" {
Some(Interned::new(AttrInput::Literal(SmolStr::new(format!("include_str!(...): {:?}", call)))))
} else {
None
}But I'm having difficulty figuring out how to plumb my way into hir_expand::builtin_fn_macro::include_str_expand, or to figure out the path of the current AST, or figuring out if this is even the right place to be handling this.
ModProg, ilyvion, lelgenio, tonykolomeytsev, peter-lyons-kehl and 25 morerotmh
Metadata
Metadata
Assignees
Labels
A-hoverhover featurehover featureA-macromacro expansionmacro expansionC-enhancementCategory: enhancementCategory: enhancement