8000 Improve launch.json auto-generation UX by Eskibear · Pull Request #342 · microsoft/vscode-java-debug · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
32 changes: 19 additions & 13 deletions src/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,36 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
return vscode.window.withProgress({location: vscode.ProgressLocation.Window}, (p) => {
return new Promise((resolve, reject) => {
p.report({message: "Auto generating configuration..."});
resolveMainClass(folder ? folder.uri : undefined).then((res: IMainClassOption []) => {
resolveMainClass(folder ? folder.uri : undefined).then((res: IMainClassOption[]) => {
let cache;
cache = {};
const defaultLaunchConfig = {
type: "java",
name: "Debug (Launch)",
request: "launch",
// tslint:disable-next-line
cwd: "${workspaceFolder}",
console: "internalConsole",
stopOnEntry: false,
mainClass: "",
args: "",
};
const launchConfigs = res.map((item) => {
return {
type: "java",
...defaultLaunchConfig,
name: this.constructLaunchConfigName(item.mainClass, item.projectName, cache),
request: "launch",
// tslint:disable-next-line
cwd: "${workspaceFolder}",
console: "internalConsole",
stopOnEntry: false,
mainClass: item.mainClass,
projectName: item.projectName,
args: "",
};
});
resolve([...launchConfigs, {
const defaultAttachConfig = {
type: "java",
name: "Debug (Attach)",
request: "attach",
hostName: "localhost",
port: 0,
}]);
port: "<debug port of remote debuggee>",
};
resolve([defaultLaunchConfig, ...launchConfigs, defaultAttachConfig]);
}, (ex) => {
p.report({message: `failed to generate configuration. ${ex}`});
reject(ex);
Expand Down Expand Up @@ -118,7 +124,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
return;
}
config.mainClass = userSelection.mainClass;
config.projectName = userSelection.projectName;
config.projectName = userSelection.projectName;
}
if (this.isEmptyArray(config.classPaths) && this.isEmptyArray(config.modulePaths)) {
const result = <any[]>(await resolveClasspath(config.mainClass, config.projectName));
Expand Down Expand Up @@ -209,7 +215,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
label: name,
item,
};
}).sort ((a, b): number => {
}).sort((a, b): number => {
return a.label > b.label ? 1 : -1;
});
const selection = pickItems.length > 1 ?
Expand Down
0