-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Dependent commands within launch.json #80219
Comments
You can determine the evaluation order by rearranging the lines in the launch config. Is it really necessary to introduce a special syntax for this? /cc @alexr00 |
If you consider having two variables total then no. If you consider having more than two, not allowing an order parameter is not enough in a case like this one: {
"name": ".NET Core Docker Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:2:pickRemoteProcess}",
"pipeTransport": {
"pipeProgram": "docker",
"pipeArgs": ["exec", "-i", "${command:1:pickDockerContainer}"],
"debuggerPath": "/vsdbg/vsdbg",
"pipeCwd": "${command:3:pickSomeFolder}",
"quoteArgs": false
}
} Where command order would require to be:
But then there's no way to order the json to allow for it. I do agree it's adding complexity in both the vscode code base and in its usage. In my specific case, I could live without the order parameter. Although, forcing the order of the json to apply the variables is counter intuitive since json is usually not ordered. Also, it would make this example be ordered differently than all examples of remote debugging with omnisharp and devs would need to "find out somehow" that order is important instead of getting an hint with an explicit order in the variable syntax. With that said, I'd be willing to remove the order syntax to get the rest of the code in. |
Hi @weinand , I removed the ordering part of it since it introduces complexity that's not required. An alternative would be to handle it in the variables instead, add an order property and get its order out of the variables' json instead, would be much simpler I guess. Should I keep the PR opened? Is there value for vscode? Thanks a lot! |
From #89758 I've copied my analysis of the problem: Today variable substitution is a two phase process:
If a variable is command-based (e.g. relying on some code running in an extension), the extension code has only access to the unresolved launch configuration, that means it does not see other already resolved variables. The reason for this behavior is isolation and independence from evaluation order. A consequence of this is that a launch configuration can not be considered a "sequential program", that is executed from top to bottom. I firmly believe, that this approach is a "good design" even if it has limitations. If I understand the PR #92697 from @davidruhmann correctly, then he wants to change variable substitution to this:
If a variable is command-based and has access to the (partially) resolved launch config, then its value becomes order dependent. This is a problem, because we cannot preserve the order of properties in a JSON. The order might deviate from the order a user sees in the JSON's source (e.g. the launch configuration). |
As explained above variable substitution is a two phase process for good reasons. A launch.json is a configuration mechanism and variable substitution is just a macro mechanism. |
Enable a scenario like this one:
The
pickRemoteProcess
command uses the launch task config, but in this casepickDockerContainer
requires to be fulfilled beforepickRemoteProcess
is invoked. The variable substitution syntax should allow for an order of execution and should fulfill (or update) configuration each time a substitution is handled.Would enable microsoft/vscode-docker#1235 to work.
The text was updated successfully, but these errors were encountered: