Reputation: 724
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.)
Upvotes: 1
Views: 83
Reputation: 165178
From PhpStorm side you can use Scopes and File Colors functionality.
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).
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
Upvotes: 1