I recently installed Clear Linux and their default is Atom editor, so I gave it a try. With the php-autocomplete, I was almost very excited. Until I realized I have become set in my ways and I need to have different highlighting for single vs double quote strings.
In php
double quoted strings will still be parsed for $variables
and whitespace escape characters like \n
and \t
; whereas single quoted strings are literal and there is no interpretation between single quotes.
I have developed the habit of always using single quotes for array keys and it disturbed my subconscious to not have the single quoted strings appear different than double quoted strings. I searched quite a bit and couldn't find a solution.
Does anyone know of a way to achieve this highlighting scheme?
The screenshot is from Geany. And even in Geany, getting this setting is not standard. Thankfully, a decade ago, this was normal in their themes so I am able to alter the currently available themes to find and change string_2
to a different color than string_2=string_1
.
To better help people understand php
and how the differences between '
and "
may have importance, here is one way the strings behave differently in context:
$customer = "Bill Hawthorne";
$_address = "123 Main St\nGlendale, CA 91202";
$output = "Dear $customer, please confirm the below address is correct:\n\n$_address\n";
// $output renders as:
// Dear Bill Waltz, please confirm the below address is correct:
//
// 123 Main St
// Glendale, CA 91202
//
$output = 'Dear $customer, please confirm the below address is correct:\n\n$_address\n';
// $output renders as:
// Dear $customer, please confirm the below address is correct:\n\n$_address\n
$variables
interpreted inside of "Injector $inj_label is good" will result inInjector DX is good
, whereas 'Injector $inj_label is good' shows asInjector $inj_label is good
. As far as I can tell, those two rendered outputs are not the same."Injector $inj_label is good"
(your dark purple), and not'Injector $inj_label is good'
which is what matters most to me. I can clearly see if it is parsed or a literal. I'd actually appreciate having what you describe though, it would just help me be more consistent, array keys, etc.php
will interpret inside the double quotes for a comparison. If there is a$string
variable set,'$string' != "$string"
echo 'hello'
in that editor with the different-quote highlighting? I notice that the single quotes seem to be only used for array keys.. I wonder if they have some regex to do$var[]
and highlight the key.. would it still highlight the same if it was double quotes? (as in, is it still yellow with double quotes for array keys)