简体   繁体   English

VSCode - 限制某些部分的编辑

[英]VSCode - Restrict editing in certain sections

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)在“Visual Studio”中,有一种方法可以使部分代码可编辑,而其他区域则不能输入。(ASP.net 生成了很多这样的代码)

Is there a way in VSCode to make it where other programmers cannot type outside of an editable section. VSCode 中是否有一种方法可以使其他程序员无法在可编辑部分之外键入内容。 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.我们有一个代码生成器,可以制作/* BEGIN_CODE *//* END_CODE */标签...我想限制新开发人员在这些区域之外进行编辑,或者至少警告他们。

Thanks in advance!提前致谢!

VSCode does not have this functionality and it may be better to make the generator write to a new read-only file. VSCode 没有这个功能,最好让生成器写入一个新的只读文件。 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.这总是有帮助的。 Eg:例如:

/* === 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. */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM