Forgive me if this has already been discussed or is common knowledge, but I just wanted to share a tip for dealing with these issues in Visual Studio. I’m still mostly using VS2019, but I believe this should work in 2022 as well.
First, the disclaimer is that sometimes VS just ends up in a weird state with source files in terms of red squiggles, and the technique I’m about to share isn’t 100% foolproof, but it does work for me most of the time.
What I’ve noticed is that when the source code I have open is not being parsed by VS correctly and has tons of red squiggles everywhere, I just have to open the .h and .cpp for the module that the source files belong to. This works for custom user modules as well.
It seems like once source files are opened in a tab, VS starts to parse them in the background on demand and attempts to follow includes and such until it has parsed all related code. But, the problem seems to be that if you just open a JUCE source file that is defined in a module somewhere, because most includes are not defined in that file itself, but rather the module .h/.cpp VS can’t properly follow the include tree. However, if you open the module source .h/.cpp, it can now follow includes, parse them, and when you return to your source file, usually within a few seconds, the squiggles disappear and everything is as it should be.
It’s a little annoying to have to periodically do this, but it’s really not a huge pain to be able to get the source and highlighting into the correct state.
So as an example, if I have a user module (or JUCE module), named my_module, I might have a folder that looks like this (directories denoted by [ ]):
[my_module]
- my_module.h
- my_module.cpp
- my_module.mm
- [source]
- my_class.h
- my_class.cpp
(my_class.h and my_class.cpp should be included in my_module.h and my_module.cpp or this won’t work)
Let’s assume I open my_class.h or my_class.cpp for editing in VS and they are full of red squiggles and not parsed correctly. I can go over to the Solution Explorer in VS, find the shared code project, expand it, expand JUCE Modules, locate the my_module folder, expand it, and then open my_module.h and my_module.cpp for editing in their own tabs - this will start VS parsing the include tree for those module files. Now, switch back to my_class.cpp and my_class.h and with perhaps a little delay (usually a few seconds for me), the squiggles will disappear and the files will be in the correct state. The delay can be longer the more files defined in the module that need to be traversed first.
This is probably common knowledge, but I just wanted to share in the off chance others aren’t aware of the technique. For me it makes a huge difference when coding in Visual Studio, especially working on my own modules.

