简体   繁体   English

如何清除Visual Studio Code的TypeScript智能感知缓存?

[英]How can Visual Studio Code's intellisense cache for TypeScript be cleared?

I've been having issues lately with Visual Studio Code where it refuses to offer any Intellisense on TypeScript files, but only on some files. 我最近在Visual Studio Code中遇到问题,因为它拒绝在TypeScript文件上提供任何Intellisense,但仅在某些文件上提供。 Currently I have my folder layout something like this: 目前,我的文件夹布局如下所示:

+-- typescript
  +-- project1
  | +-- <ts file>
  | `-- tsconfig.json
  `-- project2
    +-- <ts file>
    `-- tsconfig.json

The tsconfig.json files are all identical except for the outFile compiler directive, as such: 除了outFile编译器指令外,tsconfig.json文件完全相同,例如:

{
    "compilerOptions": {
        "module": "none",
        "target": "es5",
        "noImplicitAny": true,
        "outFile": "<path to js file>",
        "sourceMap": true
    }
}

I have been running tsc within each subdirectory separately so as to keep them as separate projects. 我一直在每个子目录中分别运行tsc,以便将其保留为单独的项目。

For reasons I cannot explain, if I look at the TypeScript file within project1, I get Intellisense on everything, but if I look at the TypeScript file within project2, there is no Intellisense at all. 出于无法解释的原因,如果我查看project1中的TypeScript文件,则所有内容都会得到Intellisense,但是如果我查看project2中的TypeScript文件,则根本没有Intellisense。

I have tried to use the Reload Window and Reload TypeScript Project commands from the palette, but those don't help. 我尝试使用调色板中的“重新加载窗口”和“重新加载TypeScript项目”命令,但这些命令无济于事。 I have even tried pointing Visual Studio Code's typescript.tsdk to my npm installed version of TypeScript, but that did not help either. 我什至尝试将Visual Studio Code的typescript.tsdk指向我的npm安装的TypeScript版本,但这也无济于事。

Is Visual Studio Code's Intellisense cache stored somewhere that can be removed to force it to rebuild the cache? Visual Studio Code的Intellisense缓存是否存储在可以删除的位置,以强制其重建缓存?

According to this VS Code issue comment , the solution can be to create the main tsconfig.json , which will be extended by tsconfig.<subfolder_name>.json files from the subfolders. 根据此VS Code问题注释 ,解决方案可以是创建主tsconfig.json ,它将由tsconfig.<subfolder_name>.jsontsconfig.<subfolder_name>.json扩展。 Other comments on this issue may also be helpful. 关于此问题的其他评论也可能会有所帮助。

To the question about the intellisense cache: you can pay attention to the %APPDATA%\\Code\\Local Storage\\file__0.localstorage SQLite database (Windows path). 对于有关智能感知缓存的问题:您可以注意%APPDATA%\\Code\\Local Storage\\file__0.localstorage SQLite数据库(Windows路径)。 But I think that manually cleaning the intellisense cache is a bad idea. 但是我认为手动清理智能感知缓存不是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio Code Typescript Intellisense停止工作 - Visual Studio Code Typescript Intellisense stops working Visual Studio Code Intellisense 打字稿不工作 - Visual Studio Code Intellisense Typescript not working 如何在Visual Studio 2015中为TypeScript配置IntelliSense? - How to configure IntelliSense for TypeScript in Visual Studio 2015? 使用JavaScript的Visual Studio代码以及TypeScript文件作为Intellisense的参考 - Visual Studio Code using JavaScript with a TypeScript File as Reference for Intellisense 使用带有联合类型的打字稿在React组件上运行Visual Studio Code intellisense - Visual Studio Code intellisense on React component using typescript with union types 视觉工作室代码+ react-native +打字稿:jsx intellisense不起作用 - visual studio code + react-native + typescript: jsx intellisense not working 如何获得Visual Studio Typescript 1.7智能感知以使用Node.js库(Angular2,rxjs)? - How can I get Visual Studio Typescript 1.7 intellisense to work with nodejs libraries (angular2, rxjs)? 驯服 Visual Studio 代码智能感知 - Taming Visual Studio Code IntelliSense Visual Studio 2019 中的 Typescript 智能感知问题 - Typescript intellisense issue in Visual Studio 2019 带有双下划线的Visual Studio TypeScript智能感知 - Visual Studio TypeScript intellisense with double underscore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM