Crates.io | lsp_doc |
lib.rs | lsp_doc |
version | |
source | src |
created_at | 2024-11-09 17:10:36.753071 |
updated_at | 2024-11-09 17:10:36.753071 |
description | Embed markdown/text files into Rust documentation attributes for LSP hover/preview |
homepage | |
repository | https://github.com/MasterTemple/lsp_doc/ |
max_upload_size | |
id | 1442231 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
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.
This macro resolves that.
Given
*.rs
/// Here is a table:
#[lsp_doc("table.md")]
/// Here is some long piece of text:
#[lsp_doc("lorem.md")]
fn anything() {}
lorem.md
Lorem 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 |