microsoft / microsoft/vscode

Markdown Editor: expose a command to toggle Editing / Locked mode

Open
#331,423 2 comments 0 reactions 2 assignees Claimed by @hediet View on GitHub
feature-request markdown-editor
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Feature request

Please expose the existing **Editing / Locked** mode toggle in the Markdown Editor (`vscode.markdown.editor`) as a VS Code command that can be assigned in Keyboard Shortcuts / `keybindings.json`.

A default keybinding is not required. A command for toggling the mode of the active Markdown Editor would be enough.

## Motivation

I frequently switch between reading and editing rendered Markdown.

In **Editing** mode, clicking a rendered block reveals its Markdown syntax and can change the document layout. When I am mainly reading or reviewing a document, I prefer **Locked** mode because the rendered view stays stable.

However, switching between Editing and Locked currently requires using the mode toggle in the UI.

The toggle itself can be reached through keyboard focus navigation, but there is no dedicated VS Code command that I can bind directly to a shortcut.

This is also useful in the Agents window, where range-based Agent Feedback is available in Locked mode, so my workflow often becomes:

```text
Editing

Locked

Editing
```

Being able to switch directly from the keyboard would make this workflow much smoother.

## Current behavior

- The Markdown Editor has a UI toggle for Editing / Locked.
- I could not find a dedicated VS Code command for this mode toggle.
- `markdown.preview.toggleLock` controls the existing Markdown Preview and does not toggle the Markdown Editor's Editing / Locked mode.
- `workbench.action.files.toggleActiveEditorReadonlyInSession` controls the file-level read-only state and is separate from the Markdown Editor's Editing / Locked mode.
- #329414 registers Markdown Editor commands as VS Code commands so that their shortcuts can be customized, but the Editing / Locked toggle is not currently exposed as one of these commands.

## Expected behavior

Expose a command that toggles the active Markdown Editor between Editing and Locked mode.

For example (command name only illustrative):

```text
markdown.editor.toggleLocked
```

Users could then assign any keybinding they prefer.

## Related

- #326250 — Markdown Editor Editing / read-only mode UI toggle
- #327538 — Revealing Markdown markers can shift content while editing
- #326539 — Agent Feedback is offered in Locked mode
- #329414 — Markdown Editor commands can now be customized with shortcuts

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.