Double-click to select string has different behaviour in php vs javascript
When I double click on string text in javascript or php, the behaviour is different. I tried to find a relevant setting to change that but could not find anything. Is there such a setting?
For example, in php, if I have $array['this-is-an-example'], if I move the mouse cursor over "example" and double-click, only the word "example" is highlighted. However, in javascript, if I have $('#this-is-an-example'), if I move the mouse cursor over "example" and double-click, the entire string "this-is-an-example" is highlighted.
Why the difference and is there a setting to change that?
Thank you.
Please sign in to leave a comment.
Hi there,
$('#this-is-an-example')This looks like jQuery selector usage. The IDE injects CSS language into such a function call to offer code completion etc, which makes #this-is-an-example a CSS identifier.
On another hand, the 'this-is-an-example' string from PHP code is just a plain string.
Normally, when you double click on a CSS identifier, you would want to select the whole thing and not only part of it.
There is an option for that: go to "Settings (Preferences on macOS) | Editor | General | Smart Keys | HTML/CSS" and disable "Select whole CSS identifiers on double click" and try again.
Hello Andriy,
Thank you for your reply. I understand what you're saying about css selectors.
Is there a way to make php select the whole string?
Thanks!
With double click? I do not think so (I do not see such an option). CamelCase words -- yes, but using dash as a separator -- no.
I usually use single/double click and then invoke "Edit | Extend Selection" 1+ more times in a row as needed -- this allows me to select complex words, the whole sentence/paragraph or even a whole function very quickly.