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

Add setting to support method implementation code lens #3876

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The following settings are supported:
* `java.configuration.maven.userSettings` : Path to Maven's user settings.xml.
* `java.configuration.checkProjectSettingsExclusions`: **Deprecated, 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.** Controls whether to exclude extension-generated project settings files (`.project`, `.classpath`, `.factorypath`, `.settings/`) from the file explorer. Defaults to `false`.
* `java.referencesCodeLens.enabled` : Enable/disable the references code lenses.
* `java.implementationsCodeLens.enabled` : Enable/disable the implementations code lenses.
* `java.implementationCodeLens` : Enable/disable the implementations code lens for the provided categories.
* `java.signatureHelp.enabled` : Enable/disable signature help support (triggered on `(`).
* `java.signatureHelp.description.enabled` : Enable/disable to show the description in signature help. Defaults to `false`.
* `java.contentProvider.preferred` : Preferred content provider (see 3rd party decompilers available in [vscode-java-decompiler](https://github.com/dgileadi/vscode-java-decompiler)).
Expand Down
20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1409,10 +1409,22 @@
"scope": "window",
"order": 10
},
"java.implementationsCodeLens.enabled": {
"type": "boolean",
"default": false,
"description": "Enable/disable the implementations code lens.",
"java.implementationCodeLens": {
"type": "string",
"enum": [
"none",
"types",
"methods",
"all"
],
"enumDescriptions": [
"Disable the implementations code lens",
"Enable the implementations code lens only for types",
"Enable the implementations code lens only for methods",
"Enable the implementations code lens for types and methods"
],
"default": "none",
"description": "Enable/disable the implementations code lens for the provided categories.",
"scope": "window",
"order": 20
},
Expand Down
6 changes: 6 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ export async function getJavaConfig(javaHome: string) {
const userConfiguredJREs: any[] = javaConfig.configuration.runtimes;
javaConfig.configuration.runtimes = await addAutoDetectedJdks(userConfiguredJREs);
}

if (!isPreferenceOverridden("java.implementationCodeLens") && typeof javaConfig.implementationsCodeLens?.enabled === 'boolean'){
const deprecatedImplementations = javaConfig.implementationsCodeLens.enabled;
javaConfig.implementationCodeLens = deprecatedImplementations ? "types" : "none";
}

return javaConfig;
}

Expand Down
Loading