-
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
How to pass VSC variables from c_cpp_properties.json to a Task? #742
Comments
You have to manually open the makefile and modify the includePath/defines settings in c_cpp_properties.json accordingly. Does that work for you? |
Editing the make-file works for me, but the idea was to have a better integration. Leveraging Visual Studio Code interface to set parameters and retrieving those parameters from the makefile. Is there something like |
Which VS Code variables are you trying to read? Our extension does not set any environment variables. The contents of c_cpp_properties.json is not exported to the environment. |
@rei-vilo I assume you mean editing the "c_cpp_properties.json"? You shouldn't need to edit the makefile. Are you asking for cpptools to read the makefile and set the includePath and defines ourselves? Visual Studio 2017 does that for cmake, but we haven't implemented that yet. Theoretically, anyone could write a VS Code extension (or any script) that read makefiles or other build settings and read/modified our c_cpp_properties.json to correctly set the includePath/defines. |
I've modified
I need to get the |
Once a configuration is selected, e.g.
|
Title How to pass VSC variables from c_cpp_properties.json to a Task? seems more appropriate. |
@rei-vilo There is currently no way to automatically get the value of the cpptools configuration name. |
Ok, thanks, this is a show-stopper. |
Maybe you can help on this issue too. |
@bobbrow What do mean by more info needed? |
I removed that tag while doing some issue cleanup last week. It was set a long time ago before we understood the issue. |
From c_cpp_properties.json reference | Configuration properties
Why not provide a similar logic for definitions tasks.json may read and use from c_cpp_properties.json? Integrate with External Tools via Tasks | Variable substitution details Predefined variables, Environment variables and Configuration variables, but is mum about variables defined in c_cpp_properties.json |
VS Code itself controls the execution of tasks.json and there's no way for us to get them to use c_cpp_properties.json info. |
Sorry, I should have resolved this issue a long time ago. VS Code added a feature that lets us do this and we added a command to get the active configuration name that you can use in your tasks.json.
|
Thank you! |
@bobbrow It works fine. Where can I find the documentation related to this feature? Pages Customizing default settings and c_cpp_properties.json reference for the C++ extension, and page Integrate with External Tools via Tasks for Tasks, do not mention Thank you! |
I'm running a makefile with the C/C++ for Visual Studio Code extension and I've defined some configurations in
c_cpp_properties.json
.How to read and get the configurations values from the makefile?
Thanks!
The text was updated successfully, but these errors were encountered: