Introduce VS Code/JDTLS formatter scheme
requires https://github.com/eclipse/eclipse.jdt.ls/pull/2589
This PR introduces a VS Code/JDTLS formatter scheme, which can be configured without existing eclipse profile.
Deprecate configurations:
java.format.settings.urljava.format.settings.profile
New configurations:
java.format.scheme
The configuration accepts both two kinds of values: "string" and "object".
String
Directly configure the formatter scheme. The default value is eclipse, some popular scheme like google can be introduced in the future.
example:
"java.format.scheme": "eclipse"
Object
Configure the formatter scheme. It has 4 properties:
- "style": Configure the formatter scheme. The default value is
eclipse, some popular scheme likegooglecan be introduced in the future. - "path": Has the same functionality as previously
java.format.settings.url, will be ignored if the current style is noteclipse. - "profile": Has the same functionality as previously
java.format.settings.profile, will be ignored if the current style is noteclipse. - "configurations": The custom formatter configurations, which will take precedence over the corresponding settings in the scheme, will be ignored if the current style is not
eclipse.
example1: Use default eclipse configuration, but set the brace position of blocks to next line:
"java.format.scheme": {
"style": "eclipse",
"configurations": {
"brace.position.for.block": "nextLine"
}
}
example2: Use custom eclipse configuration in profile custom from file .vscode/java-formatter.xml, but set the brace position of blocks to next line:
"java.format.scheme": {
"style": "eclipse",
"path": ".vscode/java-formatter.xml",
"profile": "custom",
"configurations": {
"brace.position.for.block": "nextLine"
}
}
Configurations list
The first version of the configurations list would be the settings mentioned in formatter related issues in https://github.com/redhat-developer/vscode-java and https://github.com/eclipse/eclipse.jdt.ls, they would be easily configured by the users so that we expose them to convenient editing.
We can also expand the list if there are requests.