mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Pass Documentation up to LSP and add "rust" to our codeblocks there
This commit is contained in:
parent
48d2acb297
commit
b88ba007cc
8 changed files with 103 additions and 89 deletions
|
@ -87,13 +87,6 @@ impl ConvWith for CompletionItem {
|
|||
None
|
||||
};
|
||||
|
||||
let documentation = self.documentation().map(|value| {
|
||||
Documentation::MarkupContent(MarkupContent {
|
||||
kind: MarkupKind::Markdown,
|
||||
value: value.to_string(),
|
||||
})
|
||||
});
|
||||
|
||||
let mut res = lsp_types::CompletionItem {
|
||||
label: self.label().to_string(),
|
||||
detail: self.detail().map(|it| it.to_string()),
|
||||
|
@ -101,7 +94,7 @@ impl ConvWith for CompletionItem {
|
|||
kind: self.kind().map(|it| it.conv()),
|
||||
text_edit: Some(text_edit),
|
||||
additional_text_edits,
|
||||
documentation: documentation,
|
||||
documentation: self.documentation().map(|it| it.conv()),
|
||||
..Default::default()
|
||||
};
|
||||
res.insert_text_format = Some(match self.insert_text_format() {
|
||||
|
@ -160,6 +153,16 @@ impl ConvWith for Range {
|
|||
}
|
||||
}
|
||||
|
||||
impl Conv for ra_ide_api::Documentation {
|
||||
type Output = lsp_types::Documentation;
|
||||
fn conv(self) -> Documentation {
|
||||
Documentation::MarkupContent(MarkupContent {
|
||||
kind: MarkupKind::Markdown,
|
||||
value: crate::markdown::sanitize_markdown(self).into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ConvWith for TextEdit {
|
||||
type Ctx = LineIndex;
|
||||
type Output = Vec<lsp_types::TextEdit>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue