-
Notifications
You must be signed in to change notification settings - Fork 1.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
Connect c_cpp configuration with task #1285
Comments
The VS Code team owns the variable substitution rules for tasks.json. Environment variables are supported by both tasks.json and c_cpp_properties.json, so the only way I can think of to share data between the two files right now is via environment variables. I don't think it would be too big of a stretch to ask the VS Code team to support substitution of settings in tasks.json. At some point in the future we plan to deprecate c_cpp_properties.json and move those settings into settings.json so if VS Code were to add this feature we would be able to supplement it in the future. |
This would make vscode a viable option for not so simple c++ projects. Especially the current active build configuration should be available in tasks. It does not make a lot of sense to have different configurations in c_cpp_properties.json and then not being able to use these while building. Usually at least the build directory would be different depending on configuration. |
This topic has already been disussed in #742, but seems still be an issue. |
This would be a very nice feature to have. Right now, when I want to change my configuration from Another possibility, which would achieve similar results, would be to have different tasks for each configuration on tasks.json, and then reference one of these tasks in C_Cpp_properties.json, depending on the active configuration. The same could apply to the different configurations in launch.json. For me this could be better, because my configuration names do not exactly match the names of my build commands. Moreover, I have different compiler flags for my There is a similar feature already existing between the tasks.json and launch.json files: setting an Should I post this in #43782? |
We added the ability to consume the active configuration in version 0.22.0, but forgot to update this thread. You can use |
@bobbrow Can these commands receive arguments? Would it be feasible to have something like: Then |
@xorcus Commands can take values when invoked via executeCommand (see #4893 ) and in a keybinding associated with a command, but I don't think the command(arg) syntax is supported. But if you're just interested in more activeConfig* commands, then passing args isn't needed since the arg could just be part of the name of the command. Could you file a feature request that explains why it would be useful? |
@sean-mcmanus Thanks for you response. What I am looking for is exactly what was described by "How to pass VSC variables from c_cpp_properties.json to a Task? #742" (linked above in a comment by @mbodmer on Feb 15, 2018) and would also be a duplicate of this issue ("Connect c_cpp configuration with task (#1285)") I need multiple compiler configurations (e.g. I asked the question about passing arguments to a command above as I think it would spare the extension maintainers from adding support for many individual commands and would provide read-only access to all c_cpp_properties.json at once. I considered defining the values I need in environment variables and then refer to "env:" in all files ( According to a comment by @bobbrow, the extension is going to abandon the use of |
At one point I had thought that we could abandon |
My use case is much like that of @xorcus #1285 (comment) in that I must target multiple tool sets and would like to make the necessary changes in one place. For me, I already have a few environment variables which are used in |
Now that we have our own task provider, we should be able to connect these two data sources and set up the compiler command to match the active file (or the c_cpp_properties.json). |
I'm sorry for interfering this quite old issue, but could you give a direction where and how it has been solved, please? |
@DzmitrySafin It hasn't been solved. The issue is still Open. |
Would it possible to connect tasks defined in tasks.json with a configuration defined in c_cpp_properties.json.
Alternatively be able to pass defines stated in c_cpp_properties.json for the active configuration into the command field of a task in tasks.json.
The aim would be to select build task depending on active configuration, just by pressing CTRL-B, or having the configurations task selected by default in the dropdown list.
Sorry for spamming the issues section, but I spent the day at work evaluating vscode in my real production environment.
The text was updated successfully, but these errors were encountered: