Skip to content

Comments

if current file is not a main class, 'Run Java' will run previously used app#1301

Merged
testforstephen merged 4 commits intomicrosoft:mainfrom
testforstephen:jinbo_launch
Feb 24, 2023
Merged

if current file is not a main class, 'Run Java' will run previously used app#1301
testforstephen merged 4 commits intomicrosoft:mainfrom
testforstephen:jinbo_launch

Conversation

@testforstephen
Copy link
Contributor

Fixes #1036

Old:

  • If current file is a main class, run it directly.
  • If current file is not a main class, it will always pop up a dialog to select the target main class to run.

New:

  • If current file is a main class, "Run Java" will still run current file as past.
  • If current file is not a main class, then run previously launched application automatically.
launchUX.mp4

filePath ? vscode.workspace.getWorkspaceFolder(vscode.Uri.file(filePath)) : undefined;
const launchConfigurations: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("launch", workspaceFolder);
const existingConfigs: vscode.DebugConfiguration[] = launchConfigurations.configurations;
const existConfig: vscode.DebugConfiguration | undefined = _.find(existingConfigs, (config) => {
Copy link
Member

Choose a reason for hiding this comment

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

What if the user has two debug configurations, whose mainClass and projectName are the same but other options like args, vmArgs are different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first one will be used. This might be a rare case, since no complaint received yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a "launch previously launched application option if the current file isn't executable" option.

2 participants