rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

Restriction on Length of Module Re-naming #4053

Open jhiston opened 6 years ago

jhiston commented 6 years ago

I have long module names (longest is "I_CC_frm_ContAsLB_1Core_Marker_OwnsContinuousActingAsListbox") and I notice that RD does not handle renaming class/interface code modules that have names that long.

With the 3291 release (and earlier), if I right click the module name on my "I_CC_frm_ContAsLB_1Core_Marker_OwnsContinuousActingAsListbox" class, RD won't accept any 're-name' longer than "I_CC_frm_ContAsLB_1CoreMarker", but VBIDE seems happy with the longer names.

Is there a known limitation (myself and @retailcoder have memories of an issue with fully qualifying member names and limits of Application.Run being used for unit testing). It would be nice to be able to take advantage of the renaming functionality with longer names.

Thanks,

retailcoder commented 6 years ago

Just an observation: seems these names are used for sorting in the VBE's Project Explorer; if you're using @Folder annotations, the prefixing scheme can be dropped in favor of shorter, pronounceable names - the Code Explorer would use the folder annotations to build an actual fully customizable folder hierarchy, making the modules easier to locate/navigate and the code itself more easily readable, at least when qualified module names are used.

Still we need to look into lifting that limitation; RD should be expanding the VBE, not constraining it. Thanks for reporting this issue!

jhiston commented 6 years ago

Your observation is exactly what I'm doing (the "1Core" stuff was recent 'sub-sorting' invention....). My learning to use the Code Explorer functionality would help....

retailcoder commented 6 years ago

The annotation is essentially a special comment that you put at the top of modules, the syntax uses a dot as a folder separator, like this:

'@Folder("Parent.Child.GrandChild")
Option Explicit
'...rest of module...

The code explorer sorts out each modules' folder annotations and determines how to accordingly create the folders. You can use any character you like to name a folder, however I would recommend using a "namespace"-like convention and stick to PascalCase - although, the VBE doesn't honor namespaces, so you still can't have same-name modules in different folders.