-
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
can we set includePath in c_cpp_properties.json globally? #368
Comments
This would also be very useful for me as whole my projects/folders use the same settings. |
I agree. We'll consider adding that later. |
I got around the problem by create a common config, with symbolic links to it in each project/folders .vscode directory. However, it would still be better if the settings where in settings.json. Like a lot of other extensions shouldn't the settings be in the standard settings.json. That way they could be set globally or locally as required. It would also remove one settings file. |
Surely the simplest way to address this would be to look for the c_cpp_properties.json file in the user settings folder if it isn't found for the workspace? |
Right now I just copy-paste it into every project, it's a bit annoying and it wouldn't be a bad idea to have this. |
Same issue for me, sometimes I need to update the settings for particular projects, but in most cases they are the same for all of them. |
Hi, same issue here. It would be very comfortable if the search paths can be defined globally. Search paths depending on the OS set up and can be different. So it is not nice to have this inside the git managed project folders. It would be really nice if you can find a way to bring this configuration file into /home/user/.vscode/* Thanks |
same issue for me. it should be work together with user custom library. |
@horvay it looks like you are taking advantage of the fact that we haven't added support for multi-root workspaces in our extension yet and only the first folder is parsed. When we do add support for it, what you've posted will no longer work. We are still considering merging c_cpp_properties.json into settings.json. |
Will it break? Or merely be not necessary? Do you know a ballpark for when you all plan to release support for multi-root? |
Nothing will "break" per-se, but when we add the support, we will load the c_cpp_properties.json from each folder you've opened and apply it to the files in that folder instead of just loading the c_cpp_properties.json from the first folder and applying that to everything. We plan to start looking into this more next month, with a possibility for us to release in October if everything goes as planned. The VS Code team has been investigating some of our suggestions and just sent me some sample code with a new API this morning that looks promising. |
Awesome! I deleted the cpp configs from the other folders for now. But I'll definitely go back to having local specific ones after that release. Thanks for all the work you all put into this! |
I do believe that this has not been implemented yet. I'm on Windows and it is absolutely infuriating to have to add the same thing to the c_cpp_properties.json every time I start a new project. Same goes for me on Fedora, at least there it knows where to look and I can add the necessary paths (plural) with a couple clicks. Windows doesn't afford that option. I currently have Visual Studio Community installed, providing the necessary paths. I will be experimenting with just the build tools on my laptop, but this inability to set the *.json globally is a constant thorn in my side. |
Here is my use-case which looks a little different from others. I am working on a Mac but the files I am editing are remote on a Linux box. To do this I am using
Port 52698 is for So I would like to have a global includePath configuration so If I set an environment variables As Ciro mentioned, CPATH will set the path for both C and C++. will Doing this would be very helpful for my workflow and maybe others who need to do similar. |
We do support environment variables in the includePath. We also support semicolons as a path break if you happen to use an environment variable that defines multiple paths. You can use |
We haven't shipped the fix yet though (ETA is next week), unless you want to build/run it from the OSS, but binary that is retrieved is slightly out of date so inactive regions probably don't work (they require the binary in the 0.15.0-insiders release). |
So, what's the progress? |
@Artalus The progress for what? Global settings is scheduled for April. |
My use case seems a bit different, what I want is the ability to have a shared base configuration that applies to all the others. In our basic GNU make-driven projects, I find myself adding several |
@bryceschober I had a similar problem, so I knocked up an extension global-config to make it easier to copy (or link) a standard set of files - it might be useful until it's implemented properly... |
@bryceschober It sounds like you mean c_cpp_properties.json settings that apply to all the configs, so that each individual config would just overwrite or add to the base one. We weren't planning to add that, but it sounds like a good idea to me. |
@sean-mcmanus Yes, that's exactly what I mean. |
I have just posted a plan to issue #1338 that may address this issue. I encourage those on this thread to take a look and provide feedback. |
A preview of this is available in the insiders build if you would like to try it out and provide feedback. Set |
Wait, how does this reduce duplication between different configurations in c_cpp_properties.json shared between users? How would one specify some baseline include paths for all configurations, and then different platform-specific include paths? |
Sharing between users might require the "advanced" section of the spec in #1338 which is not implemented yet. We haven't gotten enough votes from users to determine if it's worth introducing the complexity since most users are still struggling with basic configuration, so we've been focusing on solving that first. Otherwise, you would be able to share a base set of includes across multiple platforms like this: .vscode/settings.json
.vscode/c_cpp_properties.json
|
IMO, this would be a whole lot easier for ordinary users (though I have no idea how hard it would be for you to implement): .vscode/c_cpp_properties.json: {
"configurations": [
{
"name": "default",
"includePath": [
"${workspaceFolder}",
"${workspaceFolder}/include"
],
},
{
"name": "linux",
"includePath": [
"${default}",
"${workspaceFolder}/include/linux"
],
},
{
"name": "osx",
"includePath": [
"${default}",
"${workspaceFolder}/include/osx"
],
},
{
"name": "win32",
"includePath": [
"${default}",
"${workspaceFolder}/include/win32"
],
}
]
} |
This is one of the possibilities on the table. But it opens up a sort of inheritance graph with potential cycles, etc. It also creates partial configs that should probably not be selectable. There are a few issues with this design that we need to refine, but this is very similar to what I proposed in the "advanced" section of the spec in #1338. |
For your particular scenario, however, the "advanced" scenario seems overkill. We could probably address your case more easily by adding an "environment" section or something that lets you define custom variables for your own usage:
|
That looks good to me, as long as it's all in one shared configuration file and documented not-too-deeply. |
This has been addressed in 0.17.0. Also, a minor variation from the comment above, the final syntax for the custom variables uses a property called "env" instead of "environment":
|
Just to know, the issue seemed to have been closed buuuut I have a hard time finding how to translate to this new system. Like, for now, I have to put that file in every C/C++ project I work on, so now how can I do for having it at a global level ? // .vscode/c_cpp_properties.json
{
"configurations": [{
"name": "WSL",
"compilerPath": "/usr/bin/gcc",
"includePath": [
"${workspaceFolder}/**",
"/usr/lib/gcc/x86_64-linux-gnu/5/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
} |
@eurakilon, take a look at this documentation |
I would like to set includePath globally, not set it in every folder/project.
can we make this config file available in settings.json?
The text was updated successfully, but these errors were encountered: