microsoft / microsoft/vscode

Files opened read-only by "ReadOnly Include" cannot be made writable via "Reset Active Editor Read-Only In Session"

Open
#332,972 1 comment 0 reactions 1 assignee Claimed by @benibenj View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

If a file has been opened in read-only mode via `ReadOnly Include`, an attempt to unlock it for changes via `Reset Active Editor Read-Only In Session` fails.

Use Case: I do a lot of review and don't want to make inadvertent changes to the files I am reviewing, so I would like to open them _by default_ as read-only. But in the cases where I _do_ decide I want to make changes, I should be able to do so by explicitly unlocking that file interactively while it's open in the editor using the existing mechanism for doing that.

1. Add a file path to `ReadOnly Include` using `/.../**` glob format
2. Open a file under that path
3. File opens as locked Read Only - good
4. Attempt to execute `Reset Active Editor Read-Only In Session` in that tab
5. Editor tab remains locked in read-only, edits rejected - bad

If the user defined paths via `Readonly Include`, the user should have the option to override that _interactively_ on a _case-by-case basis_.

If `Reset Active Editor Read-Only In Session` should _not_ be allowed to globally override files locked by `Readonly Include`, then it would be acceptable to gate this capability either globally (e.g. `[_] Allow Override Of Readonly Include In Editor`) or via a similar list of file paths (i.e. divide `Readonly Include` into `Readonly Include Initial` + `Readonly Include Hard`, or a new `Allow Readonly Unlock In Editor` filepath list to mark which `Readonly Include` folders are by-default vs. hard)

This of course does not apply to files that are read-only due to filesystem permissions that the user cannot override.

VS Code version: Code 1.135.0 (08d4889f9ec4a1685d257b9b95de036c8e1ce1e5, 2026-08-25T14:26:52Z)
OS version: Windows_NT x64 10.0.26200
Modes:

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.