Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Suggestions list confused about current scope
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TripShock
Junior Member

12 Posts

Posted - Jun 24 2013 :  1:26:21 PM  Show Profile  Reply with Quote
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.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 25 2013 :  12:03:50 PM  Show Profile  Reply with Quote
It seems that I was able to create a workaround for you, here are the steps:

1. Turn on recursive macro parsing: (use "NoDepthLimit")
http://docs.wholetomato.com?W363

2. Create a VA_Stdafx.h next to your project file with the following content:
#define DEFINE_METHOD(_Name, _Desc, _Args) \ CLASS_NAME::_Name ()

3. Rebuild your symbol databases
VA Options -> Performance -> Rebuild

You may need to modify the replacement macro in step 2, since you posted a simplified sample, but this is the basic idea.
Go to Top of Page

TripShock
Junior Member

12 Posts

Posted - Jun 25 2013 :  1:03:42 PM  Show Profile  Reply with Quote
Excellent!

Do I need to perform step (2) if I performed step (1)? It would seem (1) alone would fix the issue (and (3) of course), and indeed, it did; I didn't have to perform step (2).
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 26 2013 :  5:21:20 PM  Show Profile  Reply with Quote
Well, that is great news! It should work without step 2 in theory, but it didn't for me. Maybe it was just a "timing" issue, or I missed something.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000