Johan Ånäs
Johan Ånäs

Reputation: 175

How to make IntelliJ IDEA display colors for different occurrences in the side bars

When coding java in Eclipse, one can easily edit the right side bar (found in settings under General\Editors\Text Editors\Annotattions) to display colors for different kind of occurrences (such as Text Occurrence, Write Occurrencies and Read Occurrencies).

In IntelliJ IDEA, there seems to be a ruler/gutter-bar on the left side and on the right side we have something called the "Error stripe bar". I seem to be able to make some static colorings, like for example setting "Constructor declaration" green. This way all Constructor declarations are highlighted green in the "Error stripe bar". I can however not find any place on how to just hilight text occurrences, write-/read occurrences, overridings etc.

In Eclipse, it is enough to just put the cursor on a variable and all write and read occurrences are displayed in the right bar (if highlighted). This way it is easy to locate the variable and not including any partial search results (such as finding for "a" would include every and each "a" in the whole text)

EDIT

Highlighting "Search Results" in the error stripe bar is the closest I have come, but is not what I want. In the case of highlighting the search results, I have to perform an extra search, CTRL + F, but this is just a dummy-text-highligter. Also, there are three options:

  1. Search result
  2. Search result (write access)
  3. Text search result

None of these does the trick.

Upvotes: 3

Views: 738

Answers (1)

Johan Ånäs
Johan Ånäs

Reputation: 175

After some extended researching and testing I found a solution.

In order to get dynamical highlighting, close to what Eclipse provides in terms of "Write Occurrences"/"Read Occurrences", go to:

Settings -> Editor -> Color Scheme -> General

Under the Code section, select Identifier under caret and Identifier under caret (write)

I hope this may save some time for new IntelliJ IDEA developers coming from the Eclipse environment.

Upvotes: 3

Related Questions