in src/configurationProvider.ts [518:554]
private async resolveMainClass(config: vscode.DebugConfiguration, progressReporter: IProgressReporter):
Promise<lsPlugin.IMainClassOption | undefined> {
if (config.projectName) {
if (this.isFilePath(config.mainClass)) {
const mainEntries = await lsPlugin.resolveMainMethod(vscode.Uri.file(config.mainClass));
if (progressReporter.isCancelled()) {
return undefined;
} else if (mainEntries.length) {
if (!mainClassPicker.isAutoPicked(mainEntries)) {
progressReporter.hide(true);
}
return mainClassPicker.showQuickPick(mainEntries, "Please select a main class you want to run.");
}
}
return this.promptMainClassUnderProject(config.projectName, progressReporter, "Please select a main class you wan to run");
}
// Try to resolve main class from current file
const currentFile = config.mainClass || vscode.window.activeTextEditor?.document.uri.fsPath;
if (currentFile) {
const mainEntries = await lsPlugin.resolveMainMethod(vscode.Uri.file(currentFile));
if (progressReporter.isCancelled()) {
return undefined;
} else if (mainEntries.length) {
if (!mainClassPicker.isAutoPicked(mainEntries)) {
progressReporter.hide(true);
}
return mainClassPicker.showQuickPick(mainEntries, "Please select a main class you want to run.");
}
}
const hintMessage = currentFile ?
`The file '${path.basename(currentFile)}' is not executable, please select a main class you want to run.` :
"Please select a main class you want to run.";
return this.promptMainClassUnderPath(undefined, progressReporter, hintMessage);
}