My employer wants me to use IntelliJ for Java development. Previously, I've always used eclipse.
One of my favorite features in eclipse was being able to click on a variable, method parameter, class field, etc and see the usage of those variables highlighted throughout the class.
Is there a way to enable this feature in IntelliJ IDEA? I'm using Ultimate version 9.0.3.
File | Settings (Preferences on Mac) | Editor | General | Highlight usages of element at caret.
I think Intellij does not do this by default for a reason.
If you click in a symbol on your code, you can hit Ctrl+Shift+F7, then it will highlight (High visible, not just like the default underline) all occurences of the symbol. Good thing is, if you move out the cursor of that symbol, it will keep it highlighted wherever you go.
Tip: You can highlight how many different symbols you want at the same time.
Tip 2: F3 / Shift + F3 goes to the next / previous occurence respectively.
Go into Settings->IDE Settings->Editor->Color and Fonts->General
Make a copy of Dracula to something like MyOwnDracula (can't change the built in schema).
Find whatever you need to change, in this case it's "Identifier under caret" and change the colors for foreground and background to your liking.
Even though this is a question on how to highlight all variables, point one and two will answer that meanwhile point 3 will make you more productive and rename all variables simultaneously if you so choose to do so.
With your cursor on an occurence.
Do Ctrl+Shift+F7 to select all other occurrences.
Then Shift + F6 to rename all occurences simultaneously.
Related
I'm in the process of switching (with some specific PHP production context) from Sublime Text(4x) to PhpStorm (2022.2).
I am of course trying to migrate as many features/habits as possible, as identical as possible to my new environment. Many things I have managed to do but I have a showstopper when it comes to using/keymapping the Home-/Pos1-Button as I was used to.
What I want:
Being somewhere in a line of (PHP) code I want to press the Home-/Pos1-Button to immediately get to the (really) first character(0) of the line which is the widespread default behaviour of that key.
What I get (problem):
When I hit that button once PhpStorm IDE moves the caret to the beginning of the first word/non-whitespace character of the current line and I need to hit the key again to really get to the beginning of the line. I have tried a couple of things but I get the feeling this is "intended" non-configurable behaviour...
Any help would be greatly appreciated.
I tried googling and configuring Settings > Editor > Keymap in many ways but did not succeed...
Go to Settings (Preferences on macOS) | Editor | General | Smart Keys | Home moves caret to first non-whitespace character -> disable.
I'm having a weird problem in pycharm that I can't seem to work out.
Using the Darcula theme, I'm seeing some odd highlighting as seen in the below image
Any idea what it is? I'm thinking I must have accidentally turned on some obscure tool, but I can't spot any rhyme or reason.
For whatever reason / somehow you have injected custom language (HTML?) into DIV (?) tags (the green background).
Settings (Preferences on Mac) | Editor | Language Injections -- find and delete offending rule. It should have "Project" or "Global" in most right column (Scope) -- do not touch "Bundled" ones.
Alternatively -- Alt + Enter while having caret inside problematic place and choose "Uninject xxx" from popup menu. This will only disable that rule (which is still enough to make it work as before) .. but you better delete such wrong rule at some point later.
I have 2 vertical splits and I would like to move a file from one split to another using the keyboard.
Is there any way of doing this?
Thanks!
Is there any way of doing this?
Yes.
P.S.
You can assign any shortcuts you want to those actions in Settings (Preferences on Mac) | Appearance & Behavior | Keymap
This question and several similar ones pop out regularly in the case of members of the IntellijIdea family of IDE's. I've seen it asked for example in the case of AndroidStudio.
Using an IntellijIdea-based IDE there is a general solution for finding any command without leaving the keyboard, and that is CTRL-SHIFT-a.
As soon as the dialog appears, in the case of this question it's sufficient to type move opp and then you can already hit ENTER to have the command executed.
I have a file from our repository where I ran auto-indent (because it was a mess), and now the whole file is marked by blue changebars (down the right hand side of the editor window), making it difficult to find my changes.
I am already ignoring whitespace changes in the diff window (as described here: Intellij and changes tab), is there a way to also do this in the editor window?
I couldn't find a way to completely ignore whitespaces, but IntelliJ (I'm using version 2016) lets you set an option to color whitespace-only changes differentely:
Editor -> General -> Different color for lines with whitespace-only modifications
which helps tremendously.
At the moment [idea 13.5] it seems that is not possible to ignore spaces in the standard editor. You can open a support ticket
We also faced this in the company due the different codestyles used, at the end we settle for:
setting a common codestyle that everyone editing the code should [actually must] follow
reformat the whole codebase to the given codestyle
recommit the formatted code [without any addition or deletion, just the reformat]
It took just a bit of time, but at the end now we are working far better. In this way from that moment onward, we would have all the time the code that would aesthetically the same trough next versions.
You can completely disable the highlight of whitespace modified lines in :
Settings -> Editor -> Color Scheme -> VSC -> Editor Gutter -> Whitespace-modified lines
And then uncheck the background color :
Essentially, you want Intellij to use the --ignore-all-space or --ignore-space-change upon a merge.
My developer team also deals with this challenge because we have different code formatting preferences. The result is every merge is painful for no reason. The team loves being able to have their code formatting, but this negates it.
As of now there is no solution. Intellij has the technology to ignore whitespace, so fixing this is really just adding a check box on the merge diff screen or even in the version control settings.
There is a feature requests IDEA-107714
Please up vote it!
https://youtrack.jetbrains.com/issue/IDEA-107714
Try this,
View --> Active Editor --> Show whitespaces
this is guaranteed to solve your problem
I'm Using resharper 6 nighty builds and VB.net. I've a big medium project with multiple files that don't follow the code style conventions of my company.
I've configured resharper with my own convenctions and It suggest to me the right name for each variable (perfect!).
But I can't find any automagic way to make the current name to be replaced with the suggested name.
Are there any way to do it? If not ... did you know ane fearure of coderush Xpress to achieve it?
Thanks.
If you've configured ReSharper with your naming conventions, then it should show a warning (blue squiggly underline) under any identifiers that don't comply. If you put the text cursor on one of those misnamed identifiers, you should see a pyramid icon appear near the left margin. Then you can press Alt+Enter (or click the pyramid icon) to drop down a quick-fix menu. There should be an option in the menu to "Rename to '_myField'". Usually it's the first item in the list, so you can just press Enter again to do the rename.
If you want to do this on everything in a source file, you can use the ReSharper > Inspect > Next Issue in File command (or its keyboard shortcut -- F12 in the IDEA keymap) to move the cursor to the next warning in the file. Then, if it's another name warning, you can use Alt+Enter, Enter again to fix it.
Unfortunately, there isn't a way to automatically fix every instance of a warning at once (though it's been requested; please feel free to vote for RSRP-126551 in their issue tracker).