9

Quick Tip: Clear VS Code Cache for Open Files | CSS-Tricks - CSS-Tricks

 1 year ago
source link: https://css-tricks.com/quick-tip-clear-vs-code-cache-for-open-files/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Quick Tip: Clear VS Code Cache for Open Files

Geoff Graham on Aug 11, 2022

DigitalOcean joining forces with CSS-Tricks! Special welcome offer: get $100 of free credit.

If you use VS Code, you might have enabled the setting for re-opening a previously open file next time the app launches. I do. I like that.

vs-code-open-last-file.png?resize=1003%2C563&ssl=1
Hey, thanks for remembering, buddy! 🤗

But sometimes you really, really don’t want that to happen.

I recently ran into one of those times! I had to reinstall my local copy of this site and, with it, the 3GB+ database that accompanies it. Being a WordPress site and all, I needed to open up the SQL database file to search-and-replace some stuff.

If you’ve ever tried to open a super duper large file in VS Code, then you know you might need to jiggle a few settings that increase the memory limit and all that. The app is super flexible like that. There’s even a nice extension that’ll both increase the memory and perform a search-and-replace on open.

vs-code-memory-limit.png?resize=1024%2C507&ssl=1

Anyway, that big ol’ database file crashed VS Code several times and I wound up finding another way to go about things. However, VS Code keeps trying to open that file and inevitably crashes even though I nuked the file. And that means I wait for the MacOS beachball of fun to spin around before the app crashes and I can reopen it again for reals.

Well, I finally decided to fix that today and spent a little time searching around. One Stack Overflow thread suggests disabling extensions and increasing the memory limit via the command line. I’m glad that worked for some folks, but I had to keep looking.

Another thread suggests clearing the app’s cache from the command palette.

vs-code-clear-history.png?resize=1223%2C606&ssl=1

Nice, but no dice. 🎲

I wound up going with a scorched earth strategy shared by Jie Jenn in a helpful YouTube video. You’ve gotta manually trash the cached files from VS Code. The video walks through it in Windows, but it’s pretty darn similar in MacOS. The VS Code cache is located in your user folder.

Screen-Shot-2022-08-04-at-1.59.25-PM.png?resize=2614%2C1136&ssl=1

Notice that I have the Backups folder highlighted there. Jie removed the files from the CachedData folder, but all that did was trigger a prompt for me to re-install the app. So, I took a risk and deleted what appeared to be a 3GB+ file in Backups. I showed that file the door and VS Code has been happy ever since.

Ask me again in a week and maybe I’ll find out that I really screwed something up. But so far, so good!

DigitalOcean joining forces with CSS-Tricks! Special welcome offer: get $100 of free credit.

Leave a Reply Cancel reply

Comment

Name

Email

Website

Save my name, email, and website in this browser for the next time I comment.

Get the CSS-Tricks newsletter

vs-code-custom-workspaces.png?fit=1200%2C600&ssl=1&resize=350%2C200

Some Little Improvements to My VS Code Workflow (Workspaces, Icons, Tasks)

I did a little thing the other day that I didn't know was possible until then. I had a project folder open in VS Code like I always do, and I added another different root folder to the window. I always assumed when you had a project open, it was…

April 22, 2020
vscode-shadow.jpg?fit=1200%2C600&ssl=1&resize=350%2C200

VS Code extensions for the discerning developer palate

I am a VS Code extension snob. I like to hunt down the most obscure extensions for VS Code — the ones that nobody knows about — and impress people at parties with my knowledge of finely aged and little-known VS Code capabilities… then watch as they look around desperately…

August 2, 2018
docker-logo.png?fit=1200%2C600&ssl=1&resize=350%2C200

A Gentle Introduction to Using a Docker Container as a Dev Environment

Sarcasm disclaimer: This article is mostly sarcasm. I do not think that I actually speak for Dylan Thomas and I would never encourage you to foist a light theme on people who don’t want it. No matter how wrong they may be. When Dylan Thomas penned the words, "Do not…

September 24, 2020

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK