I have some code that uses some wacky macros to declare and define class methods. When I use those macros, I find that VA doesn't seem to "understand" the function scope and suggest names of local and instance variables while typing. I have created a reduced source file that reproduces the issue:
#include <iostream>
using namespace std;
#define CLASS_NAME CMyClass
#define DECLARE_METHOD(_MethodName) \void _MethodName ()
#define DEFINE_METHOD(_Name, _Desc, _Args) \ DEFINE_CLASS_METHOD(CLASS_NAME, _Name, _Desc, _Args) \
#define DEFINE_CLASS_METHOD(_Class, _Name, _Desc, _Args) \void _Class::_Name ()
class CMyClass
{
public:
DECLARE_METHOD(MyMethod);
private:
int m_TheValue;
};
DEFINE_METHOD(
MyMethod,
"Test string",
"Another test string"
)
{
auto newValue = 123;
auto anotherValue = 234;
//
// While typing the following line, suggestion list did not show
// either local variable. Only after hitting Ctrl-Space did it show
// suggestions correctly.
//
newValue += anotherValue;
//
// Same for the following line: m_TheValue was not suggested automatically.
//
m_TheValue += 123;
wcout << L"Called!" << endl;
}
int
wmain ()
{
CMyClass myClass;
myClass.MyMethod();
return 0;
}
If you are curious, I am writing code that uses the EngExtCpp headers. The above macros are simplified versions of macros in that header.