Interpolation brace style
Opened this issue · 5 comments
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
I am comming from the VS Code repository, and I have some problems with syntax highlighting. When writing this code:
<?php
$example = "example";
$somevar = "{$example}_{$example}";
echo $somevar;
Most things are highlighted correctly, but the {}
symbols don't look right.
Steps to Reproduce
Copy the above code snippet into an editor using this repository's syntax for highlighting.
Expected behavior:
The braces should be blue like in most other languages.
Actual behavior:
The braces have string color which looks weird.
Braces have punctuation.definition.variable.php
token, which seems to be correct. But themes are using only variable.other.php
(probably variable
) which starts at $
. I could probably extend variable
scope to include braces, especially since " ${example} "
is correctly colored.
You can make temporary fix using:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"string.quoted.double.php punctuation.definition.variable.php",
"string.unquoted.heredoc.php punctuation.definition.variable.php"
],
"settings": {
"foreground": "#9CDCFE"
}
}
]
},
Edit: Extending scope might be problematic with complex syntax like: " {$example->foo()} "
. Which theme are you using?
@blaumeise20 Yes, but I've edited to do this only in strings, and with the correct color (#9CDCFE
) it doesn't matter. Try edited configuration.
Oh, ok, I tried the new configuration, it works better, but still makes the dollar sign blue inside strings (also I want to have that dark blue color like in JS, not the variable color).
but still makes the dollar sign blue inside strings
I don't understand that, shouldn't dollar sign be blue there?
You can make 2 rules, one to make braces colored, second one to restore dollar color:
{
"scope": [
"string.quoted.double.php punctuation.definition.variable.php",
"string.unquoted.heredoc.php punctuation.definition.variable.php"
],
"settings": {
"foreground": "#569CD6"
}
},
{
"scope": [
"string variable punctuation.definition.variable.php",
"string variable punctuation.definition.variable.php"
],
"settings": {
"foreground": "#9CDCFE"
}
},
With Commands
(ctrl+shift+p
) -> Developer: Inspect Editor Tokens and Scopes
you can check names of tokens under the cursor.