Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>region-lockNew to Visual Studio Code? Get it now.
region-lock

region-lock

pdcxs

|
3 installs
| (0) | Free
Lock defined regions to make them editable or read-only.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Region Lock for Visual Studio Code

Region Lock is a VS Code extension that allows you to make specific regions of your document read-only or restrict editing to inner content based on configurable regular expressions.

Whether you want to protect auto-generated code, lock license headers, or ensure strict template structures, Region Lock automatically intercepts unauthorized edits and provides instant feedback.


Features

  • 🔒 Full Region Protection (read-only): Lock everything between the matching start and end patterns, including the patterns themselves.
  • 🔓 Boundary Locking (editable-inner): Lock only the start and end patterns themselves, allowing users to freely edit the text in between.
  • ⚙️ Configurable Rules: Define custom regular expression pairs per workspace or globally in settings.json.
  • 🎨 Visual Highlighting: Locked areas are subtly highlighted with customizable decorations, making read-only zones easy to spot.
  • ⚡ Toggle on the Fly: Instantly enable or disable region locking via the Command Palette.

Extension Settings

You can define rules in your .vscode/settings.json or Global User Settings under regionLock.rules.

Configuration Example

{
  "regionLock.rules": [
    {
      "start": "<!-- LOCK_START -->",
      "end": "<!-- LOCK_END -->",
      "type": "read-only"
    },
    {
      "start": "<!-- EDIT_START -->",
      "end": "<!-- EDIT_END -->",
      "type": "editable-inner"
    },
  ]
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft