Fix Plaintext textDocument/hover
This commit is contained in:
parent
057558b756
commit
2f862cd6fe
@ -136,6 +136,7 @@ impl LsifManager<'_> {
|
||||
result: lsp_types::Hover {
|
||||
contents: lsp_types::HoverContents::Markup(to_proto::markup_content(
|
||||
hover.markup,
|
||||
ide::HoverDocFormat::Markdown,
|
||||
)),
|
||||
range: None,
|
||||
},
|
||||
|
@ -920,9 +920,14 @@ pub(crate) fn handle_hover(
|
||||
|
||||
let line_index = snap.file_line_index(file_range.file_id)?;
|
||||
let range = to_proto::range(&line_index, info.range);
|
||||
let markup_kind =
|
||||
snap.config.hover().documentation.map_or(ide::HoverDocFormat::Markdown, |kind| kind);
|
||||
let hover = lsp_ext::Hover {
|
||||
hover: lsp_types::Hover {
|
||||
contents: HoverContents::Markup(to_proto::markup_content(info.info.markup)),
|
||||
contents: HoverContents::Markup(to_proto::markup_content(
|
||||
info.info.markup,
|
||||
markup_kind,
|
||||
)),
|
||||
range: Some(range),
|
||||
},
|
||||
actions: if snap.config.hover_actions().none() {
|
||||
|
@ -1202,9 +1202,16 @@ pub(crate) fn reference_title(count: usize) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn markup_content(markup: Markup) -> lsp_types::MarkupContent {
|
||||
pub(crate) fn markup_content(
|
||||
markup: Markup,
|
||||
kind: ide::HoverDocFormat,
|
||||
) -> lsp_types::MarkupContent {
|
||||
let kind = match kind {
|
||||
ide::HoverDocFormat::Markdown => lsp_types::MarkupKind::Markdown,
|
||||
ide::HoverDocFormat::PlainText => lsp_types::MarkupKind::PlainText,
|
||||
};
|
||||
let value = crate::markdown::format_docs(markup.as_str());
|
||||
lsp_types::MarkupContent { kind: lsp_types::MarkupKind::Markdown, value }
|
||||
lsp_types::MarkupContent { kind, value }
|
||||
}
|
||||
|
||||
pub(crate) fn rename_error(err: RenameError) -> crate::LspError {
|
||||
|
Loading…
x
Reference in New Issue
Block a user