From 70ad9f21b01ff5febfcd32825602859a62a3f4f1 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 9 Dec 2024 16:04:00 +0100 Subject: [PATCH] lsp: Better hover information for images in text only editors Whow the path when the editor can not render the image itself. --- tools/lsp/language/hover.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lsp/language/hover.rs b/tools/lsp/language/hover.rs index 46265c607ac..f10e0f38790 100644 --- a/tools/lsp/language/hover.rs +++ b/tools/lsp/language/hover.rs @@ -44,7 +44,7 @@ pub fn get_tooltip(document_cache: &mut DocumentCache, token: SyntaxToken) -> Op }, TokenInfo::Image(path) => MarkupContent { kind: lsp_types::MarkupKind::Markdown, - value: format!("![Image]({})", path.to_string_lossy()), + value: format!("![{0}]({0})", path.to_string_lossy()), }, // Todo: this can happen when there is some syntax error TokenInfo::LocalProperty(_) | TokenInfo::LocalCallback(_) => return None, @@ -273,7 +273,7 @@ export component Test { uri.join("test.png").unwrap().to_file_path().unwrap().to_string_lossy().to_string(); assert_tooltip( get_tooltip(&mut dc, find_tk("@image-url(", 15.into())), - &format!("![Image]({target_path})"), + &format!("![{target_path}]({target_path})"), ); // enums