0

I'm working with php classes in Visual Studio Code and would like to augment the syntax highlighting so that static functions in classes have a (slightly) different color than regular functions.

I've tried to achive this using Textmate selectors and a custom user setting like this:

"editor.tokenColorCustomizations" : {
    "textMateRules": [{
        "name": "Highlight static functions",
        "scope": ["meta.function.php storage.modifier.php", "storage.type.function.php"],
        "settings": {
            "foreground": "#FF0000"
        }
    }]
}

But this results in all functions and their modifiers being red: enter image description here

Is there any way I can single out static functions only?

Alex
  • 59,571
  • 22
  • 137
  • 126
jjabba
  • 494
  • 3
  • 16
  • `storage.modifier.static` ? – Barmar Oct 05 '17 at 02:07
  • I've inspected the function keyword in a static declaration using Inspect TM Scopes, but storage.modifier.static is not part of it... – jjabba Oct 05 '17 at 03:24
  • Was just guessing from what I found in the [manual](https://manual.macromates.com/en/language_grammars): **if you are matching the static storage modifier, then instead of just naming it storage.modifier use storage.modifier.static.«language».** – Barmar Oct 05 '17 at 03:28
  • If it's not already parsing that, I think you'll have to write your own grammar rule that matches it. – Barmar Oct 05 '17 at 03:30
  • 3
    You can use the `Developer Tools: Inspect TM Scopes` command from the Command Palette (Ctrl+Shift+P) to inspect the scopes of a token at the cursor and to see which theming rule has been applied. – Alex Oct 05 '17 at 03:42
  • And there is no scope for static keyword, nor static function. – Alex Oct 05 '17 at 03:48

0 Answers0