xmake
xmake copied to clipboard
Generate a header file for editors to run IntelliSense normally while using C++20 named modules
Is your feature request related to a problem? Please describe.
Most editors don't provide decent IntelliSense for imported named modules in C++, especially when it comes to remote packages, as for which accessing and indexing those declarations through different build systems and package managers could be tricky.
Describe the solution you'd like
However, a compromise can be made, to create some sort of compatibility. We can generate a header file that includes all the class declarations of the libraries used, function declarations and so on, as a by-product of the processing of modules. The file may look like this:
#ifdef _EDITOR
class A
{
public:
int func(const char* str, int num);
//....
}
#endif
And it's simple to undefine the macro when actually building our targets, so we can safely #include this file in our source files.
Describe alternatives you've considered
No response
Additional context
No response