VSCode - Restrict editing in certain sections

140 views Asked by At

In "Visual Studio" there is a way to make sections of code editable, while other areas can't be typed in. (ASP.net generated lots of code like this)

Is there a way in VSCode to make it where other programmers cannot type outside of an editable section. We have a code generator that makes /* BEGIN_CODE */ and /* END_CODE */ tags...I would like to restrict new developers from editing outside these regions, or at the very least warn them.

Thanks in advance!

1

There are 1 answers

0
0xLogN On

VSCode does not have this functionality and it may be better to make the generator write to a new read-only file. You could also put new developers on a new branch so you can easily fix these issues. AND MAKE THE COMMENTS DESCRIPTIVE! That always helps. E.g.:

/* === THIS IS AUTOMATICALLY GENERATED CODE! ===
     Please do not make any changes to this
   code. It is automatically generated by the
   <tool name> tool in our build process. Editing
   code below the following line may break the
   build!
   === THIS IS AUTOMATICALLY GENERATED CODE! === */
/* BEGIN_CODE */
...
/* END_CODE */
/* === end automatically generated code ===
     You can edit below this line. */