Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Folder Lock — Read-Only ToggleNew to Visual Studio Code? Get it now.
Folder Lock — Read-Only Toggle

Folder Lock — Read-Only Toggle

Shafiq Nasiree

| (0) | Free
Make every file in your folder view-only with one click, and unlock it again just as fast. Stops accidental edits while you read code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Folder Lock — Read-Only Toggle

Make every file in your folder view-only with one click, and unlock it again just as fast.

You open a project to read it, your keyboard is still active, and one wrong key changes an important file. Folder Lock prevents that. Click 🔒 and every file in the open folder becomes view-only. Click 🔓 and you can edit again. You don't have to lock file by file.

Features

  • One-click lock for the whole folder. Every file, including files you open later, becomes view-only.
  • Three places to click:
    • the status bar, bottom right (🔓 Folder editable / 🔒 Folder locked);
    • the top of the Explorer;
    • the top-right corner of any open file.
  • Keyboard shortcut: Ctrl+Alt+L (Cmd+Alt+L on macOS).
  • Lock a single file: right-click the file's tab → Lock This File, or press Ctrl+Alt+Shift+L. The next folder click clears single-file choices again, so the folder button always decides for every file.
  • Remembered per folder: a locked folder is still locked the next time you open it, and other folders are not affected.
  • Nothing else is blocked: programs, terminals, debugging and Git keep working while the folder is locked.
  • No telemetry, no network access, no dependencies.

How to use

  1. Open a folder (File → Open Folder).
  2. Click 🔓 Folder editable in the status bar. It changes to 🔒 Folder locked.
  3. Open any file: its tab shows a lock, and typing does nothing.
  4. Click 🔒 Folder locked to edit again.

The Command Palette (Ctrl+Shift+P) also has Folder Lock: Lock Folder, Unlock Folder, Toggle Folder Lock, Lock This File and Unlock This File.

Settings

Setting Default What it does
folderLock.showStatusBar true Show the button in the status bar
folderLock.showEditorButton true Show the button in the top-right corner of every file
folderLock.showNotifications true Show a short status-bar message after locking or unlocking

How it works

Folder Lock uses VS Code's own read-only feature, available since VS Code 1.79. Locking adds the pattern "**/*" to the workspace setting files.readonlyInclude, which is saved in the folder's .vscode/settings.json. Unlocking removes that pattern again. Any other read-only patterns you set yourself are kept.

You can lock a folder for everyone who opens it by committing .vscode/settings.json with:

{ "files.readonlyInclude": { "**/*": true } }

Limitations

  • The lock protects files inside VS Code's editor only. Other programs, scripts, terminals and extensions can still change files. It is protection against accidental typing, not a security feature.
  • Locking writes .vscode/settings.json in the open folder. If that file is not writable, Folder Lock shows an error.
  • In a multi-root workspace, the lock applies to the whole workspace.
  • Locking a single file lasts until VS Code is closed (this is how VS Code's own "read-only in session" works).

Requirements

VS Code 1.79 or newer. Works on Windows, macOS and Linux.

Release notes

See the Changelog tab.

License

MIT © 2026 Shafiq Nasiree (see the License tab).

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft