[Feature Request] Add a user setting to change defaultDatabaseLocation
VS Code cpptools stores the symbols files in workspace storage default (Temp folder in Win OS) currently. The request is adding a user setting to change defaultDatabaseLocation with setting "workspaceStorage" (current behavior) or "workspaceFolder" (original behavior). Just like:
"C_Cpp.defaultDatabaseLocation ": "workspaceStorage" or -> VS Code storage path "C_Cpp.defaultDatabaseLocation ": "workspaceFolder" -> work space .vscode folder
More detail discussion please refer to: https://github.com/Microsoft/vscode-cpptools/issues/558
@sean-mcmanus, could you give priority for this issue? I have several copy of my code, the disk always show full and need to clean the temp file. Thanks.

Yeah, sorry for the repeated delay. This is sort of low priority for us, because there is a workaround of modifying your link to VS Code with Code.exe --user-data-dir <dir>. Does that workaround not work for you for some reason? But one warning -- if you do any extension host debugging from VS Code, you'll need to add "--user-data-dir=<path>" to the args or the extension will fail to load (might be a VS Code bug).
@sean-mcmanus , I introduced VS code and cpptools extension to my colleagues, and they complained with to me about the symbol size many times. But not all people want to modify the argument to the Code path, this is not a simply method.
I believe this is a big user experience. Could you give this priority? Please...
@bobbrow This isn't fixed? Can't the user set the default.browse.databasefilename to something like ${workspaceFolder}/.vscode/vc.db?
@sean-mcmanus @bobbrow , It's better add a setting in "User settings", then it will be applied to all workspace. If the setting in c_cpp_properties.json file, it needs to modify for each project. A global setting is a great experience.
Thanks very much for your effort. :)
Yeah, the setting does apply globally in the settings.json (user settings tab). It's C_Cpp.default.browse.databaseFilename in 0.17.0-insiders (or later) if you want to try it out before the official release (expected next week): https://github.com/Microsoft/vscode-cpptools/releases/
I was using this issue to track the "default" database location when no database is specified, that's why I removed the "fixed" label. There's still another setting I was planning to add (an enum instead of requiring users to figure out the ${workspaceFolder}/.vscode/foo.db path), but if you think we're done here, we don't have to add it.
Actually, it might have made sense to make the default.browse.databaseFilename an enum, because it would only work with ${workspaceFolder}, because otherwise multiple workspaces would trample over the same database. But as long as the setting is set as intended (i.e. no user error), it's okay.
Well, there's no way to set the location to a place outside the workspaceFolder and still be unique (e.g. workspace root in C and database in F) -- if we supported ${workspaceFolderBasename} it would be a workaround for that issue, but no users have complained yet so it might not be worth adding.
@sean-mcmanus , yes, I tried 0.17.0-insiders version, and set: "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/.BROWSE.VC.DB" The symbol file is generated in workspace folder now. Thanks.
After reading so much discussion, I still don't know how to simply change the workspaceStorage path.
Please tell me if there is a simple way of operation, thanks!
@zhaojuntao You can user --user-data-dir <dir> when launching VS Code to change the workspaceStorage path location. You could also set "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/.BROWSE.VC.DB" if you just care about that file, and don't mind the file going into the workspace folder.
Could you use the same folder path to storage cpptools database and ipch file?
such as : User\workspaceStorage\461a22b28b7917e54e4c47c056e86663\ms-vscode.cpptools User\workspaceStorage\461a22b28b7917e54e4c47c056e86663\ipch
And I wish I can set workspaceStorage path, because currently this path is located in C disk. Database and Ipch file will results in the increase of C disk rapidly and it's also important for us.
When you set
"C_Cpp.intelliSenseCachePath": "path",
"C_Cpp.default.browse.databaseFilename": "filename"
the precompiled headers (ipch) will go in the folder specified via intelliSenseCachePath and the database whereever you specific databaseFilename to go. .e.g.
"C_Cpp.intelliSenseCachePath": "R:\\vscode-cpptools",
"C_Cpp.default.browse.databaseFilename": "R:\\vscode-cpptools\\.browse.c_cpp.db"
put both in a vscode-cpptools subfolder of R:\ (a ramdrive in this instance)
@pfeerick Your suggested config change will cause all multiple workspaces to use the same database file, which is probably not what you want. The suggested fix would be to add the storage hash to the databaseFilename, but we haven't implemented that yet.
@sean-mcmanus That would be the ideal fix. Thankfully, this works quite well with multi-root workspaces, since when the file already exists, a number is appended to the name..., so there must already be some filename collision detection logic in place.

@pfeerick The additional database files gets created whenever the database is locked by another process -- the expected scenario is when the same folder is opened in 2 different VS Code instances (or VS Code and VS Code Insiders). The problem with relying on this behavior when the workspaces are different is that the database will likely need to be recreated every time and/or it may contain stale data from another workspace, because after the VS instances are closed and reloaded it will try to use the 0th, 1st, etc. databases but the ordering may not match the initial ordering.
Drats! Thanks for the explanation Sean, I get it, it's likely to backfire on me at some point until the storage hash is exposed in a manner it can be used (variable?). Chances are pretty remote though as I've got it on a ramdisk on Windows, and tmpfs on linux, so it needs to recreate from scratch every time anyway, and and don't often switch workspaces so not too much chance for it to get confused. Lets just say I prefer it that way for now in comparison to needing 80+MB of cache files per project, with dozens of different project folders...
This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog.