vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Request: allow different C/C++ intelliSense configurations on the .code-workspace file

Open dsanz006 opened this issue 7 years ago • 6 comments

Before the latest update of the C/C++ extension, the intelliSense configuration parameters (includePath, defines...) were defined in the C_Cpp_properties.json file. With the update, it is possible to define these parameters in the .code-workspace file, as C_Cpp.default.*, without a need for the C_Cpp_properties.json file. But this can only be done for one configuration (the default one). Therefore, if I have multiple configurations, I still need a C_Cpp_properties.json file.

I suggest that it should be allowed to define multiple configurations in the .code-workspace file, so that a C_Cpp_properties.json file is always optional.

dsanz006 avatar Jun 07 '18 13:06 dsanz006

Just adding my voice to this as well! I already commented in the #2096 issue, as there is a close relation between those 2 requests. To clarify: the request is to support multiple c-cpp configurations at the workspace level to allow sharing those to each folder of the multi-root workspace. In which file those settings should be added (i.e. .code_workspace) is not the request IMO.

jazzmx avatar Jan 31 '19 15:01 jazzmx

Seeing as how this got tagged "more votes needed," I've plugged in my vote. The issue is that if I want to compile a debug version versus an optimized version, then I need to set it on every subproject. I can't combine it to a single root, because the submodules have different macro definitions. What I need is the ability to change the configuration for the whole project and have that trickle down to the subprojects.

For now, I'm getting around this by creating a workspace file for every configuration in the same root folder. Kludgey as all get out, but it will get me by. A bit of a nightmare if I need to change settings in the workspace file, as I then have to remember to apply the same change to all of the other workspace variances.

J-Sorenson avatar Feb 10 '20 04:02 J-Sorenson

How about just specify the default C_CPP_Properties_default.json for workspace?

{
	"folders": [
		{
			"path": "."
		},
		{
			"path": "C:\\Test"
		}
	],
	"settings": {
		"files.associations": {
			"prjparams.h": "c",
			"stdio.h": "c",
			"usrappinit.h": "c",
			"corecrt_wstdio.h": "c",
			"mempartlibp.h": "c",
			"handlelibp.h": "c",
			"wdbendpktdrv.h": "c",
			"aiosysdrv.h": "c",
			"aio.h": "c",
			"config.h": "c",
			"configall.h": "c",
			"vxworks.h": "c",
			"prjcomps.h": "c"
		},
		"C_cpp.workspace_c_cpp_properties": "${${workspaceFolder:Test}}/.vscode/c_cpp_properties.json"
	}
}

lygstate avatar Mar 13 '20 16:03 lygstate

This feature request has received enough votes to be added to our backlog.

github-actions[bot] avatar Oct 18 '20 12:10 github-actions[bot]

Is there any way to access the name (or properties) of the active configuration used by the cppTools extension from within the multi-root workspace settings?

If I could use a single c_cpp_properties.json for the multi-root workspace, the defines would go with each configuration in that file. But since that is not an option, I am looking for a workaround. I have seen references in a few places to "${command:cpptools.activeConfigName}" as a way to access the config name, but the references are a few years old and that entry does not resolve to a string within the workspace settings.

jlj-ee avatar Jun 05 '24 12:06 jlj-ee

@jlj-ee I don't know a way.

sean-mcmanus avatar Jun 05 '24 23:06 sean-mcmanus