Skip to content

Add option to create launch config in workspace file#97321

Merged
isidorn merged 3 commits intomicrosoft:masterfrom
jeanp413:fix-96567
May 13, 2020
Merged

Add option to create launch config in workspace file#97321
isidorn merged 3 commits intomicrosoft:masterfrom
jeanp413:fix-96567

Conversation

@jeanp413
Copy link
Contributor

@jeanp413 jeanp413 commented May 9, 2020

This PR fixes #96567

async openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string, token?: CancellationToken): Promise<{ editor: IEditorPane | null, created: boolean }> {
const ws = this.contextService.getWorkspace();

if (ws.folders.length === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this check necesery?
If I do not have any folders in the workspace I do not even get offered "workspace" in the quick pick

Copy link
Contributor Author

@jeanp413 jeanp413 May 12, 2020

Choose a reason for hiding this comment

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

That's an edge case I found with the following steps:

  1. Open a folder f1
  2. Add to workspace folder f2. An untitled workspace will be created
  3. Remove folder f1 and f2 from the workspace. At this point we have no folders in the workspace.
  4. this.contextService.getWorkbenchState returns WorkbenchState.WORKSPACE (is this expected?) so the openConfigFile function gets called.
    Thinking more about this I'll move that check here
    if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah that state is the empty workspace state - you are stil in a workspace just do not have any folder in the workspace. So you are correct we should cover that case. Thanks

if (!launchExistInFile) {
// Launch property in workspace config not found: create one by collecting launch configs from debugConfigProviders
let content = '';
const adapter = await this.configurationManager.guessDebugger(type);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see we have similar code in the Launch. Might it make sense to extract this code to the AbstractLaunch so both clases use it? Not sure if 100% good idea..

@isidorn
Copy link
Collaborator

isidorn commented May 11, 2020

Thanks a lot for this PR, great work!
I have left some comments in the PR, can you please address them. Also

  1. There seems to be a conflict, can you please resolve it (just removing sideBySide options should do it)
  2. I am not a fan of the current UI. Can we change "workspace" to be "Workspace". Can we change the placeholder message to also mention this new optoin?

Screenshot 2020-05-11 at 13 00 26

@jeanp413
Copy link
Contributor Author

Pushed some changes addressing the feedback

@isidorn
Copy link
Collaborator

isidorn commented May 13, 2020

Thanks a lot for this PR. Merging in.
I am doing some changes in that file at the moment so I might polish it a bit on top.
☀️

@isidorn isidorn merged commit 3a28994 into microsoft:master May 13, 2020
@isidorn isidorn added this to the May 2020 milestone May 13, 2020
@jeanp413 jeanp413 deleted the fix-96567 branch May 13, 2020 12:38
@github-actions github-actions bot locked and limited conversation to collaborators Jun 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Off to create launch configuration in workspace file

2 participants