Visual Studio Code 中的 java 自动导入?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53534584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java auto import in Visual Studio Code?
提问by user3698042
Does VS Code have an auto-import function or hot key for Java?
VS Code 是否具有自动导入功能或 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?
我安装了Java Extension Pack,但发现每个库都需要自己导入,很累。有人知道解决方案吗?
回答by JustATech
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.
A) 为了让一切都像 intellij 或 eclipse 一样工作,有一个扩展,安装它,Ctrl+Shift+P ==> 然后编写创建 java 项目。
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.
B) 现在您已经拥有了正确的项目脚手架,只需右键单击编辑器,选择源操作,然后组织导入并选择要导入的正确库。