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 GravellCommented Dec 7, 2017 at 18:20
-
Sidenote: In C#, Omnisharp walks the sln file. If you add a new project, and forget to add it to the solution, this can make intelligence fail on packages specific to that project. Add the project to the solution, and run command "Omnisharp: Restart Omnisharp" from command palette.– James WorldCommented Jul 2, 2022 at 10:42
11 Answers
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)
-
31The command only shows up when you have a TypeScript file open! You won't find it while editing a
.css
file for example.– nitzelCommented Jun 12, 2019 at 14:44 -
2And 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, Commented Nov 20, 2019 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 Commented Dec 19, 2019 at 9:59 -
You can go into File > Preferences > Keyboard Shortcuts and look up Typescript: Restart TS Server and give it a key binding (I gave mine ctrl + PauseBreak)– DanielCommented Dec 28, 2021 at 1:12
-
If you're using the Vue extension, it will be: Volar: Restart Vue server Commented Sep 10, 2023 at 15:38
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 ..." Commented Dec 18, 2019 at 10:07
In VSCode, Ctrl + Shift + P and click C/C++ Rescan Workspace works for me.
-
1Maybe a C/C++ Reset IntelliSense database is needed before C/C++ Rescan Workspace as in @Valex answer. And a rebuild may help also. Commented Apr 3, 2020 at 1:33
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.
For Angular / TypeScript, resetting the extension host worked reliably.
Ctrl + Shift P --> Restart Extension Host
--or--
Ctrl P --> then type ">" --> Restart Extension Host
-
1
-
1
Restart VsCode.
-
2this 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* Commented Dec 13, 2018 at 21:44
-
13hey i found something --
View menu -> Command palette
, typerestart
, then clickTypeScript: Restart TS server.
Commented Dec 13, 2018 at 21:48 -
1
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.
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 pressEnter
Just like closing and reopening vscode
For .NET within new version of VS code omni sharp replaced with language server. You can restart with that command. Hope its help.
.NET: Restart Language Server
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.
What worked for me is that, I installed an earlier version of Intellisense.
-
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.– Community BotCommented Feb 4 at 12:29