Hey guys, I wanted to update my dev environment for PHP 8.1. The only thing I didn't get to work properly is the syntax highlighting. Intelephense correctly shows errors, it's really just the syntax highlighting by VSCode.
New keywords such as enum or readonly are in the same color and style as constant names. And after inspecting the tokens and scope VSCode actually shows that the token name for these keywords is constant. When I style this token myself so they have the same style as for instance class, interface or trait it works, but as you may guessed after that all my constants have the same style as the storage.type token.
Has anyone an idea on how to style these new keywords? I can't be the only one who wants to have them styled properly :D
@fylzero Yup, is set to 8.1, had to do it so Intelephense shows no syntax errors, but its still not highlighted. Did this change fixed the syntax highlighting or just syntax errors?
@dennisprudlo For me the enum highlighting has the Enum reference in blue, :: in red, words in white, arrow -> in red. It seems highlighted enough/doesn't bother me? Maybe it depends on your theme. Not sure. I'm using Monokai Pro.
@fylzero Well the colors depend on the theme which is used. I'm talking more about the general style (for instance structures are italic in my style, but enums aren't, because they are considered a "constant" in VSCodes tokens. And I mean the actual "enum" keyword not the case name.
Try inspecting the tokens: Open a file with an enum inside, open the command palette, run "Developer: Inspect Editor Tokens and Scopes", then click on the "enum" keyword. In the panel displayed what do you see under "foreground"?
@fylzero And that's exactly the issue I try to fix :D In my case "enum" is considered as the token constant instead of support.class, storage.type or something similar. Did you click on the Name of the enum or the keyword? "CommentTypeEnum" seems to be the name.
@fylzero Yep I tried that, still no luck. But does intelephense do the tokenization? I mean intelephense does recognize the enum as a structure with all autocompletion and docblocks, etc. It's really just the style the tokenization.
What does VSCode say, when you click the "enum" keyword not the name. So literally the word "enum"?