Skip to content
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

[Feature Request] Add a user setting to change defaultDatabaseLocation #1404

Closed
vscpp opened this issue Jan 4, 2018 · 18 comments
Closed

[Feature Request] Add a user setting to change defaultDatabaseLocation #1404

vscpp opened this issue Jan 4, 2018 · 18 comments
Labels
Feature: Configuration An issue related to configuring the extension or IntelliSense Feature Request Language Service more votes needed Issues that have been postponed until more community members upvote it
Milestone

Comments

@vscpp
Copy link

vscpp commented Jan 4, 2018

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: #558

@vscpp
Copy link
Author

vscpp commented Mar 8, 2018

@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.
image

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Mar 8, 2018

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).

@vscpp
Copy link
Author

vscpp commented Mar 19, 2018

@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...

@sean-mcmanus sean-mcmanus added fixed Check the Milestone for the release in which the fix is or will be available. and removed help wanted Can be fixed in the public (open source) repo. labels Apr 17, 2018
@bobbrow bobbrow removed the fixed Check the Milestone for the release in which the fix is or will be available. label Apr 24, 2018
@sean-mcmanus
Copy link
Collaborator

@bobbrow This isn't fixed? Can't the user set the default.browse.databasefilename to something like ${workspaceFolder}/.vscode/vc.db?

@vscpp
Copy link
Author

vscpp commented Apr 28, 2018

@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. :)

@sean-mcmanus
Copy link
Collaborator

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/

@bobbrow
Copy link
Member

bobbrow commented Apr 30, 2018

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.

@sean-mcmanus
Copy link
Collaborator

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.

@vscpp
Copy link
Author

vscpp commented May 2, 2018

@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.

@bobbrow bobbrow modified the milestones: April 2018, May 2018 May 4, 2018
@bobbrow bobbrow changed the title [Feature Request] Add a use setting to change defaultDatabaseLocation [Feature Request] Add a user setting to change defaultDatabaseLocation May 4, 2018
@murphyzhao
Copy link

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!

@sean-mcmanus
Copy link
Collaborator

@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.

@sean-mcmanus sean-mcmanus modified the milestones: August 2018, Triage Jul 20, 2018
@sean-mcmanus sean-mcmanus modified the milestones: Triage (old), Triage Aug 29, 2018
@Lennon925
Copy link

Lennon925 commented May 10, 2019

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.

@pfeerick
Copy link

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)

@michelleangela michelleangela added the Feature: Configuration An issue related to configuring the extension or IntelliSense label Aug 19, 2019
@sean-mcmanus
Copy link
Collaborator

@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.

@pfeerick
Copy link

@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.

image

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Aug 19, 2019

@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.

@pfeerick
Copy link

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...

@github-actions
Copy link

This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog.

@github-actions github-actions bot added the more votes needed Issues that have been postponed until more community members upvote it label Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Configuration An issue related to configuring the extension or IntelliSense Feature Request Language Service more votes needed Issues that have been postponed until more community members upvote it
Projects
None yet
Development

No branches or pull requests

7 participants