Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Intellisense not working for macro generated enums

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
ben_t48 Posted - Apr 13 2012 : 7:19:28 PM
In our code-base, we often use a macro to generate an enum and a table of data that can be indexed using the generated enum (example given below). The intellisense in Visual Assist is unable to help auto-complete any of the enum members that were added using the macro; for the example below only SubLevelState_Count will show up in the autocomplete list. Would it be possible for this to be added to a feature/bug list somewhere?

Ben

Example:

#define SUBLEVELSTATES \ SUBLEVELSTATE(Idle, 2.0f ) \ SUBLEVELSTATE(WaitingForBundleLoad, 5.0f ) \ SUBLEVELSTATE(BundleLoadCompleteDelay, 2.0f ) \ SUBLEVELSTATE(BundleLoadComplete, 2.0f ) \ SUBLEVELSTATE(WaitingForBlueprintBundles, 2.0f ) \ SUBLEVELSTATE(EntitiesCreated, 2.0f ) \ SUBLEVELSTATE(WaitingForRefCountDecrement, 8.0f ) \ SUBLEVELSTATE(WaitingForBundleUnload, 2.0f ) \ SUBLEVELSTATE(BundleUnloadComplete, 2.0f ) \ SUBLEVELSTATE(ImpromptuLoad, 2.0f ) \ SUBLEVELSTATE(ImpromptuUnload, 2.0f ) \ SUBLEVELSTATE(Clear, 0.0f ) \
enum SubLevelState
{
#define SUBLEVELSTATE( name, level_mult ) SubLevelState_##name,
SUBLEVELSTATES
#undef SUBLEVELSTATE
SubLevelState_Count
};

struct SubLevelStateInfo
{
const char *Name;
float LevelMuliplier;
};

SubLevelStateInfo g_SubLevelStateInfo[] =
{
#define SUBLEVELSTATE( name, level_mult ) { #name, level_mult },
SUBLEVELSTATES
#undef SUBLEVELSTATE
};

const char *displayName = g_SubLevelStateInfo[ SubLevelState_Clear ].Name;
6   L A T E S T    R E P L I E S    (Newest First)
ben_t48 Posted - Apr 26 2012 : 5:21:04 PM
The undef is require for our usage because we need to redefine what SUBLEVELSTATE means for the various expansions of SUBLEVELSTATES.

The NoDepthLimit change makes it work. Thanks! I will create a registry patch for everyone on our team.

Ben
accord Posted - Apr 25 2012 : 7:58:51 PM
Can you please try enabling recursive macro parsing with "NoDepthLimit"?

http://docs.wholetomato.com?W363

I've just tried and it is working for me:


The small tomatoes behind the icons in the listbox indicates that the result is coming from VA rather than Intellisense, so you don't need to re-enable it with this method.

I see some things in your source snippet that VA don't usually like, e.g. the #undef but so far so good. Hopefully it'll work with your "real" project as well...
ben_t48 Posted - Apr 25 2012 : 2:05:50 PM
We generally only use this type of enum generation when we want to build a table of data that will use the enum to do a lookup. That being said we probably do it 30-40 times in our code base.

Ben
feline Posted - Apr 19 2012 : 7:27:41 PM
I assume you are using VS2010, from this IDE option. If so you might want to have a look at this page, for some possible advice on limiting the CPU impact of default intellisense parsing:

http://blogs.msdn.com/b/vcblog/archive/2010/03/09/intellisense-browsing-options-in-vc-2010.aspx

Do you have many macros like this, or just a few? If this is only used to generate a fairly small number of problem enums we might be able to work around this. But if this is used to generate many different enums then any workaround is unlikely to scale well.
ben_t48 Posted - Apr 19 2012 : 4:33:02 PM
Sadly that is not helping for our project.

I have
VA Options -> Advanced -> Listboxes -> Get content from default Intellisense
option enabled, but I have
Tools -> Options... -> Text Editor -> C/C++ -> Advanced -> (Intellisense) Disable Auto Updating
set to true because our project is large (over <100 projects and <10000 files) and the default intellisense really drags down performance of the machine.

Ben
feline Posted - Apr 17 2012 : 5:38:13 PM
The main problem here is that VA's parser has problems with ## in a macro, making a new name:

case=729

This is a known problem, but its a hard one, since we don't get to run the code through a pre-processor before trying to make sense of it.

Does turning on:

VA Options -> Advanced -> Listboxes -> Get content from default Intellisense

make a difference? It is making a difference for me, in VS2010.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000