generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 35
Java formatting preferences
Achal Talati edited this page Nov 13, 2024
·
2 revisions
Follow the steps given below to setup the custom formatter preferences:
- Install NetBeans.
- Configure your Java formatting preferences in NetBeans:
Menu: Tools | Options | Editor | Formatting
In the "Language" drop-down: Choose "Java" - Press "Export" button (lower left corner)
- Check the "Editor" and "Formatting" checkboxes.
- Export the options as a .zip file, e.g. "MyNetBeansJavaFormatting.zip"
- Set the
jdk.format.settingsPath
setting in VS Code:
In VS Code, open the "Command Palette" (Ctrl+Shift+P)
Type "Preferences: Open User Settings (JSON)"
Set the following property:
"jdk.format.settingsPath": "PATH_TO_EXPORTED_NETBEANS_FORMAT_PREFERENCES_ZIP"
- You might also need to make sure that "Editor: Default Formatter" is set to "null" in your VS Code Settings (Ctrl+,).
Your custom Java formatting preferences should now be honoured by the "Oracle Java" extension in VS Code.
While it may not be the perfect solution, performing this task should be a one-time requirement, unless you find yourself regularly adjusting your formatter settings.