Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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:

{
    "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.

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.

I have tried to use the Reload Window and Reload TypeScript Project commands from the palette, but those don't help. I have even tried pointing Visual Studio Code's typescript.tsdk to my npm installed version of TypeScript, but that did not help either.

Is Visual Studio Code's Intellisense cache stored somewhere that can be removed to force it to rebuild the cache?

like image 722
Naram Qashat Avatar asked Aug 20 '16 01:08

Naram Qashat


People also ask

How do I refresh IntelliSense in Visual Studio?

In Visual Studio 2022, open Tools -> Options -> [type in "database" in the search box] -> Text Editor -> C/C++ -> Advanced -> Recreate Database = TRUE, and then reopen the solution. Save this answer.

How do I reset my IntelliSense database?

3 of the extension, there is a command to reset your IntelliSense database. Open the Command Palette (Ctrl+Shift+P) and choose the C/C++: Reset IntelliSense Database command.


1 Answers

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. 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). But I think that manually cleaning the intellisense cache is a bad idea.

like image 113
wrager Avatar answered Nov 02 '22 07:11

wrager