IntelliJ IDEA: Find in files is not finding all the occurrences - intellij-idea

With IntelliJ 2021.1, I have noticed the search of files or words across a project is a bit flakey.
So if you paste a word to search with cmd + shift + f, it struggles to find all the words, and if you enter it from beginning it is better but still problematic.
Even double shift is struggling to find files.
I didn't notice such issues with previous version.

It's a known bug.
Please add -Didea.indexes.clear.non.indexable.file.data=false into Help | Edit Custom VM Options and invoke File | Invalidate Caches/Restart.. | Invalidate and Restart action as a workaround.

Related

PhpStorm IDE: Keyboard Home/Pos1 should move caret to real beginning of the line (character position 0) instead of the beginning of the first word

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.

How to hide path location in Run Window in Pycharm?

Today is my first day with Python and I started Using Pycharm Community edition in my Mac. This IDE is really good but one thing annoyed me a lot.
Is there any way I can remove the whole path from showing every time I run a program?
Wanted to remove this Path :
/Users/rajvivan/PycharmProjects/Python/venv/bin/python /Users/rajvivan/PycharmProjects/Python/App.py
Would just like to see the exact responses from the program:
First Day in Python
Hello, World!
There is no option to hide it completely, you can only make it appear folded by adding a pattern like /bin/python in File | Settings | Editor | General | Console, Fold console lines that contain.
In watching the Bro Code channel on Youtube, he changed the font color of the file path so that it's camouflaged. His words not mine just thought I'd share. I can't find the exact area that he's referring to as of yet so if someone else see's it, please share for the rest of us.
Thank you
Based on Bro Code's response I believe the attached is what he was referring too. This is what I came up with. If you goto Help>Find Action>output you'll see Console//System output. Change/Camouflage the color codes as in the picture. Hopefully this works for others.
If you copy the path into
File | Settings | Editor | General | Console`
and paste it as new Fold console lines, it will hide the line as <1 internal line>.

How to find the commented code in IntelliJ IDE?

Does anyone know a way to search for all (and only) the commented code across all classes in a java project?
For example, using "Find in Path" to search for "//" is not what I want because it also returns URIs (http://......). I want a specialized way to do that.
Thanks in advance.
You can use Structural Search in IntelliJ IDEA.
Below screens as for the version 2019.1.1 (Ultimate Edition) (Works for IntelliJ IDEA 2020.3 too)
Go to Edit > Find > Search Structurally...
File type should be Java and select any path wherever you like to search.
From the top right corner click on gear icon and click on Existing Templates...
Then from Java > Comments, Javadoc and Metadata select comments
Then it will add /* $CommentContent$ */ to the Structural Search window as for the first screenshot.
This will find all the commented code (including Javadoc) from the selected path.
For more info refer : Structural search and replace
About the best you could do would be the Find In Path and use a REGEX of:
^//
That will fix your http:// problem. But it won't find comments that don't start at the beginning of a line. I suppose you could write a much more complex REGEX to find "//" but not proceeded by http: But of course comments can be in /* */ blocks too. So it all depends on how absolute you want to get.
As of intellij 2020.3, there is an inspection for commented out code in java:
Java | Code maturity | Commented out code
So if you want a list of commented out code, you can:
right+click your project, module, subfolder, directory or file where you want to search.
click analyze > inspect code
Click OK
This should open the inspection result window where all your commented out code will be grouped under Java | Code maturity | Commented out code :
If you don't want intellij to search for other issues too, you can create a new profile in File | Settings | Editor | Inspections exactly for that and select it in the analyze dialog.

Intellij adding extra line in new blocks

When I'm writing code in Intellij, I often create new blocks by typing these types of sequences:
if (test) {
Typing that open curly brace causes Intellij to automatically insert a closing brace and move the cursor between the two braces:
if (test) {|}
At this point, I simply press Enter and get a nicely formatted block with the cursor right where it should be:
if (test) {
|
}
However, today Intellij is adding an extra line to the block, like this:
if (test) {
|
}
I've looked all over the project and IDE settings, but I'm not sure what to change. FYI, it's happening in various file types (.java, .js, .css) across different types of projects (Spring/Java, Node/Express). Anyone know how to fix this little annoyance?
Just got this error myself. Weirdly enough, for me it turned out to be the AWS Toolkit plugin.
If you have the same problem, it is most likely something with one of your other plugins if not the one mentioned above. I went through tons of IDE settings, and believe me, I wouldn't wish that upon anyone ;)
As of 5MAR2015 the solution is to disable the Gauge plugin. Credit for this goes to #KaPaHgaIII

IntelliJ: How to auto-highlight variables like in Eclipse

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.