microsoft/vscode-cpptools

Option for global configuration

aahaselgrove opened this issue · 6 comments

I am a bit confused about how best to configure this extension, and the documentation here didn't seem to clarify. There is a command, 'C/Cpp: Edit configurations', which is clearly for editing the configuration. However, when trying to run this command, I get the message 'Open a folder first to edit configuration'. This seems to imply that configuration is directory-specific? Is there a way to set global configuration, which would be used unless a local configuration file exists?

Disclaimer: I am new to vscode so this might be a standard pattern among vscode extensions, but if it's not, I would suggest adding some documentation to clarify.

The configuration that that command is referring to is for include paths which we have defined to be folder-specific. If you open a single file, we will attempt to detect the default includes for your operating system, but we don't want to drop a configuration file next to every file you open, so we ask you to open a folder first.

The default settings for the extension can be accessed via "Preferences: Open User Settings" command. At some point we would like to merge our Configurations with the User settings now that VS Code supports both global and workspace settings, but we're not there yet.

I have a similar question, this is not clear to me what exactly I should add to the "Preferences: Open User Settings" to make the "C/Cpp: Edit configurations" work. Thanks.

When you don't have a folder open, you can set the "C_Cpp.default.*" settings to configure IntelliSense instead of using the c_cpp_properties.json file (which is the file that "Edit configurations" command creates).

you can set the "C_Cpp.default.*" settings to configure IntelliSense

Yes, it works even though it says "C_Cpp.default.*" unknown configuration setting, here my configuration:

"C_Cpp.default.*": {
        "includePath": [
            "C:\\MinGW64\\include",
            "C:\\MinGW64\\x86_64-w64-mingw32\\include",
            "C:\\MinGW64\\lib\\gcc\\x86_64-w64-mingw32\\7.3.0\\include",
            "C:\\Msys2\\usr\\include",
            "C:\\Msys2\\usr\\local\\include",
            "C:\\GTK+\\include",
            "${workspaceRoot}"
        ],
    }

@BladeMight, that syntax only works if you remove the .* from the end.

"C_Cpp.default": {
    "includePath": [ ... ]
}

The preferred syntax is:

"C_Cpp.default.includePath": [ ... ]

Closing this issue due to long inactivity.