[FEATURE] Support Markdown Preview for .md files opened from chat
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When Claude Code generates a .md file and I click the link provided in the chat webview, the file always opens in the raw text editor. This bypasses my VS Code user settings, specifically workbench.editorAssociations (where I have *.md set to vscode.markdown.preview.editor)
I did a bit of digging in the Developer Tools and it looks like the webview frontend intercepts the click on the HTML anchor tag and sends a message to the backend. The extension host then seems to explicitly call vscode.window.showTextDocument(uri, { preview: false }). Because it's hardcoded to open as a text document with preview disabled, it overrides VS Code's native file handling.
Proposed Solution
A potential solution could be using vscode.commands.executeCommand('vscode.open', uri) instead of showTextDocument, which would allow VS Code to naturally apply the user's editorAssociations for Markdown files.
Alternative Solutions
Currently I work around this by opening the link in editor mode and then Ctrl + Shift + V to switch to preview.
Priority
Low - Nice to have
Feature Category
CLI commands and flags
Use Case Example
- Ask Claude Code to generate some sort of Markdown analysis/documentation file
- It will answer providing a link to open the generated file
- By clicking the link, it will open automatically in editor mode
Additional Context
When generating a plan, it will instead open it in preview mode.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗