Skip to content
Closed
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
16 changes: 16 additions & 0 deletions src/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,21 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
}).sort ((a, b): number => {
return a.label > b.label ? 1 : -1;
});
// try to filter the only class same as the current file, if found one, use this one.
if (vscode.window.activeTextEditor
&& vscode.window.activeTextEditor.document && vscode.window.activeTextEditor.document.fileName) {
const narrowedChoice = pickItems.filter((options) => {
return options && options.item && options.item.filePath &&
(options.item.filePath === vscode.window.activeTextEditor.document.fileName ||
(process.platform === "win32"
&& options.item.filePath.toLowerCase() === vscode.window.activeTextEditor.document.fileName.toLowerCase()));
});

if (narrowedChoice.length === 1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of remove items from the list, can we highlight the item that is currently selected from the active document?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not available in vscode

return narrowedChoice[0].item;
}
}

const selection = pickItems.length > 1 ?
await vscode.window.showQuickPick(pickItems, { placeHolder: "Select main class<project name>" })
: pickItems[0];
Expand Down Expand Up @@ -273,5 +288,6 @@ function convertLogLevel(commonLogLevel: string) {

interface IMainClassOption {
readonly projectName?: string;
readonly filePath?: string;
readonly mainClass: string;
}