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?
-
3Not sure if it applies here, but deleting the .vs folder next to your project (while VS is closed) solves a wide range of ills. – Marc Gravell♦ Dec 7 '17 at 18:20
Restart the TypeScript language service
In VS Code, and in a TypeScript source file (this won't work in a css or json file),
- Open the Command Palette (view menu → command palette)
- Enter
TypeScript: Restart TS server.
(type "restart" and it should autosuggest)
-
1
-
12The command only shows up when you have a TypeScript file open! You won't find it while editing a
.css
file for example. – nitzel Jun 12 '19 at 14:44 -
1And if you have a .cs file open, you get the option to Restart OmniSharp, which clears up c# issues, such as incorrect error-flagging for files, – Chris Nov 20 '19 at 19:11
-
@DrumM -- to restart typescript in vscode, you have to use the command palette in a typescript file (eg, won't work in a css or json file) -- perhaps consider adding the line
"typescript.tsdk": "node_modules/typescript/lib/"
to your.vscode/settings.json
-- also be sure to install typescript locally in the project vianpm install typescript
-- then give vs code a restart -- and of course as a workaround, restarting vscode entirely does work – ChaseMoskal Dec 19 '19 at 9:59
You may Ctrl+Shift+P or F1, then write "reset.." in command pallete, and choose in popup list "C/C++ Reset IntelliSense database".
-
Man, this even doesn't work for me. It seems there is a big bug. I'm running the latest version. Whatever I do, I always get: "No definition found for ..." – DrumM Dec 18 '19 at 10:07
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.
Restart VsCode.
-
1this is still an issue... i've been restarting vscode for typescript projects like 10 times a day for the last three years... vscode will wrongly report definition errors which simply disappear by simply restarting vscode.. somehow the language service goes haywire on the regular *shrugs* – ChaseMoskal Dec 13 '18 at 21:44
-
11hey i found something --
View menu -> Command palette
, typerestart
, then clickTypeScript: Restart TS server.
– ChaseMoskal Dec 13 '18 at 21:48 -
1
In VSCode, Ctrl + Shift + P and click C/C++ Rescan Workspace works for me. Hope this helps.
-
Maybe a C/C++ Reset IntelliSense database is needed before C/C++ Rescan Workspace as in @Valex answer. And a rebuild may help also. – guan boshen Apr 3 '20 at 1:33
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.