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

"Find all references" gives an error for References #4654

Closed daFreeMan closed 5 years ago

daFreeMan commented 5 years ago

Version 2.3.1.4330 OS: Microsoft Windows NT 10.0.15063.0, x64 Host Product: Microsoft Office 2016 x64 Host Version: 16.0.4711.1000 Host Executable: MSACCESS.EXE

Expand the References section of the Code Explorer Select any of the referenced libraries. Click Find All References... at the bottom of the CE Boom: 2018-12-18 15_51_00-microsoft visual basic for applications - roireport - reportdefinitioncodebehin

The "identifier" is 'coDown', no matter which library I've selected.

retailcoder commented 5 years ago

This is an opportunity to enhance the Find all References feature to locate all early-bound references to a given type library!

Inarion commented 5 years ago

Just yesterday when I explored the new and shiny references dialog, I saw how many references I had set and thought: Would it be possible to detect if there are any early-bound members of that library? (The workaround is to remove the reference and see if the project still compiles...) :D

Awesome idea!

comintern commented 5 years ago

Which references do we want included in the search results for this? The current method in the DeclarationFinder for identifying if a reference is "used" looks at all identifier references for the library and all uses of its declared types (i.e. Dim Foo as Worksheet). We could easily do that, but for an enormous project, that might make for an... extensive... list of results for the host project, and probably even more for the VBA reference.

Should we use the same rule (match the "dimmed" criteria in the CE), but maybe exclude built in libraries?

retailcoder commented 5 years ago

I wouldn't exclude any libraries... could identifier refs be cached by typelib in [yet another] dictionary? That could simplify the code that identifies unused libraries.

comintern commented 5 years ago

I'm don't think the un-cached performance is really that bad ATM. I was mainly coming at it from the standpoint of Find all references... --> OK, here's a dialog with a couple thousand results.