Image hover preview shows empty hover window; image never renders (VS Code and Positron)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript, vscode
- 領域
- tooling
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 652
- フォーク
- 64
- 平均マージ
- 8時間 45分
- マージ済み PR(30日)
- 36
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/quarto のほかの issue
-
VS Code extension: `quarto preview` fails when the file path contains parentheses (path not shell-quoted)対応中かも @Bondrewd-K が 1 日前に担当しました。 オープンbug vscode
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/quarto#1194 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
quarto-dev/quarto#1139 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
quarto-dev/quarto#1138 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
quarto-dev/quarto#1137 ·
メンテナーはふだん 1 日以内に返信
-
Add dependabot?再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
quarto-dev/quarto#1135 ·
メンテナーはふだん 1 日以内に返信
quarto-dev/quarto の issue をすべて見る
似ている issue
-
area:ui effort:S enhancement priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
QuantumNous/new-api#7839 ·
メンテナーはふだん 1 日以内に返信
-
good first issue maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
dark-princezz/stellar-hooks#1010 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
interledger/rhyza#352 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信