diff --git a/README.md b/README.md index ba9d904e0..502544db8 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,6 @@ The following settings are supported: * `java.references.includeAccessors`: Include getter, setter and builder/constructor when finding references. Default to true. * `java.configuration.maven.globalSettings` : Path to Maven's global settings.xml. * `java.eclipse.downloadSources` : Enable/disable download of Maven source artifacts for Eclipse projects. -* `java.recommendations.dependency.analytics.show` : Show the recommended Dependency Analytics extension. * `java.references.includeDecompiledSources` : Include the decompiled sources when finding references. Default to true. * `java.project.sourcePaths`: Relative paths to the workspace where stores the source files. `Only` effective in the `WORKSPACE` scope. The setting will `NOT` affect Maven or Gradle project. * `java.typeHierarchy.lazyLoad`: Enable/disable lazy loading the content in type hierarchy. Lazy loading could save a lot of loading time but every type should be expanded manually to load its content. diff --git a/package.json b/package.json index 5f522abb0..4caefe86b 100644 --- a/package.json +++ b/package.json @@ -209,9 +209,10 @@ "url": "./schemas/package.schema.json" } ], - "configuration": { - "type": "object", - "title": "Java", + "configuration":[{ + "id": "java-startup", + "title": "Startup", + "order": 10, "properties": { "java.home": { "type": [ @@ -221,7 +222,8 @@ "default": null, "description": "Specifies the folder path to the JDK (17 or more recent) used to launch the Java Language Server.\nOn Windows, backslashes must be escaped, i.e.\n\"java.home\":\"C:\\\\Program Files\\\\Java\\\\jdk-17.0_3\"", "scope": "machine-overridable", - "deprecationMessage": "This setting is deprecated, please use 'java.jdt.ls.java.home' instead." + "deprecationMessage": "This setting is deprecated, please use 'java.jdt.ls.java.home' instead.", + "order": 0 }, "java.jdt.ls.java.home": { "type": [ @@ -230,7 +232,8 @@ ], "default": null, "description": "Specifies the folder path to the JDK (17 or more recent) used to launch the Java Language Server. This setting will replace the Java extension's embedded JRE to start the Java Language Server. \n\nOn Windows, backslashes must be escaped, i.e.\n\"java.jdt.ls.java.home\":\"C:\\\\Program Files\\\\Java\\\\jdk-17.0_3\"", - "scope": "machine-overridable" + "scope": "machine-overridable", + "order": 10 }, "java.jdt.ls.vmargs": { "type": [ @@ -239,29 +242,110 @@ ], "default": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable", "description": "Specifies extra VM arguments used to launch the Java Language Server. Eg. use `-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable` to optimize memory usage with the parallel garbage collector", - "scope": "machine-overridable" + "scope": "machine-overridable", + "order": 20 }, - "java.errors.incompleteClasspath.severity": { + "java.server.launchMode": { + "type": "string", + "enum": [ + "Standard", + "LightWeight", + "Hybrid" + ], + "enumDescriptions": [ + "Provides full features such as intellisense, refactoring, building, Maven/Gradle support etc.", + "Starts a syntax server with lower start-up cost. Only provides syntax features such as outline, navigation, javadoc, syntax errors.", + "Provides full features with better responsiveness. It starts a standard language server and a secondary syntax server. The syntax server provides syntax features until the standard server is ready." + ], + "description": "The launch mode for the Java extension", + "default": "Hybrid", + "scope": "window", + "order": 30 + }, + "java.configuration.workspaceCacheLimit": { "type": [ - "string" + "null", + "integer" ], + "default": 90, + "minimum": 1, + "description": "The number of days (if enabled) to keep unused workspace cache data. Beyond this limit, cached workspace data may be removed.", + "scope": "application", + "order": 40 + }, + "java.sharedIndexes.enabled": { + "type": "string", "enum": [ - "ignore", - "info", - "warning", - "error" + "auto", + "on", + "off" ], - "default": "warning", - "description": "Specifies the severity of the message when the classpath is incomplete for a Java file", - "scope": "window" + "default": "auto", + "markdownDescription": "[Experimental] Specify whether to share indexes between different workspaces. When set to `auto`, shared indexes will be enabled in Visual Studio Code - Insiders.", + "scope": "window", + "order": 50 }, - "java.configuration.checkProjectSettingsExclusions": { - "deprecationMessage": "Please use 'java.import.generatesMetadataFilesAtProjectRoot' to control whether to generate the project metadata files at the project root. And use 'files.exclude' to control whether to hide the project metadata files from the file explorer.", + "java.sharedIndexes.location": { + "type": "string", + "markdownDescription": "Specifies a common index location for all workspaces. See default values as follows:\n \nWindows: First use `\"$APPDATA\\\\.jdt\\\\index\"`, or `\"~\\\\.jdt\\\\index\"` if it does not exist\n \nmacOS: `\"~/Library/Caches/.jdt/index\"`\n \nLinux: First use `\"$XDG_CACHE_HOME/.jdt/index\"`, or `\"~/.cache/.jdt/index\"` if it does not exist", + "default": "", + "scope": "window", + "order": 60 + }, + "java.jdt.ls.lombokSupport.enabled": { "type": "boolean", - "default": false, - "description": "Controls whether to exclude extension-generated project settings files (.project, .classpath, .factorypath, .settings/) from the file explorer.", + "default": true, + "description": "Whether to load lombok processors from project classpath", + "scope": "window", + "order": 70 + }, + "java.jdt.ls.protobufSupport.enabled": { + "type": "boolean", + "default": true, + "markdownDescription": "Specify whether to automatically add Protobuf output source directories to the classpath.\n\n**Note:** Only works for Gradle `com.google.protobuf` plugin `0.8.4` or higher.", + "scope": "window", + "order": 80 + }, + "java.jdt.ls.androidSupport.enabled": { + "type": "string", + "enum": [ + "auto", + "on", + "off" + ], + "default": "auto", + "markdownDescription": "[Experimental] Specify whether to enable Android project importing. When set to `auto`, the Android support will be enabled in Visual Studio Code - Insiders.\n\n**Note:** Only works for Android Gradle Plugin `3.2.0` or higher.", + "scope": "window", + "order": 90 + }, + "java.trace.server": { + "type": "string", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "description": "Traces the communication between VS Code and the Java language server.", "scope": "window" }, + "redhat.telemetry.enabled": { + "type": "boolean", + "default": null, + "markdownDescription": "Enable usage data and errors to be sent to Red Hat servers. Read our [privacy statement](https://developers.redhat.com/article/tool-data-collection).", + "scope": "window", + "tags": [ + "usesOnlineServices", + "telemetry" + ] + } + } + }, + { + "id": "java-projectimport", + "title": "Project Import/Update", + "order": 20, + "properties": { "java.configuration.updateBuildConfiguration": { "type": [ "string" @@ -273,150 +357,207 @@ ], "default": "interactive", "description": "Specifies how modifications on build files update the Java classpath/configuration", - "scope": "window" + "scope": "window", + "order": 10 }, - "java.trace.server": { - "type": "string", - "enum": [ - "off", - "messages", - "verbose" + "java.import.exclusions": { + "type": "array", + "description": "Configure glob patterns for excluding folders. Use `!` to negate patterns to allow subfolders imports. You have to include a parent directory. The order is important.", + "default": [ + "**/node_modules/**", + "**/.metadata/**", + "**/archetype-resources/**", + "**/META-INF/maven/**" ], - "default": "off", - "description": "Traces the communication between VS Code and the Java language server.", "scope": "window" }, - "java.import.maven.enabled": { - "type": "boolean", - "default": true, - "description": "Enable/disable the Maven importer.", + "java.project.resourceFilters": { + "type": "array", + "items": { + "type": "string", + "pattern": "^(?!\\*).*" + }, + "default": [ + "node_modules", + "\\.git" + ], + "markdownDescription": "Excludes files and folders from being refreshed by the Java Language Server, which can improve the overall performance. For example, [\"node_modules\",\"\\.git\"] will exclude all files and folders named `node_modules` or `.git`. Pattern expressions must be compatible with `java.util.regex.Pattern`. Defaults to [\"node_modules\",\"\\.git\"].", "scope": "window" }, - "java.import.maven.offline.enabled": { + "java.configuration.checkProjectSettingsExclusions": { + "deprecationMessage": "Please use 'java.import.generatesMetadataFilesAtProjectRoot' to control whether to generate the project metadata files at the project root. And use 'files.exclude' to control whether to hide the project metadata files from the file explorer.", "type": "boolean", "default": false, - "description": "Enable/disable the Maven offline mode.", + "description": "Controls whether to exclude extension-generated project settings files (.project, .classpath, .factorypath, .settings/) from the file explorer.", "scope": "window" }, - "java.import.maven.disableTestClasspathFlag": { + "java.import.generatesMetadataFilesAtProjectRoot": { "type": "boolean", + "markdownDescription": "Specify whether the project metadata files(.project, .classpath, .factorypath, .settings/) will be generated at the project root. Click [HERE](command:_java.metadataFilesGeneration) to learn how to change the setting to make it take effect.", "default": false, - "description": "Enable/disable test classpath segregation. When enabled, this permits the usage of test resources within a Maven project as dependencies within the compile scope of other projects.", "scope": "window" }, - "java.import.gradle.enabled": { - "type": "boolean", - "default": true, - "description": "Enable/disable the Gradle importer.", - "scope": "window" + "java.project.importOnFirstTimeStartup": { + "type": "string", + "enum": [ + "disabled", + "interactive", + "automatic" + ], + "default": "automatic", + "description": "Specifies whether to import the Java projects, when opening the folder in Hybrid mode for the first time.", + "scope": "application" }, - "java.import.gradle.wrapper.enabled": { + "java.project.importHint": { "type": "boolean", + "description": "Enable/disable the server-mode switch information, when Java projects import is skipped on startup.", "default": true, - "description": "Use Gradle from the 'gradle-wrapper.properties' file.", - "scope": "window" - }, - "java.import.gradle.version": { - "type": "string", - "default": null, - "description": "Use Gradle from the specific version if the Gradle wrapper is missing or disabled.", - "scope": "window" + "scope": "application" }, - "java.import.gradle.home": { - "type": "string", - "default": null, - "description": "Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.", + "java.showBuildStatusOnStart.enabled": { + "anyOf": [ + { + "enum": [ + "notification", + "terminal", + "off" + ], + "enumDescriptions": [ + "Show the build status via progress notification on start", + "Show the build status via terminal on start", + "Do not show any build status on start" + ] + }, + "boolean" + ], + "description": "Automatically show build status on startup.", + "default": "notification", "scope": "window" }, - "java.import.gradle.java.home": { - "type": "string", - "default": null, - "description": "The location to the JVM used to run the Gradle daemon.", - "scope": "machine-overridable" - }, - "java.import.gradle.offline.enabled": { - "type": "boolean", - "default": false, - "description": "Enable/disable the Gradle offline mode.", + "java.project.encoding": { + "enum": [ + "ignore", + "warning", + "setDefault" + ], + "enumDescriptions": [ + "Ignore project encoding settings", + "Show warning if a project has no explicit encoding set", + "Set the default workspace encoding settings" + ], + "default": "ignore", + "markdownDescription": "Project encoding settings", "scope": "window" + } + } + }, + { + "id": "java-unmanagedfolder", + "title": "Unmanaged Folder", + "order": 30, + "properties": { + "java.project.sourcePaths": { + "type": "array", + "items": { + "type": "string" + }, + "markdownDescription": "Relative paths to the workspace where stores the source files. `Only` effective in the `WORKSPACE` scope. The setting will `NOT` affect Maven or Gradle project.", + "default": [], + "scope": "window", + "order": 10 }, - "java.import.gradle.arguments": { - "type": "string", - "default": null, - "description": "Arguments to pass to Gradle.", - "scope": "machine" - }, - "java.import.gradle.jvmArguments": { - "type": "string", - "default": null, - "description": "JVM arguments to pass to Gradle.", - "scope": "machine" - }, - "java.import.gradle.user.home": { - "type": "string", - "default": null, - "description": "Setting for GRADLE_USER_HOME.", - "scope": "window" + "java.project.outputPath": { + "type": [ + "string", + "null" + ], + "markdownDescription": "A relative path to the workspace where stores the compiled output. `Only` effective in the `WORKSPACE` scope. The setting will `NOT` affect Maven or Gradle project.", + "default": "", + "scope": "window", + "order": 20 }, - "java.import.gradle.annotationProcessing.enabled": { + "java.project.referencedLibraries": { + "type": [ + "array", + "object" + ], + "description": "Configure glob patterns for referencing local libraries to a Java project.", + "default": [ + "lib/**/*.jar" + ], + "properties": { + "include": { + "type": "array" + }, + "exclude": { + "type": "array" + }, + "sources": { + "type": "object" + } + }, + "required": [ + "include" + ], + "additionalProperties": false, + "scope": "window", + "order": 30 + } + } + }, + { + "id": "java-maven", + "title": "Maven", + "order": 40, + "properties": { + "java.import.maven.enabled": { "type": "boolean", "default": true, - "description": "Enable/disable the annotation processing on Gradle projects and delegate Annotation Processing to JDT APT. Only works for Gradle 5.2 or higher.", - "scope": "window" - }, - "java.maven.downloadSources": { - "type": "boolean", - "default": false, - "description": "Enable/disable download of Maven source artifacts as part of importing Maven projects.", - "scope": "window" - }, - "java.eclipse.downloadSources": { - "type": "boolean", - "default": false, - "description": "Enable/disable download of Maven source artifacts for Eclipse projects.", - "scope": "window" + "description": "Enable/disable the Maven importer.", + "scope": "window", + "order": 10 }, - "java.maven.updateSnapshots": { + "java.import.maven.offline.enabled": { "type": "boolean", "default": false, - "description": "Force update of Snapshots/Releases.", - "scope": "window" + "description": "Enable/disable the Maven offline mode.", + "scope": "window", + "order": 20 }, - "java.referencesCodeLens.enabled": { + "java.import.maven.disableTestClasspathFlag": { "type": "boolean", "default": false, - "description": "Enable/disable the references code lens.", - "scope": "window" - }, - "java.signatureHelp.enabled": { - "type": "boolean", - "default": true, - "description": "Enable/disable the signature help.", - "scope": "window" + "description": "Enable/disable test classpath segregation. When enabled, this permits the usage of test resources within a Maven project as dependencies within the compile scope of other projects.", + "scope": "window", + "order": 30 }, - "java.signatureHelp.description.enabled": { + "java.maven.downloadSources": { "type": "boolean", "default": false, - "description": "Enable/disable to show the description in signature help.", - "scope": "window" + "description": "Enable/disable download of Maven source artifacts as part of importing Maven projects.", + "scope": "window", + "order": 40 }, - "java.implementationsCodeLens.enabled": { + "java.maven.updateSnapshots": { "type": "boolean", "default": false, - "description": "Enable/disable the implementations code lens.", - "scope": "window" + "description": "Force update of Snapshots/Releases.", + "scope": "window", + "order": 50 }, "java.configuration.maven.userSettings": { "type": "string", "default": null, "description": "Path to Maven's user settings.xml", - "scope": "window" + "scope": "window", + "order": 60 }, "java.configuration.maven.globalSettings": { "type": "string", "default": null, "description": "Path to Maven's global settings.xml", - "scope": "window" + "scope": "window", + "order": 70 }, "java.configuration.maven.notCoveredPluginExecutionSeverity": { "type": "string", @@ -427,7 +568,8 @@ ], "default": "warning", "description": "Specifies severity if the plugin execution is not covered by Maven build lifecycle.", - "scope": "window" + "scope": "window", + "order": 80 }, "java.configuration.maven.defaultMojoExecutionAction": { "type": "string", @@ -439,148 +581,322 @@ ], "default": "ignore", "description": "Specifies default mojo execution action when no associated metadata can be detected.", - "scope": "window" - }, - "java.configuration.workspaceCacheLimit": { - "type": [ - "null", - "integer" - ], - "default": 90, - "minimum": 1, - "description": "The number of days (if enabled) to keep unused workspace cache data. Beyond this limit, cached workspace data may be removed.", - "scope": "application" + "scope": "window", + "order": 90 + } + } + }, + { + "id": "java-gradle", + "title": "Gradle", + "order": 50, + "properties": { + "java.import.gradle.enabled": { + "type": "boolean", + "default": true, + "description": "Enable/disable the Gradle importer.", + "scope": "window", + "order": 10 }, - "java.format.enabled": { + "java.import.gradle.wrapper.enabled": { "type": "boolean", "default": true, - "description": "Enable/disable default Java formatter", - "scope": "window" + "description": "Use Gradle from the 'gradle-wrapper.properties' file.", + "scope": "window", + "order": 20 }, - "java.saveActions.organizeImports": { + "java.import.gradle.version": { + "type": "string", + "default": null, + "description": "Use Gradle from the specific version if the Gradle wrapper is missing or disabled.", + "scope": "window", + "order": 30 + }, + "java.import.gradle.home": { + "type": "string", + "default": null, + "description": "Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.", + "scope": "window", + "order": 40 + }, + "java.import.gradle.java.home": { + "type": "string", + "default": null, + "description": "The location to the JVM used to run the Gradle daemon.", + "scope": "machine-overridable", + "order": 50 + }, + "java.import.gradle.user.home": { + "type": "string", + "default": null, + "description": "Setting for GRADLE_USER_HOME.", + "scope": "window", + "order": 55 + }, + "java.import.gradle.offline.enabled": { "type": "boolean", "default": false, - "description": "Enable/disable auto organize imports on save action", - "scope": "window" + "description": "Enable/disable the Gradle offline mode.", + "scope": "window", + "order": 60 + }, + "java.import.gradle.arguments": { + "type": "string", + "default": null, + "description": "Arguments to pass to Gradle.", + "scope": "machine", + "order": 70 + }, + "java.import.gradle.jvmArguments": { + "type": "string", + "default": null, + "description": "JVM arguments to pass to Gradle.", + "scope": "machine", + "order": 80 + }, + "java.import.gradle.annotationProcessing.enabled": { + "type": "boolean", + "default": true, + "description": "Enable/disable the annotation processing on Gradle projects and delegate Annotation Processing to JDT APT. Only works for Gradle 5.2 or higher.", + "scope": "window", + "order": 90 + }, + "java.imports.gradle.wrapper.checksums": { + "type": "array", + "items": { + "type": "object", + "default": {}, + "required": [ + "sha256" + ], + "properties": { + "sha256": { + "type": "string", + "label": "SHA-256 checksum." + }, + "allowed": { + "type": "boolean", + "default": true, + "label": "Is allowed?" + } + }, + "additionalProperties": false, + "uniqueItems": true + }, + "description": "Defines allowed/disallowed SHA-256 checksums of Gradle Wrappers", + "default": [], + "scope": "application" + } + } + }, + { + "id": "java-build", + "title": "Build", + "order": 60, + "properties": { + "java.autobuild.enabled": { + "type": "boolean", + "default": true, + "description": "Enable/disable the 'auto build'", + "scope": "window", + "order": 10 + }, + "java.maxConcurrentBuilds": { + "type": "integer", + "default": 1, + "description": "Max simultaneous project builds", + "scope": "window", + "minimum": 1, + "order": 20 }, - "java.import.exclusions": { + "java.settings.url": { + "type": "string", + "markdownDescription": "Specifies the url or file path to the workspace Java settings. See [Setting Global Preferences](https://github.com/redhat-developer/vscode-java/wiki/Settings-Global-Preferences)", + "default": null, + "scope": "window", + "order": 30 + }, + "java.compile.nullAnalysis.nonnull": { "type": "array", - "description": "Configure glob patterns for excluding folders. Use `!` to negate patterns to allow subfolders imports. You have to include a parent directory. The order is important.", "default": [ - "**/node_modules/**", - "**/.metadata/**", - "**/archetype-resources/**", - "**/META-INF/maven/**" + "javax.annotation.Nonnull", + "org.eclipse.jdt.annotation.NonNull", + "org.springframework.lang.NonNull" ], + "markdownDescription": "Specify the Nonnull annotation types to be used for null analysis. If more than one annotation is specified, then the topmost annotation will be used first if it exists in project dependencies. This setting will be ignored if `java.compile.nullAnalysis.mode` is set to `disabled`", "scope": "window" }, - "java.import.generatesMetadataFilesAtProjectRoot": { - "type": "boolean", - "markdownDescription": "Specify whether the project metadata files(.project, .classpath, .factorypath, .settings/) will be generated at the project root. Click [HERE](command:_java.metadataFilesGeneration) to learn how to change the setting to make it take effect.", - "default": false, - "scope": "window" - }, - "java.project.referencedLibraries": { - "type": [ - "array", - "object" - ], - "description": "Configure glob patterns for referencing local libraries to a Java project.", + "java.compile.nullAnalysis.nullable": { + "type": "array", "default": [ - "lib/**/*.jar" + "javax.annotation.Nullable", + "org.eclipse.jdt.annotation.Nullable", + "org.springframework.lang.Nullable" ], - "properties": { - "include": { - "type": "array" - }, - "exclude": { - "type": "array" - }, - "sources": { - "type": "object" - } - }, - "required": [ - "include" + "markdownDescription": "Specify the Nullable annotation types to be used for null analysis. If more than one annotation is specified, then the topmost annotation will be used first if it exists in project dependencies. This setting will be ignored if `java.compile.nullAnalysis.mode` is set to `disabled`", + "scope": "window" + }, + "java.compile.nullAnalysis.mode": { + "type": "string", + "enum": [ + "disabled", + "interactive", + "automatic" ], - "additionalProperties": false, + "default": "interactive", + "markdownDescription": "Specify how to enable the annotation-based null analysis.", "scope": "window" }, - "java.project.outputPath": { + "java.errors.incompleteClasspath.severity": { "type": [ - "string", - "null" + "string" ], - "markdownDescription": "A relative path to the workspace where stores the compiled output. `Only` effective in the `WORKSPACE` scope. The setting will `NOT` affect Maven or Gradle project.", - "default": "", + "enum": [ + "ignore", + "info", + "warning", + "error" + ], + "default": "warning", + "description": "Specifies the severity of the message when the classpath is incomplete for a Java file", "scope": "window" - }, - "java.project.sourcePaths": { + } + } + }, + { + "id": "java-jdks", + "title": "Installed JDKs", + "order": 70, + "properties": { + "java.configuration.runtimes": { "type": "array", + "description": "Map Java Execution Environments to local JDKs.", "items": { - "type": "string" + "type": "object", + "default": {}, + "required": [ + "path", + "name" + ], + "properties": { + "name": { + "type": "string", + "enum": [ + "J2SE-1.5", + "JavaSE-1.6", + "JavaSE-1.7", + "JavaSE-1.8", + "JavaSE-9", + "JavaSE-10", + "JavaSE-11", + "JavaSE-12", + "JavaSE-13", + "JavaSE-14", + "JavaSE-15", + "JavaSE-16", + "JavaSE-17", + "JavaSE-18", + "JavaSE-19", + "JavaSE-20", + "JavaSE-21" + ], + "description": "Java Execution Environment name. Must be unique." + }, + "path": { + "type": "string", + "pattern": ".*(?` or `}`", + "default": true, "scope": "window" - }, + } + } + }, + { + "id": "java-codecompletion", + "title": "Code Completion", + "order": 90, + "properties": { "java.completion.enabled": { "type": "boolean", "default": true, "description": "Enable/disable code completion support", - "scope": "window" + "scope": "window", + "order": 10 }, - "java.completion.guessMethodArguments": { - "type": [ - "boolean", - "string" - ], - "enum": [ - "auto", - "off", - "insertParameterNames", - "insertBestGuessedArguments" - ], - "enumDescriptions": [ - "Use 'off' only when using Visual Studio Code - Insiders, other platform will defaults to 'insertBestGuessedArguments'.", - "Method arguments will not be inserted during completion.", - "The parameter names will be inserted during completion.", - "The best guessed arguments will be inserted during completion according to the code context." - ], - "default": "auto", - "description": "Specify how the arguments will be filled during completion.", - "scope": "window" + "java.completion.postfix.enabled": { + "type": "boolean", + "default": true, + "markdownDescription": "Enable/disable postfix completion support. `#editor.snippetSuggestions#` can be used to customize how postfix snippets are sorted.", + "scope": "window", + "order": 20 + }, + "java.completion.chain.enabled": { + "type": "boolean", + "default": false, + "markdownDescription": "Enable/disable chain completion support. Chain completions are only available when completions are invoked by the completions shortcut", + "scope": "window", + "order": 30 }, "java.completion.favoriteStaticMembers": { "type": "array", @@ -596,7 +912,8 @@ "org.mockito.ArgumentMatchers.*", "org.mockito.Answers.*" ], - "scope": "window" + "scope": "window", + "order": 40 }, "java.completion.filteredTypes": { "type": "array", @@ -609,32 +926,30 @@ "org.graalvm.*", "io.micrometer.shaded.*" ], - "scope": "window" + "scope": "window", + "order": 50 }, - "java.completion.importOrder": { - "type": "array", - "description": "Defines the sorting order of import statements. A package or type name prefix (e.g. 'org.eclipse') is a valid entry. An import is always added to the most specific group. As a result, the empty string (e.g. '') can be used to group all other imports. Static imports are prefixed with a '#'", - "default": [ - "#", - "java", - "javax", - "org", - "com", - "" + "java.completion.guessMethodArguments": { + "type": [ + "boolean", + "string" ], - "scope": "window" - }, - "java.completion.postfix.enabled": { - "type": "boolean", - "default": true, - "markdownDescription": "Enable/disable postfix completion support. `#editor.snippetSuggestions#` can be used to customize how postfix snippets are sorted.", - "scope": "window" - }, - "java.completion.chain.enabled": { - "type": "boolean", - "default": false, - "markdownDescription": "Enable/disable chain completion support. Chain completions are only available when completions are invoked by the completions shortcut", - "scope": "window" + "enum": [ + "auto", + "off", + "insertParameterNames", + "insertBestGuessedArguments" + ], + "enumDescriptions": [ + "Use 'off' only when using Visual Studio Code - Insiders, other platform will defaults to 'insertBestGuessedArguments'.", + "Method arguments will not be inserted during completion.", + "The parameter names will be inserted during completion.", + "The best guessed arguments will be inserted during completion according to the code context." + ], + "default": "auto", + "description": "Specify how the arguments will be filled during completion.", + "scope": "window", + "order": 60 }, "java.completion.matchCase": { "type": "string", @@ -648,7 +963,22 @@ ], "default": "firstLetter", "markdownDescription": "Specify whether to match case for code completion.", - "scope": "window" + "scope": "window", + "order": 70 + }, + "java.completion.importOrder": { + "type": "array", + "description": "Defines the sorting order of import statements. A package or type name prefix (e.g. 'org.eclipse') is a valid entry. An import is always added to the most specific group. As a result, the empty string (e.g. '') can be used to group all other imports. Static imports are prefixed with a '#'", + "default": [ + "#", + "java", + "javax", + "org", + "com", + "" + ], + "scope": "window", + "order": 80 }, "java.completion.lazyResolveTextEdit.enabled": { "type": "boolean", @@ -656,35 +986,61 @@ "description": "[Experimental] Enable/disable lazily resolving text edits for code completion.", "scope": "window" }, - "java.foldingRange.enabled": { - "type": "boolean", - "default": true, - "description": "Enable/disable smart folding range support. If disabled, it will use the default indentation-based folding range provided by VS Code.", - "scope": "window" - }, - "java.format.settings.url": { - "type": "string", - "markdownDescription": "Specifies the url or file path to the [Eclipse formatter xml settings](https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings).", - "default": null, - "scope": "window" - }, - "java.format.settings.profile": { - "type": "string", - "description": "Optional formatter profile name from the Eclipse formatter settings.", - "default": null, + "java.completion.maxResults": { + "type": "integer", + "default": 0, + "markdownDescription": "Maximum number of completion results (not including snippets).\n`0` (the default value) disables the limit, all results are returned. In case of performance problems, consider setting a sensible limit.", "scope": "window" }, - "java.format.comments.enabled": { + "java.signatureHelp.enabled": { "type": "boolean", - "description": "Includes the comments during code formatting.", "default": true, + "description": "Enable/disable the signature help.", "scope": "window" }, - "java.format.onType.enabled": { + "java.signatureHelp.description.enabled": { "type": "boolean", - "description": "Enable/disable automatic block formatting when typing `;`, `` or `}`", - "default": true, + "default": false, + "description": "Enable/disable to show the description in signature help.", "scope": "window" + } + } + }, + { + "id": "java-codegeneration", + "title": "Code Generation", + "order": 100, + "properties": { + "java.templates.fileHeader": { + "type": "array", + "markdownDescription": "Specifies the file header comment for new Java file. Supports configuring multi-line comments with an array of strings, and using ${variable} to reference the [predefined variables](command:_java.templateVariables).", + "scope": "window", + "default": [], + "order": 10 + }, + "java.templates.typeComment": { + "type": "array", + "markdownDescription": "Specifies the type comment for new Java type. Supports configuring multi-line comments with an array of strings, and using ${variable} to reference the [predefined variables](command:_java.templateVariables).", + "scope": "window", + "default": [], + "order": 20 + }, + "java.codeGeneration.insertionLocation": { + "type": "string", + "enum": [ + "afterCursor", + "beforeCursor", + "lastMember" + ], + "enumDescriptions": [ + "Insert the generated code after the member where the cursor is located.", + "Insert the generated code before the member where the cursor is located.", + "Insert the generated code as the last member of the target type." + ], + "description": "Specifies the insertion location of the code generated by source actions.", + "default": "afterCursor", + "scope": "window", + "order": 30 }, "java.codeGeneration.hashCodeEquals.useJava7Objects": { "type": "boolean", @@ -750,247 +1106,135 @@ "default": 0, "scope": "window" }, - "java.codeGeneration.insertionLocation": { - "type": "string", - "enum": [ - "afterCursor", - "beforeCursor", - "lastMember" - ], - "enumDescriptions": [ - "Insert the generated code after the member where the cursor is located.", - "Insert the generated code before the member where the cursor is located.", - "Insert the generated code as the last member of the target type." - ], - "description": "Specifies the insertion location of the code generated by source actions.", - "default": "afterCursor", - "scope": "window" - }, - "java.selectionRange.enabled": { - "type": "boolean", - "default": true, - "description": "Enable/disable Smart Selection support for Java. Disabling this option will not affect the VS Code built-in word-based and bracket-based smart selection.", - "scope": "window" - }, - "java.showBuildStatusOnStart.enabled": { - "anyOf": [ - { - "enum": [ - "notification", - "terminal", - "off" - ], - "enumDescriptions": [ - "Show the build status via progress notification on start", - "Show the build status via terminal on start", - "Do not show any build status on start" - ] - }, - "boolean" - ], - "description": "Automatically show build status on startup.", - "default": "notification", - "scope": "window" - }, - "java.configuration.runtimes": { - "type": "array", - "description": "Map Java Execution Environments to local JDKs.", - "items": { - "type": "object", - "default": {}, - "required": [ - "path", - "name" - ], - "properties": { - "name": { - "type": "string", - "enum": [ - "J2SE-1.5", - "JavaSE-1.6", - "JavaSE-1.7", - "JavaSE-1.8", - "JavaSE-9", - "JavaSE-10", - "JavaSE-11", - "JavaSE-12", - "JavaSE-13", - "JavaSE-14", - "JavaSE-15", - "JavaSE-16", - "JavaSE-17", - "JavaSE-18", - "JavaSE-19", - "JavaSE-20", - "JavaSE-21" - ], - "description": "Java Execution Environment name. Must be unique." - }, - "path": { - "type": "string", - "pattern": ".*(? { + const config = await getContributesConfiguration(context, "java.configuration.runtimes"); + cachedJreNames = config?.items?.properties?.name?.enum; +} + +async function getContributesConfiguration(context: ExtensionContext, configId: string): Promise { const buffer = await workspace.fs.readFile(Uri.file(context.asAbsolutePath("package.json"))); const packageJson = JSON.parse(buffer.toString()); - cachedJreNames = packageJson?.contributes?.configuration?.properties?.["java.configuration.runtimes"]?.items?.properties?.name?.enum; + /** + * contributes.configuration can either be a single object, + * representing a single category of settings, or an array + * of objects, representing multiple categories of settings. + */ + const categories = packageJson?.contributes?.configuration; + if (Array.isArray(categories)) { + for (const category of categories) { + if (category?.properties?.[configId]) { + return category.properties[configId]; + } + } + } else { + return categories?.properties?.[configId]; + } } export function getSupportedJreNames(): string[] {