I have a slightly better solution to this issue. Instead of compiling within VS, just close all files you are using in VS and then close VS. Within the UE Editor, hit the compile button to compile the C++ code. Then open your VS using File -> Open Visual Studio. Now you can see that Intellisense is working once again.
I’m currently using Visual Studio 2017 Community (VS), with the UE4 Intellisense plugin, and Visual Commander plugin to implement hackalyze’s ue4-vs-extensions (found at https://github.com/hackalyze/ue4-vs-extensions).
Unreal Engine 4.17.2 (UE), though all of this is tested also on UE 4.16.3.
I left the original post below so you know what happened wrong.
My actions that I suggested below really messed things up for me! Shame on me for not fully testing my suggestion. The following is what I am doing now to fix everything…
I have noticed that every time you change something in the source files above the UClass line, VS IntelliSense forgets everything! This is quite annoying. On top of this, GetWorld()-> autocomplete never worked until I did what I am now suggesting.
After editing all includes and saving the edits, close all open documents (the .cpp and .h files).
- Rebuild the solution by going to Build -> Rebuild Solution
- Close Visual Studio and go back to the Unreal Editor
- Refresh the Visual Studio Project by going to File -> Refresh Visual Studio Project
- Open the Visual Studio Project by going to File -> Open Visual Studio
At this point, the autocomplete should be working. For me to get the GetWorld()-> to autocomplete I had to include “Engine/World.h”. I have been placing all include statements within the header file of the class I am working on.
I hope this helps. And do not do what I suggested at this point unless you know how to recover from it properly.
Original
Sometimes IntelliSense is messed up. Within your project folder, there is a .vs folder. This is auto-generated when you compile the project. If rebuilding the whole solution does not work, then attempt a simple close and reopen the solution (or just close and restart Visual Studio). If this does not work, then delete the .vs folder. An easy way to get to the solution folder is to right-click the Solution in the Solution Explorer and go to Open Folder in File Explorer near the bottom of the menu. With that open, close Visual Studio, and then delete the .vs folder. Then you can reopen Visual Studio like normally, allow it to parse the files in the solution (you deleted this) and then all will be good!
Note: You might need to change the solution platform back to Win64 or Win32 after doing this. That way you can recompile within Visual Studio without issue.
The Menu
Parse Indicator at bottom of Visual Studio window