VS Code Extensions
region-lock

region-lock

by pdcxs

Lock defined regions to make them editable or read-only.

Downloads

4

Rating

— (0)

Version

0.0.3

Last updated

Jul 30, 2026

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"
    },
  ]
}

Related extensions