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
6 changes: 3 additions & 3 deletions src/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
progressReporter.observe(token);
const defaultLaunchConfig = {
type: "java",
name: "Launch Current File",
name: "Current File",
request: "launch",
// tslint:disable-next-line
mainClass: "${file}",
Expand Down Expand Up @@ -169,7 +169,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
}

private constructLaunchConfigName(mainClass: string, cache: { [key: string]: any }) {
const name = `Launch ${mainClass.substr(mainClass.lastIndexOf(".") + 1)}`;
const name = `${mainClass.substr(mainClass.lastIndexOf(".") + 1)}`;
if (cache[name] === undefined) {
cache[name] = 0;
return name;
Expand Down Expand Up @@ -204,7 +204,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
if (!progressReporter && config.__progressId) {
return undefined;
} else if (!progressReporter) {
progressReporter = progressProvider.createProgressReporter(config.noDebug ? "Run" : "Debug");
progressReporter = progressProvider.createProgressReporter(utility.launchJobName(config.name, config.noDebug));
}

progressReporter.observe(token);
Expand Down
2 changes: 1 addition & 1 deletion src/debugCodeLensProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async function constructDebugConfig(mainClass: string, projectName: string, work
if (!debugConfig) {
debugConfig = {
type: "java",
name: `Launch ${mainClass.substr(mainClass.lastIndexOf(".") + 1)}`,
name: `${mainClass.substr(mainClass.lastIndexOf(".") + 1)}`,
request: "launch",
mainClass,
projectName,
Expand Down
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ async function launchMain(mainMethods: IMainClassOption[], uri: vscode.Uri, noDe
throw new utility.OperationCancelledError("");
}

progressReporter.setJobName(utility.launchJobNameByMainClass(pick.mainClass, noDebug));
progressReporter.report("Launching main class...");
startDebugging(pick.mainClass, pick.projectName || "", uri, noDebug, progressReporter);
}
Expand Down Expand Up @@ -366,6 +367,7 @@ async function runJavaProject(node: any, noDebug: boolean) {
throw new utility.OperationCancelledError("");
}

progressReporter.setJobName(utility.launchJobNameByMainClass(pick.mainClass, noDebug));
progressReporter.report("Launching main class...");
const projectName: string | undefined = pick.projectName;
const mainClass: string = pick.mainClass;
Expand All @@ -379,7 +381,7 @@ async function runJavaProject(node: any, noDebug: boolean) {
});
const debugConfig = existConfig || {
type: "java",
name: `Launch ${mainClass.substr(mainClass.lastIndexOf(".") + 1)}`,
name: `${mainClass.substr(mainClass.lastIndexOf(".") + 1)}`,
request: "launch",
mainClass,
projectName,
Expand Down
6 changes: 6 additions & 0 deletions src/progressAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
import { CancellationToken, ProgressLocation } from "vscode";

export interface IProgressReporter {
/**
* Set the job name.
* @param jobName the job name
*/
setJobName(jobName: string): void;

/**
* Returns the id of the progress reporter.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/progressImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class ProgressReporter implements IProgressReporter {
this._disposables.push(this._tokenSource);
}

public setJobName(jobName: string): void {
this._jobName = jobName;
}

public getId(): string {
return this._id;
}
Expand Down
10 changes: 10 additions & 0 deletions src/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,13 @@ function getJavaServerMode(): ServerMode {
return vscode.workspace.getConfiguration().get("java.server.launchMode")
|| ServerMode.HYBRID;
}

export function launchJobName(configName: string, noDebug: boolean): string {
let jobName = noDebug ? "Run" : "Debug";
jobName += configName ? ` '${configName} '` : "";
return jobName;
}

export function launchJobNameByMainClass(mainClass: string, noDebug: boolean): string {
return launchJobName(mainClass.substr(mainClass.lastIndexOf(".") + 1), noDebug);
}