Image hover preview shows empty hover window; image never renders (VS Code and Positron)
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
Bug description
Hovering over a Markdown image reference in a .qmd document (e.g. ) opens a small hover popup, but the image itself never renders. The popup is empty:
"Follow link" works correctly, but there is no image hover. Reproduces in both VS Code and Positron with the Quarto extension.
Steps to reproduce
- Create a
.qmddocument containing an image reference to an existing local file, e.g.. - Hover over the image path/reference.
- Observe: a hover window appears, but no image is displayed.
- 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 (), 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, failsfs.existsSync, and returnsnull). - 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://viaUri.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
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus quarto-dev/quarto
-
VS Code extension: `quarto preview` fails when the file path contains parentheses (path not shell-quoted)Evtl. vergeben @Bondrewd-K hat das vor 3 Tagen übernommen. Offenbug vscode
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
quarto-dev/quarto#1194 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
quarto-dev/quarto#1139 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 90/100
quarto-dev/quarto#1138 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
quarto-dev/quarto#1137 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add dependabot?Evtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
quarto-dev/quarto#1135 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in quarto-dev/quarto
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
anomalyco/opencode#56380 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
BUG | `MCP 服务器` | 全局层行的停用/启用与删除报 404 server row not found,编辑保存会在 profile 层复制出重复行Evtl. vergeben @w6242652 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Chocobozzz/PeerTube#7832 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Pay to use?Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 66/100
darkreader/darkreader#16108 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen