Address hover panic and add hint to install go when language server failed to install

This commit is contained in:
Keith Simmons 2022-06-27 15:48:15 -07:00
parent bc82d98ae5
commit a477733bcb
3 changed files with 18 additions and 6 deletions

View file

@ -932,7 +932,9 @@ impl LspCommand for GetHover {
}
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(new_language))) => {
if !current_text.is_empty() {
let text = std::mem::replace(&mut current_text, String::new());
let text = std::mem::replace(&mut current_text, String::new())
.trim()
.to_string();
contents.push(HoverBlock { text, language });
}
@ -948,9 +950,10 @@ impl LspCommand for GetHover {
| Event::End(Tag::BlockQuote)
| Event::HardBreak => {
if !current_text.is_empty() {
let text = std::mem::replace(&mut current_text, String::new());
let text = std::mem::replace(&mut current_text, String::new())
.trim()
.to_string();
contents.push(HoverBlock { text, language });
current_text.clear();
}
language = None;
}
@ -958,7 +961,7 @@ impl LspCommand for GetHover {
}
}
if !current_text.is_empty() {
if !current_text.trim().is_empty() {
contents.push(HoverBlock {
text: current_text,
language,