@@ -231,6 +231,12 @@ impl Component for Completion {
232 // option.documentation
232 // option.documentation
234+ let (view, doc) = cx.editor.current();
237+ .and_then(|scope| scope.strip_prefix("source."))
234 let doc = match &option.documentation {
240 let doc = match &option.documentation {
235 Some(lsp::Documentation::String(contents))
241 Some(lsp::Documentation::String(contents))
236 | Some(lsp::Documentation::MarkupContent(lsp::MarkupContent {
242 | Some(lsp::Documentation::MarkupContent(lsp::MarkupContent {
@@ -239,7 +245,8 @@ impl Component for Completion {
240 // TODO: convert to wrapped text
246 // TODO: convert to wrapped text
241 Markdown::new(format!(
247 Markdown::new(format!(
242− "```rust\n{}\n```\n{}",
248+ "```{}\n{}\n```\n{}",
243 option.detail.as_deref().unwrap_or_default(),
250 option.detail.as_deref().unwrap_or_default(),
244 contents.clone()
251 contents.clone()
@@ -250,7 +257,8 @@ impl Component for Completion {
251 // TODO: set language based on doc scope
258 // TODO: set language based on doc scope
252 Markdown::new(format!(
259 Markdown::new(format!(
253− "```rust\n{}\n```\n{}",
260+ "```{}\n{}\n```\n{}",
254 option.detail.as_deref().unwrap_or_default(),
262 option.detail.as_deref().unwrap_or_default(),
255 contents.clone()
263 contents.clone()
@@ -260,7 +268,8 @@ impl Component for Completion {
261 // TODO: set language based on doc scope
269 // TODO: set language based on doc scope
262 Markdown::new(format!(
270 Markdown::new(format!(
263− "```rust\n{}\n```",
271+ "```{}\n{}\n```",
264 option.detail.as_deref().unwrap_or_default(),
273 option.detail.as_deref().unwrap_or_default(),