Skip to content

Commit 8e87397

Browse files
committed
feat: update the feature in exp
1 parent a90af1d commit 8e87397

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"displayName": "Java: Get File Structure",
5858
"canBeReferencedInPrompt": true,
5959
"icon": "$(symbol-class)",
60+
"when": "vscode-java-dependency.enableLspTools",
6061
"inputSchema": {
6162
"type": "object",
6263
"properties": {
@@ -75,6 +76,7 @@
7576
"displayName": "Java: Find Symbol",
7677
"canBeReferencedInPrompt": true,
7778
"icon": "$(search)",
79+
"when": "vscode-java-dependency.enableLspTools",
7880
"inputSchema": {
7981
"type": "object",
8082
"properties": {
@@ -97,6 +99,7 @@
9799
"displayName": "Java: Get File Imports",
98100
"canBeReferencedInPrompt": true,
99101
"icon": "$(references)",
102+
"when": "vscode-java-dependency.enableLspTools",
100103
"inputSchema": {
101104
"type": "object",
102105
"properties": {
@@ -115,6 +118,7 @@
115118
"displayName": "Java: Get Type at Position",
116119
"canBeReferencedInPrompt": true,
117120
"icon": "$(symbol-field)",
121+
"when": "vscode-java-dependency.enableLspTools",
118122
"inputSchema": {
119123
"type": "object",
120124
"properties": {
@@ -141,6 +145,7 @@
141145
"displayName": "Java: Get Call Hierarchy",
142146
"canBeReferencedInPrompt": true,
143147
"icon": "$(call-incoming)",
148+
"when": "vscode-java-dependency.enableLspTools",
144149
"inputSchema": {
145150
"type": "object",
146151
"properties": {
@@ -173,6 +178,7 @@
173178
"displayName": "Java: Get Type Hierarchy",
174179
"canBeReferencedInPrompt": true,
175180
"icon": "$(type-hierarchy)",
181+
"when": "vscode-java-dependency.enableLspTools",
176182
"inputSchema": {
177183
"type": "object",
178184
"properties": {
@@ -511,6 +517,16 @@
511517
"type": "boolean",
512518
"description": "%configuration.java.project.explorer.showNonJavaResources%",
513519
"default": true
520+
},
521+
"vscode-java-dependency.enableLspTools": {
522+
"type": "boolean",
523+
"scope": "application",
524+
"description": "%configuration.vscode-java-dependency.enableLspTools.description%",
525+
"default": false,
526+
"tags": ["experimental"],
527+
"experiment": {
528+
"mode": "startup"
529+
}
514530
}
515531
}
516532
},
@@ -1232,12 +1248,14 @@
12321248
],
12331249
"chatSkills": [
12341250
{
1235-
"path": "./resources/skills/java-lsp-tools/SKILL.md"
1251+
"path": "./resources/skills/java-lsp-tools/SKILL.md",
1252+
"when": "vscode-java-dependency.enableLspTools"
12361253
}
12371254
],
12381255
"chatInstructions": [
12391256
{
1240-
"path": "./resources/instruments/javaLspContext.instructions.md"
1257+
"path": "./resources/instruments/javaLspContext.instructions.md",
1258+
"when": "vscode-java-dependency.enableLspTools"
12411259
}
12421260
]
12431261
},

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"configuration.java.project.exportJar.targetPath.customization": "The output path of the exported jar. Leave it empty if you want to manually pick the output location.",
5151
"configuration.java.project.exportJar.targetPath.workspaceFolder": "Export the jar file into the workspace folder. Its name is the same as the folder's.",
5252
"configuration.java.project.exportJar.targetPath.select": "Select output location manually when exporting the jar file.",
53+
"configuration.vscode-java-dependency.enableLspTools.description": "Enable LSP tools for Java projects.",
5354
"taskDefinitions.java.project.exportJar.label": "The label of export jar task.",
5455
"taskDefinitions.java.project.exportJar.elements": "The content list of the exported jar.",
5556
"taskDefinitions.java.project.exportJar.mainClass": "The main class in the manifest of the exported jar.",

src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export namespace Context {
99
export const WORKSPACE_CONTAINS_BUILD_FILES: string = "java:workspaceContainsBuildFiles";
1010
export const RELOAD_PROJECT_ACTIVE: string = "java:reloadProjectActive";
1111
export const SHOW_DEPRECATED_TASKS: string = "java:showDeprecatedTasks";
12-
export const LSP_TOOLS_READY: string = "java:lspToolsReady";
1312
}
1413

1514
export namespace Explorer {

src/extension.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ async function activateExtension(_operationId: string, context: ExtensionContext
8888

8989
// Register Copilot context providers after Java Language Server is ready
9090
languageServerApiManager.ready().then((isReady) => {
91-
if (isReady) {
91+
const config = workspace.getConfiguration("vscode-java-dependency");
92+
const isSettingEnabled = config.get<boolean>("enableLspTools", true);
93+
if (isReady && isSettingEnabled) {
9294
registerJavaContextTools(context);
93-
contextManager.setContextValue(Context.LSP_TOOLS_READY, true);
9495
}
9596
});
9697
}

0 commit comments

Comments
 (0)