java auto import in Visual Studio Code?

2020-06-12 02:53发布

Does VS Code have an auto-import function or hot key for Java?

I installed Java Extension Pack but I found that I need to import every libraries by myself and it is very tiring. Anybody knows solution?

2条回答
对你真心纯属浪费
2楼-- · 2020-06-12 03:44

For organize imports inside a java file

press SHIFT+ ALT + O

The vscode has also the option of enable auto organize imports on save action

enter image description here

查看更多
Anthone
3楼-- · 2020-06-12 03:51

A) in order to have everything working just like intellij or eclipse, there is an extension, install it, Ctrl+Shift+P ==> then write create java project.

B) now that you have the project scaffold right, just right click on the editor, choose source action, then organize imports and select the right libraries to be imported.

查看更多
登录 后发表回答