How to reset intellisense in VS Code?

Visual Studio-Code

Visual Studio-Code Problem Overview


If you make a code change while VsCode is debugging, the intellisense sometimes appears to malfunction with false compile errors. Fastest way to reset or correct it?

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

Restart the TypeScript language service

In VS Code, and in a TypeScript source file (this won't work in a css or json file),

  1. Open the Command Palette (view menu → command palette)
  2. Enter TypeScript: Restart TS server. (type "restart" and it should autosuggest)

Solution 2 - Visual Studio-Code

You may Ctrl+Shift+P or F1, then write "reset.." in command pallete, and choose in popup list "C/C++ Reset IntelliSense database".enter image description here

Solution 3 - Visual Studio-Code

For C# use this:

cmd+shift+P or ctrl+shift+P brings up command bar, then OmniSharp: restart OmniSharp. Type restart and it will suggest that.

Solution 4 - Visual Studio-Code

In VSCode, Ctrl + Shift + P and click C/C++ Rescan Workspace works for me.

Solution 5 - Visual Studio-Code

Solution 6 - Visual Studio-Code

I had the problem where the following did not work:

  • Quitting VSCode
  • Disabling the C/C++ extension
  • C/C++ Reset IntelliSense database
  • C/C++ Rescan Workspace

I discovered that I had a bunch of processes running called cpptools and cpptools-srv. After killing all of them and resetting VSCode, everything started working again.

The command I use to kill them is:

pkill cpptools

Under most circumstances, I do not need to quit VSC after using the pkill command above.

Solution 7 - Visual Studio-Code

Restart the Dart Analysis Server

Well since this question is a bit generic and seeing people responding with ways to solve for various programming languages, I'll post that of Dart.

  • Open the Command Palette (view menu → command palette)
  • Type: Dart: Restart Analysis Server and press Enter

Just like closing and reopening vscode

Solution 8 - Visual Studio-Code

I'm using an older version of VS Code (1.48.1). This answer solved the problem for me of a file not generating C/C++ IntelliSense information. If resetting the IntelliSense is not enough (Ctrl+Shift+P → C/C++: Reset IntelliSense database; it wasn't for me), try this:

Make sure there are no red squiggles (parsing errors) in the file, especially on #include directives. The best way to resolve include problems is to declare more include directories in the workspace. (I saw a lot of answers on how to do it system/user-wide, but only incomplete answers on how to do it per workspace.) Do this by generating a c_cpp_properties.json file in the workspace directory (mine didn't seem to have one already): Ctrl+Shift+P → C/C++: Edit Configurations (JSON). Add paths to includePath, until all include errors go away in the problematic file and in all files that it includes. Use the variable, ${workspaceFolder} to refer to the root directory of the workspace. By the way, mine defaulted to only having ${workspaceFolder}/** in includePath, which should recursively search your entire workspace folder for include files. It did not work for me, at least on one particular file. I had to explicitly add more directories under ${workspaceFolder}, in order for VS Code to find some includes. I didn't have any issue with standard library includes. So, this answer does not address those.

You may need to do another reset of the IntelliSense database and restart VS Code before it starts showing all IntelliSense information properly. I also found that it seemed to help to open the include files that it's looking for to help it find the files. I'm hoping this keeps working for me. So far so good.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRMuesiView Question on Stackoverflow
Solution 1 - Visual Studio-CodeChaseMoskalView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeValexView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeUnicornView Answer on Stackoverflow
Solution 4 - Visual Studio-Codeguan boshenView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeRMuesiView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeThomas EdingView Answer on Stackoverflow
Solution 7 - Visual Studio-CodeEric AigView Answer on Stackoverflow
Solution 8 - Visual Studio-CodePulseczarView Answer on Stackoverflow