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

.vscode caching too much data since update #3347

Open
unl1ght opened this issue Mar 23, 2019 · 45 comments

Comments

@unl1ght
Copy link

commented Mar 23, 2019

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

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Mar 23, 2019

That is "by design". You can reduce the size used by changing the intelliSenseCacheSize setting for either the current workspace or all workspace (i.e. the user setting).

@unl1ght

This comment has been minimized.

Copy link
Author

commented Mar 23, 2019

Was this feature implemented in the most recent update? I feel that this could be a bit dangerous as the vscode directory is hidden. It is a significant amount of data to be generated on a per-project basis for a lightweight editor.

Just an opinion though, I appreciate the quick response.

@ThadHouse

This comment has been minimized.

Copy link

commented Mar 25, 2019

I think the choice of the .vscode folder might have been the wrong folder for this. I know the community is about 50/50 on if you should commit the .vscode folder to source control, and this is causing havoc in our source control setups. Why was the per workspace folders provided by vscode not used? And is there any way in the settings to change to that, as I would much prefer my store location to be there.

@tehKaiN tehKaiN referenced this issue Mar 25, 2019
@tehKaiN

This comment has been minimized.

Copy link

commented Mar 25, 2019

I know the community is about 50/50 on if you should commit the .vscode folder to source control

I'm one of those who commit .vscode ;)

Also, I think it would be better to have single cache for whole extension. I'm switching between 10+ large projects and ipch files are more and more consuming my disk space. It could be configurable to save it separately for a given project if one wants to have it that way (e.g. prevent deleting because of other projects hitting global cache size limit in the meantime), but having those files in every project is a) confusing, b) unreasonable for small disks.

@bobbrow

This comment has been minimized.

Copy link
Member

commented Mar 25, 2019

@ThadHouse the VS Code per-workspace folders were not selected for the following reasons:

  • Parity with Visual Studio. This is how Visual Studio works and they receive little to no feedback/complaints on the location.
  • The workspace storage location provided by VS Code is somewhat obscure and we had reservations about writing GB's worth of files in this location where users may not see them or know where to find them.

With this in mind we knew that we wouldn't be able to please everyone, so we provided settings to allow you to customize this the way that works best for you. We also figured that putting the files in the workspace folder would bring the issue to your attention quickly so that you can take action if you don't like the default behavior.

"C_Cpp.intelliSenseCachePath": <string>

This setting allows you to set workspace or global overrides for the cache path.
@tehKaiN, if you want a single cache for the whole extension, you just open the VS Code settings, and add a "User" setting for "IntelliSense Cache Path".

"C_Cpp.intelliSenseCacheSize": <number>

This setting allows you to set a limit on the amount of caching the extension does. If you want to use a global cache and increase/decrease the limit, that's fine. This is an approximation, but the extension will make a best effort to keep the cache size as close to the limit you set as possible.

@bobbrow

This comment has been minimized.

Copy link
Member

commented Mar 25, 2019

Another thing we can potentially take away from this discussion is that perhaps the extension can prompt users to select a default behavior for caching before it begins doing it. The toast messages can be ineffective since people will just click something or press Esc to make them go away, but it might address some of the concerns raised here.

@crazyBaboon

This comment has been minimized.

Copy link

commented Mar 26, 2019

Yep, this .vscode/ipch folder is a real pain.

@bobbrow

This comment has been minimized.

Copy link
Member

commented Mar 27, 2019

@crazyBaboon, can you clarify why is it a pain for you? Are you able to use the settings to control the feature the way you want?

@MemoryChips

This comment has been minimized.

Copy link

commented Mar 28, 2019

Why is this a pain in any case? Is there a problem if I just .gitignore it?

Rob

@bobbrow

This comment has been minimized.

Copy link
Member

commented Mar 28, 2019

There is no problem if you .gitignore it. That's what we expect most people to do, but in cases where you want customized behavior, we have provided additional settings which we hope will get you the behavior you want. If this is insufficient, we'd like to understand how we can make it better.

@ThadHouse

This comment has been minimized.

Copy link

commented Mar 28, 2019

The java extension actually checks that it's plugin used files are in the vscode settings files.exclude list. It might do that with .gitignore too. Maybe that's something to look at doing. Check if that folder is properly ignored, and if not prompt the user to add it.

@unl1ght

This comment has been minimized.

Copy link
Author

commented Mar 28, 2019

Git is not the only reason why it would be unacceptable to be able to use up to 5GB so liberally. It is not reasonable to assume a "lightweight editor" is going to produce a 1.3 GB precompiled header in a hidden folder just by opening an existing C++ project directory to do a quick edit on a file.

I understand that you have provided options to dial this down but I had to notice that 1/3 of my Google drive space had suddenly disappeared before investigating what was going on. I also have a laptop with a 256 GB SSD, the default 5GB setting is 2% of my total capacity.

Ultimately the thing that bothers me the most about it is that I use vscode because full blown VS is a bloated mammoth. I don't like that every VS project contained hidden folders with hundreds of megabytes of data for a single hello-world source file. This recent update now puts vscode in the same boat and is pushing vscode out of the powerful lightweight editor and more into the full blown IDE spectrum.

This seems excessive just for an intellisense improvement. Is there no other way? Was intellisense really that bad a couple of weeks ago?

I really hope this doesn't come across as being rude, I am just very passionate about vscode. I probably spend most of my day, every single day using it for work and hobbies. The work you guys are doing is amazing, but this has made me a little fearful that vscode may eventually end up half as bloated as it's big brother.

@bobbrow

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

@unl1ght, I appreciate the candid feedback. If you haven't been experiencing any performance problems with previous versions of the extension, then that's great to hear. If you don't feel you need the caching, you can turn it off with the intelliSenseCacheSize setting (set it to 0).

We've been receiving a lot of feedback in our survey about performance problems with the extension. Aligning with VS in this respect is an attempt to address these reports. We continue to investigate other ways to improve performance too.

@newbrain

This comment has been minimized.

Copy link

commented Mar 29, 2019

Would it be possible to have the .vscode/ipch directory automatically added to .git/info/exclude when cloning a repository?

Rationale:

  • Probably noone is willing to track and and commit them.
  • .gitignore is IMO not the right place, as these are vscode artifacts (and not everyone is using it).
  • I often clone repos to look at code I'm not allowed (or willing) to commit to, and having a number of untracked files showing up is mildly annoying.
  • Since I have quite sane user defaults for this kind of projects, those are, in fact, the only things created in the .vscode directory.

Of course, doing it manually is not a big deal...

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Mar 29, 2019

We had the same sort of complaints when we originally placed our .browse.vc.db file in the .vscode folder (databaseFilename setting). We're considering changing the default intelliSesneCachePath setting to the workspace storage location (where our symbol database defaults to -- the "con" being it's harder to locate delete there) or the temp directory (where our pipe files are generated, the "con" being it might get deleted unintentionally).

@kckemper

This comment has been minimized.

Copy link

commented Mar 29, 2019

I work in a very resource limited embedded system and usually I edit the code directly on the little device by mounting it with my desktop over sshfs. Before the update everything was fine but now the local ipch folder frequently grows large enough to consume the whole memory of my embedded system (~100 MB) and setting the "C_Cpp.intelliSenseCachePath" doesn't seem to default to the user setting when the workspace is recreated (which is frequently). I just wanted to point out a specific reason not to default the cache in the local working directory. After a while of deleting the ipch directory frequently I finally came here to figure out what the heck that directory was.

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Mar 29, 2019

@kckemper intelliSenseCachePath as a user setting is supposed to work, unless it uses an environment variable (it's a bug fix that we haven't shipped yet). Can you provide more info about that path you are using?

@kckemper

This comment has been minimized.

Copy link

commented Mar 30, 2019

"C_Cpp: Intelli Sense Cache Path" is "~/.vscode"

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Mar 30, 2019

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

@crazyBaboon

This comment has been minimized.

Copy link

commented Mar 31, 2019

@crazyBaboon, can you clarify why is it a pain for you? Are you able to use the settings to control the feature the way you want?

It should do the cache outside the git folder IMO, like in the .config or something like that.

@kckemper

This comment has been minimized.

Copy link

commented Apr 1, 2019

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

Great! That'll help.

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Apr 10, 2019

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

@RafaelQuirino

This comment has been minimized.

Copy link

commented Apr 20, 2019

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

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Apr 23, 2019

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

@mday64

This comment has been minimized.

Copy link

commented Apr 25, 2019

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?

@pedro-w

This comment has been minimized.

Copy link

commented Apr 30, 2019

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.

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Apr 30, 2019

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

@pedro-w

This comment has been minimized.

Copy link

commented May 1, 2019

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

@JavierReyes945

This comment has been minimized.

Copy link

commented May 7, 2019

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.

@Lennon925

This comment has been minimized.

Copy link

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

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

pfeerick added a commit to pfeerick/platformio-core that referenced this issue Jun 4, 2019

Ignore vscode-cpptools cache
One of the recent updates to the vscode-cpptools extension made it start caching in .vscode/ipch, and this cache can be quite big for even small projects. Since they're cache files, they should be ignored by default. This may be a short-lived suggestion, as there is already some mention that the IntelliSense cache folder may be moved to workspace storage, rather than 'per project' storage... although the 'when' is anyone's guess. 

See here for more: microsoft/vscode-cpptools#3347
@bobbrow

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

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.

@newbrain

This comment has been minimized.

Copy link

commented Jun 10, 2019

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.

@bobbrow

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

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?

@mday64

This comment has been minimized.

Copy link

commented Jun 10, 2019

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

@pedro-w

This comment has been minimized.

Copy link

commented Jun 11, 2019

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.

@bobbrow

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

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

Windows

%LocalAppData%\vscode-cpptools

Linux/macOS

~/.vscode-cpptools

@michelleangela

This comment has been minimized.

Copy link
Collaborator

commented Jun 11, 2019

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.

ivankravets added a commit to platformio/platformio-core that referenced this issue Jun 16, 2019

Ignore vscode-cpptools cache (#2623)
One of the recent updates to the vscode-cpptools extension made it start caching in .vscode/ipch, and this cache can be quite big for even small projects. Since they're cache files, they should be ignored by default. This may be a short-lived suggestion, as there is already some mention that the IntelliSense cache folder may be moved to workspace storage, rather than 'per project' storage... although the 'when' is anyone's guess. 

See here for more: microsoft/vscode-cpptools#3347
@KRMisha

This comment has been minimized.

Copy link

commented Jun 21, 2019

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.

@natet

This comment has been minimized.

Copy link

commented Jun 26, 2019

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.

@bobbrow

This comment has been minimized.

Copy link
Member

commented Jun 26, 2019

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

@natet

This comment has been minimized.

Copy link

commented Jun 26, 2019

@bobbrow I guess I wasn't clear in what I was asking. I don't want the cache to be eliminated, I simply want the ability to clear it at some point prior to preparing the zip file. But, if it's being stored outside the workspace, I guess that solves my problem.

@hb9tst

This comment has been minimized.

Copy link

commented Jun 28, 2019

Joining this discussion a bit late... I appreciate that there is a proposal to change this behaviour. I think that %LOCALAPPDATA% is the right choice on Windows, whereas %USERPROFILE% is NOT (I don't know why many programs write data there, it's not supposed to be used that way). For Linux, I'd strongly support using $XDG_CACHE_HOME, as for example here we have a setup with home directories on NFS (with disk quotas—it's a setup used by University students) and we regularly have issues with ipch folders causing users to exceed their disk quotas ($XDG_CACHE_HOME is set to use the local hard drive). I don't know what the best practice on MacOS would be.

As to whether put it in a Microsoft folder under %LOCALAPPDATA%, I don't have a preference. Maybe it could be a VSCode folder in %LOCALAPPDATA, that all VS Code components writing cache data should use...

And just to give another reason why I find that solving this issue is important: yesterday I double-clicked a .cpp file I wanted to edit (having .cpp files associated with VS Code), while I was using VS Code to edit a web site (therefore the root of the site was open as workspace). I later noticed a very big .vscode folder on the root of the web site! I'd call this behaviour "user data pollution"...

We also had students compressing their project folders, and handing in ZIP files for assignments what ere several dozens of MB instead of a few kB...

@pedro-w

This comment has been minimized.

Copy link

commented Jun 28, 2019

I don't know what the best practice on MacOS would be.

I believe you would ideally use URLsForDirectory:inDomain with NSCachesDirectory and NSUserDomainMask but it might be possible to just use $HOME/Library/Caches. In either case, append the VS Code bundle identifier as a subdirectory name.

@sean-mcmanus

This comment has been minimized.

Copy link
Collaborator

commented Jun 29, 2019

@hb9tst I created a new issue to track the $XDG_CACHE_HOME at #3860

@kylrth

This comment has been minimized.

Copy link

commented Aug 2, 2019

I appreciate how well the maintainers handled this issue. There were a lot of people frustrated about this, but you managed to find a solution that took a good middle ground. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.