add module hover for primitives
This commit is contained in:
parent
397946438c
commit
eb210bb3b7
@ -528,7 +528,34 @@ fn hover_primitives_module_declaration(
|
|||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
def_path: &str
|
def_path: &str
|
||||||
) -> Option<Hover> {
|
) -> Option<Hover> {
|
||||||
|
let primitive_map = server.srcs.primitive_text.name_to_text.read().unwrap();
|
||||||
|
|
||||||
|
if let Some(text) = primitive_map.get(token_name) {
|
||||||
|
let mut markdowns = Vec::<MarkedString>::new();
|
||||||
|
|
||||||
|
let mut lines: Vec<&str> = text.split_inclusive('\n').collect();
|
||||||
|
|
||||||
|
if lines.len() > 1 {
|
||||||
|
lines.remove(0);
|
||||||
|
lines.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
let profile_markdown = LanguageString {
|
||||||
|
language: "systemverilog".to_string(),
|
||||||
|
value: lines.join("")
|
||||||
|
};
|
||||||
|
|
||||||
|
markdowns.push(MarkedString::LanguageString(profile_markdown));
|
||||||
|
|
||||||
|
let hover = Hover {
|
||||||
|
contents: HoverContents::Array(markdowns),
|
||||||
|
range: None
|
||||||
|
};
|
||||||
|
|
||||||
|
Some(hover)
|
||||||
|
} else {
|
||||||
None
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user