cc1-ts
按需分析 TypeScript、JavaScript、Vue,降低大型项目的内存占用。
中文
- 安装扩展并重载窗口即可使用,无需修改项目配置。
- 分析已打开文件、导入的依赖及全局类型,保留类型提示与定义跳转。
- 保留入口文件中副作用导入的依赖类型,例如
import 'cc1-js' 注册的全局变量。
- 支持内置及工作区 TypeScript 5.x/6.x;Vue 项目需安装 Vue (Official)。
- 支持 Windows、macOS、Linux,不适用于 TypeScript 7 原生语言服务。
未加载文件的引用搜索和自动导入建议可能不完整。需要完整项目分析时,可在当前工作区禁用本扩展。
设置
在扩展菜单中选择 Extension Settings(扩展设置),或在设置中搜索 @ext:VeigarChen.cc1-ts。支持用户级和工作区级设置,作用于整个窗口,也可以编辑 settings.json:
{
"cc1-ts.enabled": true,
"cc1-ts.alwaysInclude": ["**/*.d.{ts,mts,cts}"],
"cc1-ts.debug": false,
"cc1-ts.preserveSideEffectImports": true
}
enabled:启用按需分析,关闭后恢复完整项目分析。
alwaysInclude:始终分析的项目文件匹配规则,相对于项目根目录;列表覆盖默认规则,[] 表示不额外保留文件。
debug:在 TypeScript 服务日志中输出调试信息,可通过 TypeScript: Open TS Server log 查看。
preserveSideEffectImports:保留副作用导入注册的全局类型,关闭后跳过扫描。
修改后选择提示中的“立即重启”,或稍后执行 TypeScript: Restart TS Server。项目中的 ts-scope-trimmer.json 同名配置优先于扩展设置;显式配置 ts-scope-trimmer-plugin 的项目仍由原始插件处理。
English
Reduce memory usage by analyzing open TypeScript, JavaScript, and Vue files, their imports, and global declarations.
- Install and reload VS Code. No project configuration required.
- Keep type hints and definition navigation for loaded files.
- Preserve dependency types registered by side-effect imports in unopened entry files, such as
import 'cc1-js'.
- Supports built-in/workspace TypeScript 5.x/6.x on Windows, macOS, and Linux. Vue requires Vue (Official). TypeScript 7 native is not supported.
References and auto-import suggestions may omit unloaded files. Disable the extension for the workspace when full-project analysis is needed.
Settings
Choose Extension Settings from the extension menu, or search Settings for @ext:VeigarChen.cc1-ts. User and workspace settings apply to the entire window. You can also edit settings.json:
{
"cc1-ts.enabled": true,
"cc1-ts.alwaysInclude": ["**/*.d.{ts,mts,cts}"],
"cc1-ts.debug": false,
"cc1-ts.preserveSideEffectImports": true
}
enabled: Enable on-demand analysis. Disable to restore full project analysis.
alwaysInclude: Glob patterns for project files to always analyze, relative to the project root. The list replaces the defaults; [] keeps no additional files.
debug: Write debug messages to the TypeScript server log, available through TypeScript: Open TS Server log.
preserveSideEffectImports: Preserve global types registered by side-effect imports. Disable to skip this scan.
After changes, choose Restart Now in the notification, or run TypeScript: Restart TS Server later. Matching settings in the project's ts-scope-trimmer.json take precedence over extension settings. Projects that explicitly configure ts-scope-trimmer-plugin remain managed by that plugin.