claude-code - 💡(How to fix) Fix [Bug] File links in chat ignore workbench.editorAssociations settings [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51683Fetched 2026-04-22 07:55:40
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

Error Message

[{"error":"Error: 1: Command failed with ERR_STREAM_PREMATURE_CLOSE: code --force --install-extension anthropic.claude-code\nPremature close \n at pA1 (/$bunfs/root/src/entrypoints/cli.js:1575:4045)\n at async uA1 (unknown)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T18:38:58.542Z"}]

Code Example

[{"error":"Error: 1: Command failed with ERR_STREAM_PREMATURE_CLOSE: code --force --install-extension anthropic.claude-code\nPremature close \n    at pA1 (/$bunfs/root/src/entrypoints/cli.js:1575:4045)\n    at async uA1 (unknown)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T18:38:58.542Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Title: Respect workbench.editorAssociations for file links in chat

Request: When clicking a file link in the chat panel, the extension opens files via showTextDocument() which bypasses editor associations. Please switch to vscode.commands.executeCommand('vscode.open', uri) so markdown files open in preview mode (or whatever editor the user has associated) instead of always opening as plain text.

Use case: I have "*.md": "vscode.markdown.preview.editor" in my user settings. It works everywhere except Claude Code chat links.

Environment Info

  • Platform: darwin
  • Terminal: vscode
  • Version: 2.1.110
  • Feedback ID: 7dc4990a-d031-4e65-9a94-4786f6ad1689

Errors

[{"error":"Error: 1: Command failed with ERR_STREAM_PREMATURE_CLOSE: code --force --install-extension anthropic.claude-code\nPremature close \n    at pA1 (/$bunfs/root/src/entrypoints/cli.js:1575:4045)\n    at async uA1 (unknown)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T18:38:58.542Z"}]

extent analysis

TL;DR

Switch to using vscode.commands.executeCommand('vscode.open', uri) to open files, respecting the user's editor associations.

Guidance

  • The current implementation uses showTextDocument() which bypasses editor associations, causing markdown files to open as plain text instead of in preview mode.
  • To fix this, the vscode.commands.executeCommand('vscode.open', uri) command should be used, which respects the user's editor associations.
  • Verify that the user has the correct editor association set in their settings, e.g. "*.md": "vscode.markdown.preview.editor".
  • Test the fix by clicking on a markdown file link in the chat panel and verifying that it opens in the associated editor.

Example

// Instead of this:
vscode.window.showTextDocument(uri);

// Use this:
vscode.commands.executeCommand('vscode.open', uri);

Notes

The provided error message does not seem directly related to the issue described, and may be a separate problem.

Recommendation

Apply workaround: use vscode.commands.executeCommand('vscode.open', uri) to respect editor associations, as this is a more flexible and user-configurable approach.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] File links in chat ignore workbench.editorAssociations settings [2 comments, 2 participants]