Skip to content

Commit 3297423

Browse files
hopehadfieldrgrunber
authored andcommitted
Add setting to support method implementation code lens
Signed-off-by: Hope Hadfield <hadfieldhope@gmail.com>
1 parent eb145da commit 3297423

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ The following settings are supported:
123123
* `java.configuration.maven.userSettings` : Path to Maven's user settings.xml.
124124
* `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`.
125125
* `java.referencesCodeLens.enabled` : Enable/disable the references code lenses.
126-
* `java.implementationsCodeLens.enabled` : Enable/disable the implementations code lenses.
126+
* `java.implementationCodeLens` : Enable/disable the implementations code lens for the provided categories.
127127
* `java.signatureHelp.enabled` : Enable/disable signature help support (triggered on `(`).
128128
* `java.signatureHelp.description.enabled` : Enable/disable to show the description in signature help. Defaults to `false`.
129129
* `java.contentProvider.preferred` : Preferred content provider (see 3rd party decompilers available in [vscode-java-decompiler](https://github.com/dgileadi/vscode-java-decompiler)).

package.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,10 +1409,22 @@
14091409
"scope": "window",
14101410
"order": 10
14111411
},
1412-
"java.implementationsCodeLens.enabled": {
1413-
"type": "boolean",
1414-
"default": false,
1415-
"description": "Enable/disable the implementations code lens.",
1412+
"java.implementationCodeLens": {
1413+
"type": "string",
1414+
"enum": [
1415+
"none",
1416+
"types",
1417+
"methods",
1418+
"all"
1419+
],
1420+
"enumDescriptions": [
1421+
"Disable the implementations code lens",
1422+
"Enable the implementations code lens only for types",
1423+
"Enable the implementations code lens only for methods",
1424+
"Enable the implementations code lens for types and methods"
1425+
],
1426+
"default": "none",
1427+
"description": "Enable/disable the implementations code lens for the provided categories.",
14161428
"scope": "window",
14171429
"order": 20
14181430
},

src/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ export async function getJavaConfig(javaHome: string) {
272272
const userConfiguredJREs: any[] = javaConfig.configuration.runtimes;
273273
javaConfig.configuration.runtimes = await addAutoDetectedJdks(userConfiguredJREs);
274274
}
275+
276+
if (!isPreferenceOverridden("java.implementationCodeLens") && typeof javaConfig.implementationsCodeLens?.enabled === 'boolean'){
277+
const deprecatedImplementations = javaConfig.implementationsCodeLens.enabled;
278+
javaConfig.implementationCodeLens = deprecatedImplementations ? "types" : "none";
279+
}
280+
275281
return javaConfig;
276282
}
277283

0 commit comments

Comments
 (0)