vscode 清理缓存:Clearing the Visual Studio Code cache on Linux

Clearing the Visual Studio Code cache on Linux  How to clear the Cache in Visual Studio Code | bobbyhadz

  https://stackoverflow.com/questions/39234428/how-do-you-clear-your-visual-studio-code-cache-on-a-mac-linux-machine 

  https://tooabstractive.com/how-to-tech/how-to-delete-vscode-cached-data-files/ 

  Clearing the Cache in Visual Studio Code - DEV Community 

 ------------------------------------------------------------

关联参考:

vscode 清理缓存:Clearing the Visual Studio Code cache on Linux  https://blog.csdn.net/ken2232/article/details/144359505 

vscode 恢复默认设置:How to Reset Visual Studio Code to the Default Settings  https://blog.csdn.net/ken2232/article/details/144359394 

==================================

How to clear the Cache in Visual Studio Code

  > https://bobbyhadz.com/blog/vscode-clear-cache#clearing-the-visual-studio-code-cache-on-linux   

Borislav Hadzhiev

Last updated: Apr 6, 2024
Reading time·5 min

# Table of Contents

  1. Clearing VS Code editor history
  2. Clearing VS Code search history
  3. Clearing the Cache in Visual Studio Code
  4. Clearing the Visual Studio Code cache on Windows
  5. Clearing the Visual Studio Code cache on macOS
  6. Clearing the Visual Studio Code cache on Linux
  7. Clearing the Local Storage cache in Visual Studio Code

# Clearing VS Code editor history

When you modify a file, a copy of the old contents is kept in local history.

This allows you to compare a file with an older version from history, however, it can sometimes slow VS Code.

If you need to clear the editor history:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.

Note: you can also press F1 to open the Command Palette.

  1. Type Clear editor history and select the option.

clear editor history

Here is a short gif that demonstrates the process of clearing the editor history.

This option is especially useful for clearing deleted or moved files.

# Clearing VS Code search history

Visual Studio Code also keeps track of your searches.

To clear the search history:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.

Note: you can also press F1 to open the Command Palette.

  1. Type "Clear search history".

clear search history

  1. Select Search: Clear Search History.

Here is a short GIF that demonstrates the process.

The same approach can be used to clear your command history.

vscode clear other history

Once you start typing clear after you press Ctrl + Shift + P, the options are shown.

# Clearing the Cache in Visual Studio Code

The article has instructions on how to delete your VS Code cache on Windows, macOS and Linux.

VS Code has 2 folders that you have to delete Cache and CachedData.

# Clearing the Visual Studio Code cache on Windows

On Windows, the Cache and CachedData folders are located under:

  • C:\Users\<YOUR_USER>\AppData\Roaming\Code

Make sure to replace the YOUR_USER placeholder with your actual username.

delete contents of cache cachedata

You can also access the folder by pasting %APPDATA%\Code in Explorer.

%APPDATA%\Code is the equivalent of the previous path.

Once you find the directory, open the CachedData folder and delete its contents.

delete cached data contents

You can delete all folders in the CachedData directory to clear the cache.

Then go up one directory and open the Cache directory.

If your Cache directory contains a CachedData directory, open the CachedData directory and delete its contents.

Otherwise, delete the contents of the Cache directory.

delete all files in cache directory

Alternatively, you can use a command to delete the contents of the CachedData and Cache directories.

Open the command prompt (CMD) application and run the following commands.

The following command deletes the contents of the Cache directory.

cmd

 

del /S "%APPDATA%\Code\Cache\*"

windows delete cache command line

Note that you will get prompted multiple times and you have to type Y and press Enter.

If you want to delete the folder without a prompt for confirmation, use del /F /Q.

cmd

 

del /F /Q /S "%APPDATA%\Code\Cache\*"

The following command deletes the contents of the CachedData directory.

cmd

del /S "%APPDATA%\Code\CachedData\*"

Note that you will get prompted multiple times and you have to type Y and press Enter.

If you want to delete the contents without a prompt for confirmation, use del /F /Q.

cmd

del /F /Q /S "%APPDATA%\Code\CachedData\*"

Once you clear the cache, make sure to restart VS Code by closing it completely and reopening it.

# Clearing the Visual Studio Code cache on macOS

On macOS, the Cache and CachedData folders are located under:

  • $HOME/Library/Application\ Support/Code

You might also access the path as:

  • ~/Library/Application\ Support/Code

The easiest way to clean the cache on macOS is to use the rm command.

You can first print the contents of the directories before deleting them.

Open a bash shell and run the following commands.

shell

echo ~/Library/Application\ Support/Code/Cache/* echo ~/Library/Application\ Support/Code/CachedData/*

The following command deletes the contents of the Cache directory.

shell

rm -rf "~/Library/Application\ Support/Code/Cache/*"

You might get prompted. Type y and press Enter if you do.

The following command deletes the contents of the CachedData directory.

shell

rm -rf "~/Library/Application\ Support/Code/CachedData/*"

Once you clear the cache, make sure to restart VS Code by closing it completely and reopening it.

# Clearing the Visual Studio Code cache on Linux

On Linux, the Cache and CachedData folders are located under:

  • $HOME/.config/Code

linux location of cache

One way to delete the contents of the directories is to enter the following commands in your terminal.

shell

cd $HOME/.config/Code nautilus .

The commands will open the Code directory.

You can then open the Cache directory and delete its contents and then open the CachedData directory and delete its contents.

delete cache contents

Alternatively, you can use a command.

You can first print the contents of the directories before deleting them.

Open a bash shell and run the following commands.

shell

echo $HOME/.config/Code/Cache/* echo $HOME/.config/Code/CachedData/*

The following command deletes the contents of the Cache directory.

shell

rm -rf "$HOME/.config/Code/Cache/*"

linux delete cache directory

You might get prompted. Type y and press Enter if you do.

The following command deletes the contents of the CachedData directory.

shell

rm -rf "$HOME/.config/Code/CachedData/*"

linux delete cached data directory

Once you clear the cache, make sure to restart VS Code by closing it completely and reopening it.

# Clearing the Local Storage cache in Visual Studio Code

Visual Studio Code also stores information about which tabs were open before you closed the editor.

This sometimes causes issues, such as the editor always opening multiple projects at launch.

To clear the local storage:

  1. On Windows and Linux:
  • Press Alt to show the top bar and click on Help.

  • Click "Toggle Developer Tools".

  1. On macOS:
  • Click on Help in the top bar and click "Toggle Developer Tools".

toggle developer tools

On both platforms, enter the window.localStorage.clear() command in your developer tools.

shell

window.localStorage.clear()

vscode clear local storage

Once you issue the command, restart VS Code.

You can also clear the local storage in Visual Studio code by issuing a command.

The location of the local storage directory is:

  • on Windows: %APPDATA%\Code\Local Storage
  • On macOS: ~/Library/Application\ Support/Code/Local\ Storage
  • On Linux: $HOME/.config/Code/Local\ Storage

If you need to delete the contents of the local storage directory on Windows, open CMD and issue the following command:

cmd

# Windows del /S "%APPDATA%\Code\Local Storage\*"

delete local storage on windows

Make sure to type y and press Enter when you get prompted for confirmation.

To delete the contents of the local storage directory on macOS, issue the following command.

shell

# macOS rm -rf "~/Library/Application\ Support/Code/Local\ Storage/*"

Make sure to type y and press Enter when you get prompted for confirmation.

To delete the contents of the local storage directory on Linux, issue the following command.

shell

# Linux rm -rf "$HOME/.config/Code/Local\ Storage/*"

delete local storage directory on linux

Make sure to type y and press Enter when you get prompted for confirmation.

Once you delete the local storage directory, close VS Code completely and then reopen it.

I've also written an article on how to solve the issue where VS Code takes up too much memory or CPU.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

### 安装C语言绘图库于Visual Studio Code 对于希望在Visual Studio Code (VSCode) 中开发C语言程序并集成图形功能的开发者来说,选择合适的绘图库至关重要。虽然提供的参考资料未直接提及此过程[^1],但可以推荐几个流行的选项以及安装方法。 #### 推荐使用的绘图库 - **SFML**: Simple and Fast Multimedia Library 是一个跨平台多媒体库,支持多种操作系统上的窗口创建、音频播放等功能。 - **SDL2**: SDL是一个低级别的访问视频、声音、键盘、鼠标等硬件设备的跨平台软件包。 - **Raylib**: Raylib是一款简单易用的游戏开发库,提供了丰富的API来处理图像绘制和其他游戏编程需求。 这些库都可以很好地与 VSCode 配合工作,并且拥有活跃社区的支持。 #### 安装步骤概述 为了简化说明,在这里以 SFML 为例介绍基本流程: ##### 设置环境变量和工具链 确保已经安装了适用于 Windows 或 Linux 的 GCC 编译器套件(MinGW-w64 对应Windows)。可以通过 Miniconda 或者其他方式获取预编译版本。 ##### 下载并配置 SFML 库文件 前往官方网站下载页面找到对应操作系统的稳定版压缩包链接;解压后将其中 bin 文件夹路径加入到系统 PATH 环境变量中以便运行时加载 DLLs。 ##### 创建项目结构 建立一个新的文件夹作为项目的根目录,内部至少包含 src 和 include 子文件夹分别存放源码文件(.c/.cpp) 及头文件 (.h). ##### 使用 vcpkg 进行依赖管理 vcpkg 是由微软维护的一个开源 C++ 包管理器,能够方便地解决第三方库及其相互之间的依赖关系问题。通过命令 `vcpkg install sfml:x64-windows-static` 来静态构建 SFML 到本地环境中。 ##### 编写简单的测试代码验证安装成功与否 下面给出一段利用 SFML 实现的小例子展示如何打开一个空白窗口: ```c #include <SFML/Graphics.h> int main() { // Create a window named "My Window" sfRenderWindow* window; sfVideoMode mode = {800, 600}; const char *title = "My Window"; window = sfRenderWindow_create(mode, title, sfClose, NULL); while(sfRenderWindow_isOpen(window)){ sfEvent event; while(sfRenderWindow_pollEvent(window,&event)) if(event.type==sfEvtClosed)sfRenderWindow_close(window); // Clear screen with black color before drawing anything new each frame. sfRenderWindow_clear(window,sfBlack); // Display what has been drawn so far after clearing the buffer. sfRenderWindow_display(window); } // Destroy resources when done rendering frames. sfRenderWindow_destroy(window); } ``` 完成上述设置之后就可以开始编写自己的应用程序啦!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值