|
|
@ -231,6 +231,12 @@ impl Component for Completion {
|
|
|
|
// ---
|
|
|
|
// ---
|
|
|
|
// option.documentation
|
|
|
|
// option.documentation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let (view, doc) = cx.editor.current();
|
|
|
|
|
|
|
|
let language = doc
|
|
|
|
|
|
|
|
.language()
|
|
|
|
|
|
|
|
.and_then(|scope| scope.strip_prefix("source."))
|
|
|
|
|
|
|
|
.unwrap_or("");
|
|
|
|
|
|
|
|
|
|
|
|
let doc = match &option.documentation {
|
|
|
|
let doc = match &option.documentation {
|
|
|
|
Some(lsp::Documentation::String(contents))
|
|
|
|
Some(lsp::Documentation::String(contents))
|
|
|
|
| Some(lsp::Documentation::MarkupContent(lsp::MarkupContent {
|
|
|
|
| Some(lsp::Documentation::MarkupContent(lsp::MarkupContent {
|
|
|
@ -239,7 +245,8 @@ impl Component for Completion {
|
|
|
|
})) => {
|
|
|
|
})) => {
|
|
|
|
// TODO: convert to wrapped text
|
|
|
|
// TODO: convert to wrapped text
|
|
|
|
Markdown::new(format!(
|
|
|
|
Markdown::new(format!(
|
|
|
|
"```rust\n{}\n```\n{}",
|
|
|
|
"```{}\n{}\n```\n{}",
|
|
|
|
|
|
|
|
language,
|
|
|
|
option.detail.as_deref().unwrap_or_default(),
|
|
|
|
option.detail.as_deref().unwrap_or_default(),
|
|
|
|
contents.clone()
|
|
|
|
contents.clone()
|
|
|
|
))
|
|
|
|
))
|
|
|
@ -250,7 +257,8 @@ impl Component for Completion {
|
|
|
|
})) => {
|
|
|
|
})) => {
|
|
|
|
// TODO: set language based on doc scope
|
|
|
|
// TODO: set language based on doc scope
|
|
|
|
Markdown::new(format!(
|
|
|
|
Markdown::new(format!(
|
|
|
|
"```rust\n{}\n```\n{}",
|
|
|
|
"```{}\n{}\n```\n{}",
|
|
|
|
|
|
|
|
language,
|
|
|
|
option.detail.as_deref().unwrap_or_default(),
|
|
|
|
option.detail.as_deref().unwrap_or_default(),
|
|
|
|
contents.clone()
|
|
|
|
contents.clone()
|
|
|
|
))
|
|
|
|
))
|
|
|
@ -260,7 +268,8 @@ impl Component for Completion {
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: set language based on doc scope
|
|
|
|
// TODO: set language based on doc scope
|
|
|
|
Markdown::new(format!(
|
|
|
|
Markdown::new(format!(
|
|
|
|
"```rust\n{}\n```",
|
|
|
|
"```{}\n{}\n```",
|
|
|
|
|
|
|
|
language,
|
|
|
|
option.detail.as_deref().unwrap_or_default(),
|
|
|
|
option.detail.as_deref().unwrap_or_default(),
|
|
|
|
))
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|