Colorize (PHP) $variables
b-ozcan opened this issue · comments
When using $variable the variable doesn't get a color. In a single line cases it would be ok, but when using in just a little more complex syntax, distinguishing a variable from operators and constants gets hard to read. I know the theme is not intended for PHP, but when this could be implemented, I think PHP would be verry complete too.
Thank you for this lovely theme!
Thanks for your comment!
Unfortunately VSCode cannot distinguish php as
operator as you expected currently.
Try Developer: Inspect TM Scope
feature in VSCode and you can see below results:
They both scoped keyword.operator.logical
so I can't apply color scheme only for as
token.
Maybe you can contribute php grammar here?
https://github.com/Microsoft/vscode/blob/master/extensions/php/syntaxes/php.tmLanguage.json
Luckily, you can change the variable
color at least:
Just add below configuration to your VSCode's settings.json
{
"editor.tokenColorCustomizations": {
"[Darcula]": {
"textMateRules": [
{
"scope": ["variable.other.php"],
"settings": {
"foreground": "#9E7BB0"
}
}
]
}
}
}
I'm not familiar with the theme of phpStorm yet, but if more people say it should be this theme's default color scheme then I'll follow them.
Hi rokoroku,
I wasn't aware of the Developer: Inspect TM Scope
feature within VS Code and the docs aren't very clear about this kind of features as it seems. Thank you for pointing that out for me!
As you've suggested I've added some color customizations to my settings.json using that feature. Now the theme looks even more like my original Darcula theme of PhpStorm v9.
In case if anyone is wondering, this is what I've added:
"editor.fontSize": 12,
"editor.tokenColorCustomizations": {
"[Darcula]": {
"textMateRules": [
{
"scope": ["variable.language"],
"settings": {
"foreground": "#9E7BB0"
}
},
{
"scope": ["variable.other.property"],
"settings": {
"foreground": "#CC8242"
}
},
{
"scope": ["variable.other.php"],
"settings": {
"foreground": "#9E7BB0"
}
},
{
"scope": ["support.variable.property"],
"settings": {
"foreground": "#FFC66D"
}
}
]
}
}
Is there any possibility that we can customize by language too? Something like:
...
{
"scope": ["variable.other.property"],
"language": "javascript"
"settings": {
"foreground": "#9E7BB0"
}
...
@b-ozcan
Try "scope": ["source.js variable.other.property"]
.
You can find the language scope (source.xx
or text.xxx
) via TM inspector too :)
References:
Added in v1.2.1
Say please,
How make global variables (example $_POST) color on VSCode -> #9E7BB0?