Open MaulingMonkey opened 2 years ago
Just checking the name is not enough. A different macro called include_str!()
can shadow it I think. You can also re-export it with a different name. There probably is some logic for other builtin macros you can use.
We'll also have trouble finding the file, right? CC #10178
Another addition here, I'm generating some documentation using concat!
in a macro. It is probably thrown away for the same reason.
I have created the lsp_doc crate that provides a workaround for the LSP hover/preview, and it is compatible with the cargo doc
output.
Installation
cargo add lsp_doc
Usage
/// Here is a table:
#[lsp_doc("table.md")]
/// Here is some long piece of text:
#[lsp_doc("lorem.md")]
fn anything() {}
Neovim
VSCode
Hope that helps in the mean time!
It'd be nice if external documentation could show up in hover tooltips
#[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-L707Hacking together a new branch is easy enough:
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.