Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce VS Code/JDTLS formatter scheme #3059

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CsCherrYY
Copy link
Contributor

@CsCherrYY CsCherrYY commented Apr 12, 2023

requires eclipse-jdtls/eclipse.jdt.ls#2589

This PR introduces a VS Code/JDTLS formatter scheme, which can be configured without existing eclipse profile.

Deprecate configurations:

  • java.format.settings.url
  • java.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 like google can be introduced in the future.
  • "path": Has the same functionality as previously java.format.settings.url, will be ignored if the current style is not eclipse.
  • "profile": Has the same functionality as previously java.format.settings.profile, will be ignored if the current style is not eclipse.
  • "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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant