Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make PhpStorm automatically highlight selection

I cannot find a way to make PhpStorm highlight the appearances of a selected word/string in a file automatically at the time of the selection.

Example - say I have this code (the logic doesn't matter):

$app = new App(); //this is an app var of type "App" that contains our Application
$application_ranks = $app_array['app_rankings'];    //some operation

Now, I make a selection - say I select the first "app" part.

PhpStorm behavior with BrowseWordAtCaret plugin installed (no highlighting whatsoever):

enter image description here

Sublime Text 2 behavior (incomplete):

enter image description here

Notepad++ behavior (close, but still not perfect):

enter image description here

PhpDesigner 8 behavior (works as expected):

enter image description here

To save your time, I am aware of the "Highlight Usages" feature which pretty much does the same thing - the problem though is that this works only for variables/classes/function names/function calls etc, while what I am after is for this to work for ANY selected sequence of characters, regardless if it is a variable or a comment or a function or whatever. Like if you pressed Ctrl+F (Find).

I did try the BrowseWordAtCaret plugin for PhpStorm suggested in this post but it still doesn't provide this functionality.

Is it possible to somehow achieve this? I am quite bewildered that something so simple (and basic - maybe even fundamental for coding in my opinion) is so hard to achieve on an editor this full of capabilities and so much devoted to provide a great user experience etc.

Thanks for your time!

like image 545
pazof Avatar asked Nov 20 '15 14:11

pazof


People also ask

How do I highlight in PHPStorm?

Configure Highlighting First, make sure the Idealog plugin is installed. Then, go to your PHPStorm preferences, then Editor -> Log Highlighting (Idealog). There is a section to display heatmaps or highlight code references - and log formats.

How do I enable highlighting in PyCharm?

From the main menu, choose Edit | Find Usages | Highlight Usages in File, or press Ctrl+Shift+F7 .

How do I remove highlights in PyCharm?

By default, PyCharm highlights all detected code problems. Hover the mouse over the widget in top-right corner of the editor and select another level from the Highlight list: None: turn highlighting off.


1 Answers

Not the perfect solution, yet close enough:

Top Menu -> View -> Highlight Word at Caret

or alternatively:

Settings -> Editor -> General -> Appearance - Highlight Word at Caret

Note that this is a BrowseWordAtCaret plugin option, so it requires the installation of the plugin. To install it, go to Settings -> Plugins -> Browse Repositories -> BrowseWordAtCaret -> Install.

This will still not highlight the word if it's part of another string, but it will highlight it in all other occasions. Example:

PhpStorm:

enter image description here

PhpDesigner:

enter image description here

like image 106
pazof Avatar answered Sep 24 '22 03:09

pazof