(update: Should work with all compilers) This has been tested with VSCode using MSBuild tools 2019.
Visual Studio should also support cpp.hint files.
This fix is thanks to sean-mcmanus, one of the the VSCode cpptools devs. I had off and on been trying to fix this for years. Reminder that you can always ask people smarter than you!
- Create a cpp.hint file for both root workspace directories
e.g.
K:\Users\me\Documents\Unreal Projects\BuildingEscape\cpp.hint
J:\Program Files\Epic Games\UE_4.26\cpp.hint
- Put this in both cpp.hint files
#define UFUNCTION(...) extern
#define UPROPERTY(...) extern
-
Now any comments that are above UFUNCTION and UPROPERTY will show up with Intellisense Hover and Function completion.
-
This could potentially work with all UMacros. I’ve only test UFUNCTION and UPROPERTY so far.
(update)
There’s currently a VSCode bug where you might not see the changes.
-
If you don’t see any changes try adding a line and removing it(or make changes to it) from the file you don’t see the changes in. Might take a few seconds.
-
If that doesn’t work you need to reset the Tag Parser database.
a. In VSCode go to View->Command Pallet.
b. A window should pop up. Type reset in this window and code completion should show an option for C/C++: Reset Intellisense DataBase. Click this option.
c. The Tag Parser reset might take 15-20 minutes on an UE4 project.