Skip to content

Support google-java-format #3062

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
POC of google-java-format support
Signed-off-by: Shi Chen <chenshi@microsoft.com>
  • Loading branch information
CsCherrYY committed Apr 17, 2023
commit 65f6904b164a5b21fc5034299b3e28e0968de5a2
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,12 @@
{
"type": "string",
"enum": [
"eclipse"
"eclipse",
"google"
],
"enumDescriptions": [
"Use the eclipse formatter."
"Use the eclipse formatter.",
"Use the google-java-format formatter."
],
"markdownDescription": "Specifies the formatter style."
},
Expand All @@ -664,10 +666,12 @@
"style": {
"type": "string",
"enum": [
"eclipse"
"eclipse",
"google"
],
"enumDescriptions": [
"Use the eclipse formatter."
"Use the eclipse formatter.",
"Use the google-java-format formatter."
],
"markdownDescription": "Specifies the formatter style."
},
Expand Down
13 changes: 13 additions & 0 deletions src/javaServerStarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
'java.base/java.util=ALL-UNNAMED',
'--add-opens',
'java.base/java.lang=ALL-UNNAMED',
// See https://github.com/google/google-java-format#as-a-library
'--add-opens',
'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-opens',
'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
'--add-opens',
'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-opens',
'jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
'--add-opens',
'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-opens',
'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
// See https://github.com/redhat-developer/vscode-java/issues/2264
// It requires the internal API sun.nio.fs.WindowsFileAttributes.isDirectoryLink() to check if a Windows directory is symlink.
'--add-opens',
Expand Down