Skip to content

Commit 8348f61

Browse files
Report errors when configuring a wrong runtime path (#1625)
Signed-off-by: Jinbo Wang <[email protected]>
1 parent 85941bf commit 8348f61

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@
501501
},
502502
"path": {
503503
"type": "string",
504-
"description": "JDK path.\nOn Windows, backslashes must be escaped, i.e.\n\"path\":\"C:\\\\Program Files\\\\Java\\\\jdk1.8.0_161\"."
504+
"pattern": ".*(?<!\\/bin|\\/bin\\/|\\\\bin|\\\\bin\\\\)$",
505+
"description": "JDK home path. Should be the JDK installation directory, not the Java bin path.\n On Windows, backslashes must be escaped, i.e.\n\"path\":\"C:\\\\Program Files\\\\Java\\\\jdk1.8.0_161\"."
505506
},
506507
"sources": {
507508
"type": "string",

src/commands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,6 @@ export namespace Commands {
218218
export const LEARN_MORE_ABOUT_REFACTORING = '_java.learnMoreAboutRefactorings';
219219

220220
export const TEMPLATE_VARIABLES = '_java.templateVariables';
221+
222+
export const RUNTIME_VALIDATION_OPEN = 'java.runtimeValidation.open';
221223
}

src/extension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
179179
clientDocumentSymbolProvider: true,
180180
gradleChecksumWrapperPromptSupport: true,
181181
resolveAdditionalTextEditsSupport: true,
182-
advancedIntroduceParameterRefactoringSupport: true
182+
advancedIntroduceParameterRefactoringSupport: true,
183+
actionableRuntimeNotificationSupport: true
183184
},
184185
triggerFiles,
185186
},

src/standardLanguageClient.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ export class StandardLanguageClient {
4444
commands.executeCommand(Commands.SHOW_SERVER_TASK_STATUS);
4545
}
4646

47+
context.subscriptions.push(commands.registerCommand(Commands.RUNTIME_VALIDATION_OPEN, () => {
48+
commands.executeCommand("workbench.action.openSettings", "java.configuration.runtimes");
49+
}));
50+
4751
serverStatus.initialize();
4852
serverStatus.onServerStatusChanged(status => {
4953
if (status === ServerStatusKind.Busy) {

test/standard-mode-suite/extension.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ suite('Java Language Extension - Standard', () => {
6464
Commands.SHOW_JAVA_REFERENCES,
6565
Commands.SHOW_SERVER_TASK_STATUS,
6666
Commands.SWITCH_SERVER_MODE,
67-
Commands.UPDATE_SOURCE_ATTACHMENT
67+
Commands.UPDATE_SOURCE_ATTACHMENT,
68+
Commands.RUNTIME_VALIDATION_OPEN
6869
].sort();
6970
const foundJavaCommands = commands.filter((value) => {
7071
return JAVA_COMMANDS.indexOf(value)>=0 || value.startsWith('java.');

0 commit comments

Comments
 (0)