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

.vscode caching too much data since update

Open ghost opened this issue 7 years ago • 53 comments

I have noticed since the recent update that cpptools seems to be caching a lot of data (~1GB for a small project). This seems to be in an ".vscode/ipch" subdirectory.

download_20190323_132636

ghost avatar Mar 23 '19 02:03 ghost

@kckemper Yes, that is the bug we fixed (#3368 ). We plan to ship a fix for that next week.

Great! That'll help.

kckemper avatar Apr 01 '19 23:04 kckemper

@kckemper The latest extension Insiders has fixed the ~/.vscode bug with the intelliSenseCachePath: https://github.com/Microsoft/vscode-cpptools/releases/tag/0.22.2-insiders .

sean-mcmanus avatar Apr 10 '19 16:04 sean-mcmanus

Well, commiting .vscode is not the only issue here. You see, i save my documents, workspace etc., in the cloud, in services like MEGA. When this .vscode grows to GB it takes away my quota in these services. So yes, IT IS a pain. I understand you justifying/defending the feature, but to say it is not a pain, like if you have analysed all possible scenarios, is "a little arrogant", to say the least. And even if this was not the case, the feature is creating files that can be several orders of magnitude bigger than the files in the project. This can not be right...

RafaelQuirino avatar Apr 20 '19 14:04 RafaelQuirino

@RafaelQuirino You can change your intelliSenseCachePath setting though so it's not taking up quota in cloud services, right?

sean-mcmanus avatar Apr 23 '19 23:04 sean-mcmanus

VSCode's default for the cache path works fine for me. The only issue was not knowing what stuff was in there, and whether to commit it to source control. (I have since added ".vscode/ipch" to my .gitignore file, and deleted files that were committed before I knew what they were. That works for me.)

How about creating a ReadMe file inside .vscode/ipch to explain what's being stored there, that it's OK not to commit it to source control, and what settings you can change to modify the location and size of the cache?

mday64 avatar Apr 25 '19 23:04 mday64

Another case: I have source code in a directory on Dropbox, purely for reference, not for editing/development. Now I discover that these ipch files have been synched to everyone in the company, with little or no benefit to them.

pedro-w avatar Apr 30 '19 08:04 pedro-w

@pedro-w Can you change your intelliSenseCachePath to a different location and/or delete those files from Dropbox?

sean-mcmanus avatar Apr 30 '19 19:04 sean-mcmanus

@sean-mcmanus Yes I can, and I've done both those things now, thanks. I just wanted to make the point that it's not purely a problem for source control users, so modifying .gitignore is not a solution for everyone.

pedro-w avatar May 01 '19 08:05 pedro-w

Any reason why the discussion is not about having the "C_Cpp.intelliSenseCacheSize": 0 as default, and then the user can decide whether he wants to use the Intellisense and how? VScode is supposed to be a text editor that can have expanded functionality, not an almost-IDE that can be turned into a text-editor by changing the settings back to zero after checking the issue in github and finding what exactly is that ipch folder that the extension creates automatically by simply having a file opened.

JavierReyes945 avatar May 07 '19 20:05 JavierReyes945

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

If I can set workspaceStorage path, it will be better.

Lennon925 avatar May 10 '19 02:05 Lennon925

Copying comment from #3664 here for all followers of this issue to see:

Proposed changes to default path of IntelliSense cache path

We propose using the user directory as the new default IntelliSense cache path (see proposed new default path below). The proposed solution will, by default, reduce the disk space usage and alleviate implications on source control for users who have not configured the cache.

As part of this proposed change, the extension will also automatically remove any caches previously added to the ${workspaceFolder}/.vscode folder when the old default behavior was applied.

Disk Space By using the user directory as the default path, it will create one cache location per user for the extension instead of creating a cache per workspace. As the cache size limit is applied to a cache location, having one cache location will also reduce the disk space usage of the cache for everyone using the default setting value.

Source Control Moving away from the workspace folder to the user directory as the default path will also address the concerns of the cache implications on source control for the workspace folder for everyone using the default path.

New default path The new default path for C_Cpp.intelliSenseCachePath setting will be the following:

On Windows %USERPROFILE%/.cpptools

On Linux and Mac ~/.cpptools

Please provide us with your feedback on this proposal.

bobbrow avatar Jun 10 '19 16:06 bobbrow

Would it be possible to use an already existing, Code related, path? On Windows, the path for most of the settings and some cached data is %APPDATA%/Code and would be a better choice (saving stuff directly in %USERPROFILE% is not IMHO very Windows-like). For Linux (and I suppose Mac) we already have the .config/Code and .vscode directories.

newbrain avatar Jun 10 '19 17:06 newbrain

Our extension doesn't own the %APPDATA%/Code folder so it wouldn't be right for us to dump stuff in there.

Our choice for the user folder was motivated by discoverability and the trend of cross platform tools increasingly putting configuration and cached stuff in this location. (e.g. Android Studio, Cocos Creator, Atom, Gradle, and Conan - just to name a few). But we could also consider putting the folder under AppData instead. If we did it this way, we would propose putting it in %LocalAppData% instead because these are files you don't need to have following you around across machines.

Does anyone else following this issue have an opinion on this?

bobbrow avatar Jun 10 '19 20:06 bobbrow

(I mentioned this in #3664, too.) How about you create a cpptools directory inside the ~/.vscode directory (the one where your installed extensions go)? That keeps the VSCode-related stuff together. Sorry, I don't know what that would look like on Windows.

mday64 avatar Jun 10 '19 21:06 mday64

I would say that it's better to follow the platform-specific guidelines (see for example what Chrome does) but doing what other VSCode extensions are doing is also a precedent for you. Tricky. At least it might be sensible to use a more specific directory name ( .vscode.cpptools ?) as your suggestion might not be obvious what it is.

pedro-w avatar Jun 11 '19 10:06 pedro-w

Combining suggestions from this thread with the other one, how does this sound?

Windows

%LocalAppData%\vscode-cpptools

Linux/macOS

~/.vscode-cpptools

bobbrow avatar Jun 11 '19 19:06 bobbrow

The other default path option for Windows can be %LocalAppData%\Microsoft\vscode-cpptools to further indicate that this folder and its contents is from a Microsoft component.

We would like to hear your feedback on any preference.

michelleangela avatar Jun 11 '19 22:06 michelleangela

May I suggest that on Linux, the ipch folder be put under ~/.cache/vscode-cpptools? (Or equivalently, $XDG_CACHE_HOME/vscode-cpptools.) That way, the cached files do not appear as configuration dotfiles in the user's home directory, reducing clutter and making their purpose more obvious, and can also be easily excluded when backing up or synchronizing files, for instance. This is more in line with the conventions followed by other programs when caching user-specific files on Linux.

KRMisha avatar Jun 21 '19 19:06 KRMisha

I for one would like a setting or command that would clear this cache from within VSCode (similar to the clean solution in Visual Studio). I'm an educator that frequently zips up my directories to post as examples for my students to look over. When this change was made I suddenly started getting zips that were too large to post to our LMS.

natet avatar Jun 26 '19 00:06 natet

@natet, the setting that controls the cache size is C_Cpp.intelliSenseCacheSize. Set this to 0 and the extension will delete the cache. Starting in 0.24.0-insiders, we also changed the default cache location to be outside of your workspace folders, so you probably won't even need to do that anymore.

bobbrow avatar Jun 26 '19 04:06 bobbrow