Hi,
I have imported an Eclipse format XML file to vscode follow your instruction in here
https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings
But it didn't work. Before that, it used to work great.
Just reinstall the vscode with java extension pack and start to meet this problem
I really want to stay with vscode to work with Java and don't want to come back to IntelliJ or Eclipse
Can you help me?
Thank you.
meet the error: There is no formatter for 'java' files installed
It should work like this
@Override
public void run() {
try {
wm.startWork( new TheWork() );
} catch ( WorkException we ) {
logger.error( "problem running worker thread ", we );
}
}
Ctrl + Shift + P: >Java: Open Java formatter settings
it still can open the Eclipse format xml file
"java.format.enabled": false
when it is "true", it uses the default format, so I let it "false" as default
my setting.json (user settings)
{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"workbench.startupEditor": "newUntitledFile",
"editor.minimap.enabled": false,
"window.zoomLevel": -1,
"workbench.iconTheme": "material-icon-theme",
"[java]": {},
"java.configuration.checkProjectSettingsExclusions": false,
"java.requirements.JDK11Warning": false,
"java.semanticHighlighting.enabled": true,
"java.format.enabled": false,
"java.completion.favoriteStaticMembers": [
"org.junit.Assert.*",
"org.junit.Assume.*",
"org.junit.jupiter.api.Assertions.*",
"org.junit.jupiter.api.Assumptions.*",
"org.junit.jupiter.api.DynamicContainer.*",
"org.junit.jupiter.api.DynamicTest.*",
"org.mockito.Mockito.*",
"org.mockito.ArgumentMatchers.*",
"org.mockito.Answers.*"
],
"java.format.settings.url": "/home/dchoa/workspace/JavaFormatterEclipse.xml"
}
I'm not sure if this is only an option on the insiders version of vscode or if it is available in the release version. Try the following:
"[java]": {
"editor.defaultFormatter": "redhat.java"
}
I have tried your solution, it still not work for me :(
Apparently you turned off the formatter by "java.format.enabled": false, that's why you see the message "There is no formatter for 'java' files installed". Please enable that setting.
Thank @testforstephen @astrelsky
After edit "java.format.enabled": true
and put
"[java]": {
"editor.defaultFormatter": "redhat.java"
}
It works again perfectly, I think the defaultFormatter should be configured to redhat.java right after the plugin was installed will be better
Thanks again for your support.
Most helpful comment
I'm not sure if this is only an option on the insiders version of vscode or if it is available in the release version. Try the following: