format in to_proto::markup_content

Signed-off-by: JmPotato <ghzpotato@gmail.com>
This commit is contained in:
JmPotato 2020-08-09 21:33:14 +08:00
parent 8a57afe5a4
commit 3f2bc813d3
2 changed files with 33 additions and 1 deletions

View File

@ -508,6 +508,37 @@ pub fn foo(a: u32, b: u32) -> u32
); );
} }
#[test]
fn hover_shows_fn_doc() {
check(
r#"
/// # Example
/// ```
/// # use std::path::Path;
/// #
/// foo(Path::new("hello, world!"))
/// ```
pub fn foo<|>(_: &Path) {}
fn main() { }
"#,
expect![[r#"
*foo*
```rust
pub fn foo(_: &Path)
```
___
# Example
```
# use std::path::Path;
#
foo(Path::new("hello, world!"))
```
"#]],
);
}
#[test] #[test]
fn hover_shows_struct_field_info() { fn hover_shows_struct_field_info() {
// Hovering over the field when instantiating // Hovering over the field when instantiating

View File

@ -755,7 +755,8 @@ pub(crate) fn runnable(
} }
pub(crate) fn markup_content(markup: Markup) -> lsp_types::MarkupContent { pub(crate) fn markup_content(markup: Markup) -> lsp_types::MarkupContent {
lsp_types::MarkupContent { kind: lsp_types::MarkupKind::Markdown, value: markup.into() } let value = crate::markdown::format_docs(markup.as_str());
lsp_types::MarkupContent { kind: lsp_types::MarkupKind::Markdown, value }
} }
#[cfg(test)] #[cfg(test)]