| Crates.io | lsp_doc_stable |
| lib.rs | lsp_doc_stable |
| version | 0.1.0 |
| created_at | 2025-02-25 20:43:49.158371+00 |
| updated_at | 2025-02-25 20:43:49.158371+00 |
| description | Embed markdown/text files into Rust documentation attributes for LSP hover/preview |
| homepage | |
| repository | https://github.com/xenira/lsp_doc_stable/ |
| max_upload_size | |
| id | 1569637 |
| size | 141,937 |
This crate provides an attribute macro to embed any plain-text file (interpreted as markdown) into the Rust documentation for the LSP hover/preview for any editor.
This is a simplified version of the lsp_doc macro from https://github.com/MasterTemple/lsp_doc/ that works with stable Rust.
Using this version the generated #[doc] attribute will always be placed before all other attributes, so it will be shown first in the hover/preview.
Currently you can say either of the following:
/// [](some_file.md)
fn some_func() {}
// or
#[doc = include_str!("../another_file.md")]
fn another_func() {}
However, while these work with cargo doc, neither of these show up in the LSP hover/preview.
See https://github.com/rust-lang/rust-analyzer/issues/11137
This macro resolves that.
Given
*.rs#[lsp_doc("lorem.md")]
#[lsp_doc("table.md")]
fn anything() {}
lorem.mdLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
table.md| Header 1 | Header 2 |
| -------- | -------- |
| Value 1 | Value 2 |
| Value 3 | Value 4 |

