Skip to content

Commit f7d92c5

Browse files
committed
POC of google-java-format support
Signed-off-by: Shi Chen <[email protected]>
1 parent c8e5d99 commit f7d92c5

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,12 @@
648648
{
649649
"type": "string",
650650
"enum": [
651-
"eclipse"
651+
"eclipse",
652+
"google"
652653
],
653654
"enumDescriptions": [
654-
"Use the eclipse formatter."
655+
"Use the eclipse formatter.",
656+
"Use the google-java-format formatter."
655657
],
656658
"markdownDescription": "Specifies the formatter style."
657659
},
@@ -664,10 +666,12 @@
664666
"style": {
665667
"type": "string",
666668
"enum": [
667-
"eclipse"
669+
"eclipse",
670+
"google"
668671
],
669672
"enumDescriptions": [
670-
"Use the eclipse formatter."
673+
"Use the eclipse formatter.",
674+
"Use the google-java-format formatter."
671675
],
672676
"markdownDescription": "Specifies the formatter style."
673677
},

src/javaServerStarter.ts

+13
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
8282
'java.base/java.util=ALL-UNNAMED',
8383
'--add-opens',
8484
'java.base/java.lang=ALL-UNNAMED',
85+
// See https://github.com/google/google-java-format#as-a-library
86+
'--add-opens',
87+
'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
88+
'--add-opens',
89+
'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
90+
'--add-opens',
91+
'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
92+
'--add-opens',
93+
'jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
94+
'--add-opens',
95+
'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
96+
'--add-opens',
97+
'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
8598
// See https://github.com/redhat-developer/vscode-java/issues/2264
8699
// It requires the internal API sun.nio.fs.WindowsFileAttributes.isDirectoryLink() to check if a Windows directory is symlink.
87100
'--add-opens',

0 commit comments

Comments
 (0)