Skip to content

Commit

Permalink
lsp: Better hover information for images in text only editors
Browse files Browse the repository at this point in the history
Whow the path when the editor can not render the image itself.
  • Loading branch information
hunger committed Dec 9, 2024
1 parent 69d201d commit 70ad9f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/lsp/language/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 70ad9f2

Please sign in to comment.