Visually distinguish auto-generated files?

≡放荡痞女 提交于 2019-12-31 04:03:24

问题


We have a bunch of files that are auto-generated based on the database model. I have had some facepalm experiences because I modified some code, only to find out my modifications where overwritten because I'd not noticed that my changes were in those generated files.

So, I modified our generator to include a "do not modify" comment in the file header. This helps! Although, when tracing method calls, it's easy to end up in the middle of one of these files, and you wouldn't necessarily know unless you scrolled to the top to check for the header. That is awkward (and error-prone).

Is there any way to mark these files, in a similar way that "External Libraries" are marked, so it's clear from styling that these files should be read-only?

(I originally asked this in Software Engineering, but gnat asked me to move it.)


回答1:


From PhpStorm side you can use Scopes and File Colors functionality.

  1. Create custom Scope that would list only such files (will be easier if such files are located in specific folders or have some unique part in file name .. otherwise you will have to point to individual files).

  2. Use File Colors functionality (add your Scope there) and assign unique color.

Now such files will have that color as editor tab background (not editor itself, just editor tab) as well as background in Project View/different search and other file-related popups (optional; can be turned on/off but it will do that for ALL scopes).

This whole procedure/idea has even got own help page: https://www.jetbrains.com/help/phpstorm/2016.3/configuring-scopes-and-file-colors.html?search=scope



来源:https://stackoverflow.com/questions/41932409/visually-distinguish-auto-generated-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!