From b9ffa9dd016cb5ddccaa94064293a0abfb5c1a29 Mon Sep 17 00:00:00 2001 From: hatoo Date: Tue, 12 Sep 2023 20:44:45 +0900 Subject: [PATCH] tweak --- src/main.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4cbbc7e..1a12732 100644 --- a/src/main.rs +++ b/src/main.rs @@ -177,10 +177,12 @@ impl LanguageServer for Backend { .log_message(MessageType::INFO, "file saved!") .await; } - async fn did_close(&self, _: DidCloseTextDocumentParams) { + async fn did_close(&self, param: DidCloseTextDocumentParams) { self.client .log_message(MessageType::INFO, "file closed!") .await; + + self.document_map.remove(¶m.text_document.uri); } async fn semantic_tokens_full( @@ -353,13 +355,13 @@ impl LanguageServer for Backend { } if markdown.is_empty() { - return Ok(None); + Ok(None) + } else { + Ok(Some(Hover { + contents: HoverContents::Scalar(MarkedString::String(markdown)), + range: None, + })) } - - Ok(Some(Hover { - contents: HoverContents::Scalar(MarkedString::String(markdown)), - range: None, - })) } async fn completion(&self, params: CompletionParams) -> Result> {