dev: join array of hover contents by divider for neovim clients (#157)

* dev: join array of hover contents by divider for neovim client

* dev: update snapshots
This commit is contained in:
Myriad-Dreamin 2024-04-05 12:37:27 +08:00 committed by GitHub
parent 1c5c6bd929
commit 2ba806359a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View file

@ -51,6 +51,21 @@ impl StatefulRequest for HoverRequest {
let ast_node = LinkedNode::new(source.root()).leaf_at(cursor)?;
let range = ctx.to_lsp_range(ast_node.range(), &source);
let contents = match contents {
LspHoverContents::Array(contents) => LspHoverContents::Scalar(MarkedString::String(
contents
.into_iter()
.map(|e| match e {
MarkedString::LanguageString(e) => {
format!("```{}\n{}\n```", e.language, e.value)
}
MarkedString::String(e) => e,
})
.join("\n---\n"),
)),
contents => contents,
};
Some(Hover {
contents,
range: Some(range),