Skip to content
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
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@
"category": "Java"
},
{
"command": "java.project.import",
"command": "java.project.import.command",
"title": "%java.project.import%",
"category": "Java"
},
Expand Down Expand Up @@ -912,22 +912,22 @@
"category": "Java"
},
{
"command": "java.project.updateSourceAttachment",
"command": "java.project.updateSourceAttachment.command",
"title": "%java.project.updateSourceAttachment%",
"category": "Java"
},
{
"command": "java.project.addToSourcePath",
"command": "java.project.addToSourcePath.command",
"title": "%java.project.addToSourcePath%",
"category": "Java"
},
{
"command": "java.project.removeFromSourcePath",
"command": "java.project.removeFromSourcePath.command",
"title": "%java.project.removeFromSourcePath%",
"category": "Java"
},
{
"command": "java.project.listSourcePaths",
"command": "java.project.listSourcePaths.command",
"title": "%java.project.listSourcePaths%",
"category": "Java"
},
Expand Down Expand Up @@ -999,18 +999,18 @@
},
{
"when": "explorerResourceIsFolder&&javaLSReady",
"command": "java.project.addToSourcePath",
"command": "java.project.addToSourcePath.command",
"group": "1_javaactions@1"
},
{
"when": "explorerResourceIsFolder&&javaLSReady",
"command": "java.project.removeFromSourcePath",
"command": "java.project.removeFromSourcePath.command",
"group": "1_javaactions@2"
}
],
"editor/context": [
{
"command": "java.project.updateSourceAttachment",
"command": "java.project.updateSourceAttachment.command",
"when": "editorReadonly && editorLangId == java",
"group": "1_javaactions"
},
Expand All @@ -1036,7 +1036,7 @@
"when": "javaLSReady"
},
{
"command": "java.project.import",
"command": "java.project.import.command",
"when": "javaLSReady"
},
{
Expand All @@ -1048,7 +1048,7 @@
"when": "javaLSReady"
},
{
"command": "java.project.listSourcePaths",
"command": "java.project.listSourcePaths.command",
"when": "javaLSReady"
},
{
Expand All @@ -1072,15 +1072,15 @@
"when": "false"
},
{
"command": "java.project.updateSourceAttachment",
"command": "java.project.updateSourceAttachment.command",
"when": "false"
},
{
"command": "java.project.addToSourcePath",
"command": "java.project.addToSourcePath.command",
"when": "false"
},
{
"command": "java.project.removeFromSourcePath",
"command": "java.project.removeFromSourcePath.command",
"when": "false"
},
{
Expand Down
6 changes: 3 additions & 3 deletions src/buildpath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ListCommandResult extends Result {
}

export function registerCommands(context: ExtensionContext) {
context.subscriptions.push(commands.registerCommand(Commands.ADD_TO_SOURCEPATH, async (uri: Uri) => {
context.subscriptions.push(commands.registerCommand(Commands.ADD_TO_SOURCEPATH_CMD, async (uri: Uri) => {
const result = await <any>commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.ADD_TO_SOURCEPATH, uri.toString());
if (result.status) {
if (result.sourcePaths) {
Expand All @@ -33,7 +33,7 @@ export function registerCommands(context: ExtensionContext) {
}
}));

context.subscriptions.push(commands.registerCommand(Commands.REMOVE_FROM_SOURCEPATH, async (uri: Uri) => {
context.subscriptions.push(commands.registerCommand(Commands.REMOVE_FROM_SOURCEPATH_CMD, async (uri: Uri) => {
const result = await <any>commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.REMOVE_FROM_SOURCEPATH, uri.toString());
if (result.status) {
if (result.sourcePaths) {
Expand All @@ -45,7 +45,7 @@ export function registerCommands(context: ExtensionContext) {
}
}));

context.subscriptions.push(commands.registerCommand(Commands.LIST_SOURCEPATHS, async() => {
context.subscriptions.push(commands.registerCommand(Commands.LIST_SOURCEPATHS_CMD, async() => {
const result: ListCommandResult = await commands.executeCommand<ListCommandResult>(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.LIST_SOURCEPATHS);
if (result.status) {
if (!result.data || !result.data.length) {
Expand Down
10 changes: 10 additions & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,37 @@ export namespace Commands {
export const CLEAN_WORKSPACE = 'java.clean.workspace';
/**
* Update the source attachment for the selected class file
* client-side & server-side commands
*/
export const UPDATE_SOURCE_ATTACHMENT_CMD = 'java.project.updateSourceAttachment.command';
export const UPDATE_SOURCE_ATTACHMENT = 'java.project.updateSourceAttachment';
/**
* Resolve the source attachment information for the selected class file
*/
export const RESOLVE_SOURCE_ATTACHMENT = 'java.project.resolveSourceAttachment';
/**
* Mark the folder as the source root of the closest project.
* client-side & server-side commands
*/
export const ADD_TO_SOURCEPATH_CMD = 'java.project.addToSourcePath.command';
export const ADD_TO_SOURCEPATH = 'java.project.addToSourcePath';
/**
* Unmark the folder as the source root of the project.
* client-side & server-side commands
*/
export const REMOVE_FROM_SOURCEPATH_CMD = 'java.project.removeFromSourcePath.command';
export const REMOVE_FROM_SOURCEPATH = 'java.project.removeFromSourcePath';
/**
* List all recognized source roots in the workspace.
* client-side & server-side commands
*/
export const LIST_SOURCEPATHS_CMD = 'java.project.listSourcePaths.command';
export const LIST_SOURCEPATHS = 'java.project.listSourcePaths';
/**
* Import new projects
* client-side & server-side commands
*/
export const IMPORT_PROJECTS_CMD = 'java.project.import.command';
export const IMPORT_PROJECTS = 'java.project.import';
/**
* Override or implements the methods from the supertypes.
Expand Down
2 changes: 1 addition & 1 deletion src/fileEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function handleNewJavaFiles(e: FileCreateEvent) {

let sourcePaths: string[] = [];
if (serverReady) {
const result: ListCommandResult = await commands.executeCommand<ListCommandResult>(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.LIST_SOURCEPATHS);
const result: ListCommandResult = await commands.executeCommand<ListCommandResult>(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.LIST_SOURCEPATHS_CMD);
if (result && result.data && result.data.length) {
sourcePaths = result.data.map((sourcePath) => sourcePath.path).sort((a, b) => b.length - a.length);
}
Expand Down
8 changes: 4 additions & 4 deletions src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class StandardLanguageClient {
} else if (choice.startsWith(USE_JAVA)) {
await workspace.getConfiguration().update(GRADLE_IMPORT_JVM, newJavaHome, ConfigurationTarget.Global);
commands.executeCommand("workbench.action.openSettings", GRADLE_IMPORT_JVM);
commands.executeCommand(Commands.IMPORT_PROJECTS);
commands.executeCommand(Commands.IMPORT_PROJECTS_CMD);
} else if (choice.startsWith(UPGRADE_GRADLE)) {
const useWrapper = workspace.getConfiguration().get<boolean>("java.import.gradle.wrapper.enabled");
if (!useWrapper) {
Expand All @@ -285,14 +285,14 @@ export class StandardLanguageClient {
window.showTextDocument(document, {selection: new Range(distributionUrlRange.start, new Position(distributionUrlRange.start.line + 1, 0))});
}
}
commands.executeCommand(Commands.IMPORT_PROJECTS);
commands.executeCommand(Commands.IMPORT_PROJECTS_CMD);
}
}
});
}

private registerCommandsForStandardServer(context: ExtensionContext, jdtEventEmitter: EventEmitter<Uri>): void {
context.subscriptions.push(commands.registerCommand(Commands.IMPORT_PROJECTS, async () => {
context.subscriptions.push(commands.registerCommand(Commands.IMPORT_PROJECTS_CMD, async () => {
return await commands.executeCommand<void>(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.IMPORT_PROJECTS);
}));

Expand Down Expand Up @@ -432,7 +432,7 @@ export class StandardLanguageClient {
});
}));

context.subscriptions.push(commands.registerCommand(Commands.UPDATE_SOURCE_ATTACHMENT, async (classFileUri: Uri): Promise<boolean> => {
context.subscriptions.push(commands.registerCommand(Commands.UPDATE_SOURCE_ATTACHMENT_CMD, async (classFileUri: Uri): Promise<boolean> => {
const resolveRequest: SourceAttachmentRequest = {
classFileUri: classFileUri.toString(),
};
Expand Down
10 changes: 5 additions & 5 deletions test/standard-mode-suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ suite('Java Language Extension - Standard', () => {
return vscode.commands.getCommands(true).then((commands) =>
{
const JAVA_COMMANDS = [
Commands.ADD_TO_SOURCEPATH,
Commands.ADD_TO_SOURCEPATH_CMD,
Commands.APPLY_REFACTORING_COMMAND,
Commands.APPLY_WORKSPACE_EDIT,
Commands.CHOOSE_IMPORTS,
Expand All @@ -46,8 +46,8 @@ suite('Java Language Extension - Standard', () => {
Commands.HASHCODE_EQUALS_PROMPT,
Commands.IGNORE_INCOMPLETE_CLASSPATH,
Commands.IGNORE_INCOMPLETE_CLASSPATH_HELP,
Commands.IMPORT_PROJECTS,
Commands.LIST_SOURCEPATHS,
Commands.IMPORT_PROJECTS_CMD,
Commands.LIST_SOURCEPATHS_CMD,
Commands.NAVIGATE_TO_SUPER_IMPLEMENTATION_COMMAND,
Commands.OPEN_CLIENT_LOG,
Commands.OPEN_FORMATTER,
Expand All @@ -58,13 +58,13 @@ suite('Java Language Extension - Standard', () => {
Commands.ORGANIZE_IMPORTS,
Commands.OVERRIDE_METHODS_PROMPT,
Commands.PROJECT_CONFIGURATION_STATUS,
Commands.REMOVE_FROM_SOURCEPATH,
Commands.REMOVE_FROM_SOURCEPATH_CMD,
Commands.RENAME_COMMAND,
Commands.SHOW_JAVA_IMPLEMENTATIONS,
Commands.SHOW_JAVA_REFERENCES,
Commands.SHOW_SERVER_TASK_STATUS,
Commands.SWITCH_SERVER_MODE,
Commands.UPDATE_SOURCE_ATTACHMENT,
Commands.UPDATE_SOURCE_ATTACHMENT_CMD,
Commands.RUNTIME_VALIDATION_OPEN,
Commands.CHANGE_BASE_TYPE,
Commands.SHOW_TYPE_HIERARCHY,
Expand Down
2 changes: 1 addition & 1 deletion test/standard-mode-suite/publicApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ suite('Public APIs - Standard', () => {
api.onDidProjectsImport(() => {
return resolve();
});
await commands.executeCommand(Commands.IMPORT_PROJECTS);
await commands.executeCommand(Commands.IMPORT_PROJECTS_CMD);
});
});

Expand Down