postgres_lsp_analysis/
hover.rs1use std::sync::Arc;
2
3use crate::symbols::Symbol;
4
5pub fn hover_for_symbol(symbol: &Arc<Symbol>) -> String {
7 let kind_label = symbol.kind.label();
8 let name = symbol.name.display();
9
10 let mut content = format!("**{kind_label}** `{name}`\n\n");
14 let fence = if symbol.definition_text.contains("```") {
15 "````"
16 } else {
17 "```"
18 };
19 content.push_str(fence);
20 content.push_str("sql\n");
21 content.push_str(&symbol.definition_text);
22 content.push('\n');
23 content.push_str(fence);
24
25 content
26}