Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Summary
markdownEditor.toggleMode (the in-tab Preview / Markdown toggle) only works when the active editor is Cursor’s Markdown editor (workbench.editor.markdown). After switching to Markdown (raw), the implementation replaces that editor with the default text editor. The toggle command then has nothing to act on (markdownEditorActive is false; active pane is no longer the Markdown editor), so there is no way to bind a single shortcut that round-trips source → Preview the same way as Preview → source.
Steps to reproduce
- Open any
.mdfile in Cursor’s Markdown editor (with Preview / Markdown pills). - Use Markdown Editor: Toggle Editor Mode (or a keybinding to
markdownEditor.toggleMode) while Preview is selected → switches to Markdown / raw. ✓ - With focus in the raw editor, run the same command again (or use the same keybinding with
when: markdownEditorActiveor without).
Expected
The same action should switch back to Preview (rich mode), or at least the shortcut should remain valid for .md tabs.
Actual
- With
"when": "markdownEditorActive", the shortcut stops matching after step 2 becausemarkdownEditorActivebecomes false. - The command is effectively a no-op / unavailable from the plain text editor, even though it is still the same file.
Notes / suspected cause (for your team)
switchEditorMode appears to use editorService.replaceEditors with options.override set to the default text editor id for RAW and workbench.editor.markdown for RICH. markdownEditor.toggleMode only handles the case activeEditorPane instanceof the Markdown editor pane + MarkdownEditorInput. Once the tab is a normal text editor, that branch never runs, so there is no symmetric path back to rich preview without Reopen Editor With….
Environment
- OS: macOS (darwin 25.x)
- Cursor: [paste About Cursor version + VS Code base version]
Workaround
Reopen Editor With… and choose Cursor’s Markdown editor again; then Preview/Markdown toggle works for Preview → source only until the next time raw mode replaces the editor.
Steps to Reproduce
have a keybinding, for eaxmple:
{
“key”: “alt+cmd+p”,
“command”: “markdownEditor.toggleMode”,
“when”: “markdownEditorActive”
},
and try to toggle markdown preview
Expected Behavior
when in the editor view of markdown file (e.g. README.md) and hotkey pressed - it should switch to preview (same as click on small “Preview” button on top-right corner)
Operating System
MacOS
Version Information
Version: 3.4.17 (Universal)
VSCode Version: 1.105.1
Commit: 93e603f703cd553a6bb3644711a3379bbbb31180
Date: 2026-05-13T21:39:55.724Z (1 day ago)
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.3.0
Does this stop you from using Cursor
No - Cursor works, but with this issue