Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Image hover preview shows empty hover window; image never renders (VS Code and Positron)

Offen
#1,122 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
typescript, vscode
Bereich
tooling

Rechercherichtung

Start with apps/vscode/src/providers/hover-image.ts and the hover middleware in apps/vscode/src/lsp/client.ts to trace how the local image path becomes hover content. Compare this with the former implementation in apps/lsp/src/service/providers/hover/hover-image.ts and the size-cap context in hover.ts. Done means a local image reliably renders in the hover popup in VS Code and Positron, with the supported image and URL behavior established.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

vscode

Bug description

Hovering over a Markdown image reference in a .qmd document (e.g. ![](images/plot.png)) opens a small hover popup, but the image itself never renders. The popup is empty:

Image

"Follow link" works correctly, but there is no image hover. Reproduces in both VS Code and Positron with the Quarto extension.

Steps to reproduce

  1. Create a .qmd document containing an image reference to an existing local file, e.g. ![](images/plot.png).
  2. Hover over the image path/reference.
  3. Observe: a hover window appears, but no image is displayed.
  4. Following the link works correctly.

Expected behavior

The hover popup shows a preview of the image.

Actual behavior

A hover window appears, but the image content never loads.

Investigation so far

Image hover is implemented client-side in the extension (apps/vscode/src/providers/hover-image.ts), invoked from the hover middleware in apps/vscode/src/lsp/client.ts. The implementation resolves the local file path correctly, but builds the hover content as raw HTML with a bare filesystem path as the image source:

​ts const content = new MarkdownString( `<img src="${imagePath}" ${widthAttrib}/>` ); content.supportHtml = true; content.isTrusted = true; ​

supportHtml and isTrusted are set, but VS Code's hover Markdown renderer sanitizes HTML and only loads image sources with well-known URI schemes (http(s):, data:, etc.). A bare OS path like /Users/.../plot.png (or C:\... on Windows) is not resolvable, so the popup renders (hence the visible empty hover window) but the image never loads. Note that Uri.file(imagePath) is never used, so even a file:// URI isn't produced.

This is corroborated by the history of this feature. The original server-side implementation (apps/lsp/src/service/providers/hover/hover-image.ts) embedded the image as a base64 data: URI (![](data:image/png;base64,...)), a scheme the hover renderer can load, but it was disabled because of a hover content size cap (~75k), per the comment in apps/lsp/src/service/providers/hover/hover.ts. The client-side replacement avoided the size cap by referencing the file directly, but in doing so appears to have lost the ability for the image to render at all.

Additional related issues noticed while investigating

  • There is no handling of http(s):// image URLs. Remote images silently produce no hover at all (the path is joined onto the document directory, fails fs.existsSync, and returns null).
  • Non-PNG images get no width hint (cosmetic; imageWidth() only handles .png).
  • Workspace-rooted paths only ever resolve against the first workspace folder.

Possible fix directions

  • Inline the image as a data: URI (as the old server-side code did), with size guarding or downscaling to stay under the hover content cap.
  • Convert the path to a scheme the hover sanitizer will load (verify whether file:// via Uri.file().toString() works in current VS Code).
  • Document and confirm the intended behavior and supported image types.
  • Run away from home and live in the woods
Vorherrschende Sprache
TypeScript
Sterne
652
Forks
64
Ø Merge
8 Std. 45 Min.
Gemergte PRs (30 T.)
36

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus quarto-dev/quarto

Alle Issues in quarto-dev/quarto

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.