Markdown editor association is ignored when opening an .md file from Windows Explorer on cold startup
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Not yet tested; the affected editor is provided by the built-in `vscode.markdown-language-features` extension.
- VS Code Version: 1.128.0 (Stable, x64)
- Commit: `fc3def6774c76082adf699d366f31a557ce5573f`
- OS Version: Windows x64, build 10.0.26200
- Built-in Markdown extension: `vscode.markdown-language-features` 10.0.0
- Custom editor ID: `vscode.markdown.preview.editor`
## Description
When Visual Studio Code is not running, opening a `.md` file by double-clicking it in Windows Explorer opens the file in the Text Editor.
The configured `workbench.editorAssociations` setting is ignored.
If VS Code is already running, opening the same `.md` file correctly opens it in the built-in Markdown Preview editor.
## Configuration
```json
{
"workbench.editorAssociations": {
"*.md": "vscode.markdown.preview.editor",
"**/*.md": "vscode.markdown.preview.editor"
}
}
```
## Steps to reproduce
1. Configure `*.md` to use `vscode.markdown.preview.editor`.
2. Close all VS Code windows and make sure all `Code.exe` processes have exited.
3. Double-click an `.md` file in Windows Explorer.
4. The file opens in Text Editor instead of Markdown Preview.
5. Close the file but keep VS Code running.
6. Open the same file again.
7. It now opens correctly in Markdown Preview.
## Expected behavior
The `.md` file should open in Markdown Preview both on cold startup and when VS Code is already running.
## Actual behavior
On cold startup from Windows Explorer it opens in Text Editor. The association only works after VS Code is already running.
## Additional diagnostic information
The saved VS Code window state for a file opened from Windows Explorer records the initial editor request with:
```text
forceFile: true
options.override: "default"
```
When the same file is opened after VS Code is already running, the trace shows activation of:
```text
onCustomEditor:vscode.markdown.preview.editor
```
This may be related to the custom Markdown editor not being registered yet when the initial file is resolved during cold startup. This is an inference from the observed state and trace, not a confirmed root cause.
The Windows per-user shell command is the standard:
```text
"C:\Users\\AppData\Local\Programs\Microsoft VS Code\Code.exe" "%1"
```
No custom launcher or registry workaround is installed.
Contributor guide
Assessment
This issue has not been assessed yet.