首页 > 解决方案 > 谷歌样式格式

问题描述

我已将这两行添加到我的.vscode/setting.json文件中以启用格式化功能:

"java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml",
"java.format.settings.profile": "GoogleStyle"

我正在使用 Eclipse Key Bindings 进行记录。所以当我这样做时Command + Shift + O,我的 Java 文件中会出现一个小气泡,上面写着:Organize imports. 但是,当我单击它时,我收到此错误消息:Running the contributed command: '_vscode_delegate_cmd_km72g93j' failed.

知道如何解决这个问题吗?

标签: javavisual-studio-codeformattingvscode-settings

解决方案


我使用的是 Windows,因此组织导入的键盘快捷键是Shift+Alt+O. 当我按下按键时,导入语句会立即组织起来。再次按 Shift+Alt+O 以显示黄色灯泡并选择 Organize Imports,发生同样的错误。

如果你翻看Log(Extension Host),你会发现导致这个错误的原因是actual command NOT FOUND _vscode_delegate_cmd_kmel0ckh在此处输入图像描述

您无需再次单击黄色灯泡并选择组织导入,但这可能是一个问题,我已将其放在 github 中:Organize imports throw the error


推荐阅读