List of shortcut keys for Java development in VSCode
When developing Java with VSCode, the shortcut keys are different from Eclipse and STS, so I did some research.
Organization of imports (Ctrl + Shift + o)
Since I was developing Java with Vi, I was very surprised at the organization of imports when the convenient environment of Eclipse came out.
In VSCode, you can use “Ctrl + .” to organize imports.
Added on 2021/05/30
With the following settings, I was able to organize imports using alt + shift + o.
settings.json
{ "java.saveActions.organizeImports": true }
open(F3)
You often refer to Java class definitions created by other engineers.
With VSCode, you can open the class definition with F12.
Open call hierarchy(Ctrl + Alt + h)
The call hierarchy is another frequently used shortcut key. It is a convenient shortcut key that shows at a glance where this method is used.
In VSCode, it is Shift + F12.
open a mold(Ctrl + Shift + t)
I often use this function when I have a lot of files.
In VSCode, it is Ctrl + p.
It is a little-known feature, but in Java class names (Pascal case), it is possible to search only by upper-case letters.
Adding unimplemented methods
There is no shortcut key for this, but when the interface is implemented in Eclipse, the GUI will show “Add unimplemented method”.
In VSCode, Ctrl + . to achieve the same thing.
Open type hierarchy(F4)
I often use F4 or Ctrl + t when I want to find a class that implements an interface.
In VSCode, you can use Shift + Alt + F12 to browse.
settings.json
java.dependency.packagePresentation
{ "java.dependency.packagePresentation": "hierarchical" }
The display of “JAVA PROJECTS” will change.
It is the same as Eclipse.
java.dependency.syncWithFolderExplorer
{ "java.dependency.syncWithFolderExplorer": true }
If true, specifies whether the folder should be synchronized with JAVA PROJECTS when files are referenced. Normally true is fine.
java.configuration.updateBuildConfiguration
{ "java.configuration.updateBuildConfiguration": "automatic" }
You can specify either “interactive” or “automatic.” If you specify “interactive,” you will see the following message every time you specify the build.gradle file.
コメント