Probably more a intellij question than kotlin, but...
# getting-started
k
Probably more a intellij question than kotlin, but is there a function to detect all full path
<http://com.my|com.my>.package.MyClass
in code? I refactored some packages and it got a bit messy, want to change it back to only MyClass.
j
Do you want full-text search/replace (Ctrl+Alt+Shift+R)? Or something smarter?
k
It is many different packages, so I would prefer something that detects all redundant qualifier names
v
If you do Alt+Enter on, it, there will be a quick fix to remove the redundant package, or to add an import instead, depending on whether you have an import already or not. If you don't execute it, but go to the details with right-arrow key or mouse hovering, there is na option to run this inspection on all your code and from there you can also fix it everywhere.
👍 1
j
Ah if it's for redundant packages yes this would be a better option. I thought a refactoring went wrong and some packages within the imports were duplicated, like
<http://com.example.com|com.example.com>.example.Thing
(which happened to me when trying the "unnested" layout advised in the Kotlin docs)
k
@Vampire Thanks! That was exactly what I was looking for, well hidden I may say.
j
@Kenneth most quick fixes like this can be applied in bulk. Once you know it for one, you know it for everything 🙂
v
Well, there are many ways. You can also invoke the inspection by doing Ctrl+Alt+Shift+i and then search for it by name. Or if you don't remember the shortcut you can search for the action in Ctrl+Shift+A or in Shift-Shift
I just find it easier to go the quick-fix way as you don't have to remember or make up the name of the intention to execute
👍 2
k
I actually tried to find an action for it, but I didn’t successfully locate it.
v
The action is "Run inspection by name"