Change editor tab colour based on user-configured regexes.
I would like to create a Plugin to change the colour of the editor tabs based on user-configured regexes. This would allow coders to highlight tabs which are part of the specific theme / plugin / component they are writing as distinct from those which are part of their framework (Drupal, Magento, Wordpress).
How would the editor tab colour be accessed in an IntelliJ plugin? Where is this documented?
Thank you.
请先登录再写评论。
Hi Dotan. This is not possible at the moment. You can propose a patch for it here: https://github.com/JetBrains/intellij-community
Classes needed to be patched are JBEditorTabsPainter and JBEditorTabsPainter (this one could be an extension point)
Thank you Konstantin. Your mention of JBEditorTabsPainter led me to DefaultEditorTabsPainter, which would probably be a better place to implement the feature as current themes assume that they could simply assign a color without context. When I get a chance I'll play around and if anything good comes out then I'll submit a pull request.
Thank you!
Probably, this task can be solved with a scope-based highlighting:
https://www.jetbrains.com/help/idea/file-colors.html
https://www.jetbrains.com/help/idea/scope.html
Also, you can take a look at com.intellij.openapi.fileEditor.impl.EditorTabColorProvider
There is a plugin extension called EditorTabColor that you can configure to return a color according to specific conditions (ex: file matching a pattern)
It turns out that the feature in question is actually possible with a stock IntelliJ!
Add a Scope for the regex needed, then add a File Color for the Scope. Both options are found in File -> Settings -> Appearance & Behavior on PhpStorm 2017.3 EAP, CentOS 7.3 desktop.
Thank you!