Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>Clear Unused CodeNew to Visual Studio Code? Get it now.
Clear Unused Code

Clear Unused Code

jtouman

|
3 installs
| (0) | Free
Detects and removes unused variables, functions, and imports from your code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

clear-unused-code README

一个 Visual Studio Code 扩展,帮助您在 TypeScript 项目中查找和移除未使用的代码。

功能特性

  • 查找未使用代码:检测 TypeScript 文件中未使用的变量、函数、类、导入和类型。
  • 移除未使用代码:通过单个命令轻松移除所有检测到的未使用代码。
  • 进度通知:在代码分析过程中显示加载状态。
  • TypeScript 集成:利用 TypeScript 的语言服务进行准确检测。

使用方法

  1. 在 VS Code 中打开一个 TypeScript 文件。
  2. 使用以下命令之一:
    • Clear Unused Code: Find Unused Code - 查找当前文件中所有未使用的代码。
    • Clear Unused Code: Clear Unused Code - 查找并移除当前文件中所有未使用的代码。
  3. 如果发现未使用的代码,您将看到一个带有移除选项的通知。

要求

  • Visual Studio Code 1.70.0 或更高版本
  • TypeScript 4.0.0 或更高版本

扩展设置

此扩展不提供任何额外的设置选项。

已知问题

  • 目前仅支持 TypeScript 文件 (.ts, .tsx)
  • 在复杂的项目结构中可能无法检测到所有未使用的代码
  • 目前不支持 JavaScript 文件

发布说明

1.0.0

clear-unused-code 扩展的初始版本。


许可证

MIT 许可证

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft