Skip to content

Fix launch configuration input variable resolution. #97440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 23, 2020

Conversation

bzarco
Copy link
Contributor

@bzarco bzarco commented May 11, 2020

When resolving launch configuration variables during a debug session, the configuration target was not being specified, always defaulting to reading workspace folder inputs. This made it impossible for user or workspace file launch configurations to use input variables, as the inputs list was never found.

This change forwards the launch configuration source to the configurationResolverService, so that it looks for the inputs list in the right place.

Forwarding the source fixed single-root workspaces, but multi-root workspaces were skipping the inputs lookup, since they pass an undefined workspace folder... In this case, the workspace folder is not relevant, as the config and inputs are defined in the workspace file, and allowing resolution to continue yields the desired behavior.

This PR fixes #96522

@bzarco
Copy link
Contributor Author

bzarco commented May 11, 2020

For the record, tasks already forward the source correctly, passing TaskSourceKind.toConfigurationTarget(task._source.kind), that is why they do the right thing.

bzarco added a commit to bzarco/vscode that referenced this pull request May 11, 2020
Tasks pass the first workspace folder in multi-root workspaces, but launch configurations do not. This makes their behaviors different, which is confusing to the user.

The discrepancy is also a potential source of bugs, as developers may assume same behavior and only test one path (e.g. microsoft#95482, microsoft#96570, microsoft#97202, microsoft#97440).
bzarco added a commit to bzarco/vscode that referenced this pull request May 11, 2020
Tasks pass the first workspace folder in multi-root workspaces, but launch configurations do not. This makes their behaviors different, which is confusing to the user.

The discrepancy is also a potential source of bugs, as developers may assume same behavior and only test one path (e.g. microsoft#95482, microsoft#96570, microsoft#97202, microsoft#97440).
@Tyriar Tyriar assigned weinand and alexr00 and unassigned weinand May 11, 2020
bzarco added 2 commits May 20, 2020 22:51
When resolving launch configuration variables during a debug session, the configuration target was not being specified, always defaulting to reading workspace folder inputs. This made it impossible for user or workspace file launch configurations to use input variables, as the inputs list was never found.

This change forwards the launch configuration source to the configurationResolverService, so that it looks for the inputs list in the right place.

Forwarding the source fixed single-root workspaces, but multi-root workspaces were skipping the inputs lookup, since they pass an undefined workspace folder... In this case, the workspace folder is not relevant, as the config and inputs are defined in the workspace file, and allowing resolution to continue yields the desired behavior.
@bzarco bzarco force-pushed the launch-input-variables branch from 10f8f7b to 352f231 Compare May 21, 2020 02:52
@bzarco
Copy link
Contributor Author

bzarco commented May 21, 2020

Any chance this could make it in the May milestone (assuming it looks good :) )? Would love to be able to use input variables in our launch configs... Thanks!

@alexr00
Copy link
Member

alexr00 commented Jul 7, 2020

I'm fine with the configuration resolver related changes. @isidorn or @weinand for the debug changes.

@dslijepcevic
Copy link

What is the status of this PR, will it be merged anytime soon? For our team it's a major headache because the dynamic workspace file that we generate during configuration process is useless without being able to use input variables in launch configurations. I fear we will have to resort to programatically modifying folder's launch.json and tasks.json and these files are not checked in a repo and are meant for developers' own usage. Looks like a dirty hack to me :(

@weinand
Copy link
Contributor

weinand commented Oct 10, 2020

I'm on vacation right now, but will resolve the issue ASAP.

@dslijepcevic
Copy link

@weinand Thank you, I appreciate it!

@weinand weinand added this to the October 2020 milestone Oct 23, 2020
@alexr00 alexr00 removed their assignment Oct 23, 2020
@weinand
Copy link
Contributor

weinand commented Oct 23, 2020

@bzarco PR looks good and works fine.
Thanks a lot.

@weinand weinand merged commit e0a433b into microsoft:master Oct 23, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User input variables not working for launch configuration in multi-root workspace
5 participants