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.91k stars 299 forks source link

Show Modules of Locked Projects in Code Explorer #5769

Open Talorthain opened 3 years ago

Talorthain commented 3 years ago

Rubberduck version 2.5.2.5913 loading: Operating System: Microsoft Windows NT 10.0.19042.0 x64 Host Product: Microsoft Office x64 Host Version: 16.0.13929.20296 Host Executable: EXCEL.EXE;

Projects not appearing in the code explorer window. They are present in the basic excel vbe... image

open a file which uses multiple projects (add-in). Even if they are locked, I would like to see them and when they are selected I have to enter the password.

Expected that all projects would be visible (not parsed). To make it appear I had to unlock project and open code from the basic vbe and then request the rubberduck code explorer to resync, which then displayed the project

Logfile RubberduckLog.txt

Additional context Add any other context about the problem here.

retailcoder commented 3 years ago

This isn't a bug, it's behaving exactly as intended, because accessing the components of a locked project from the VBIDE Extensibility API would throw an exception.

However with recent-ish internal ITypeLib API capabilities, Rubberduck is gaining access to locked projects' modules (and their public members) loaded in the IDE, and the plan is to get the Code Explorer to populate without even needing to parse anything.

Side note, the new "Ignore Project" feature addresses the exact opposite scenario.

retailcoder commented 3 years ago

That said there should indeed be a node for a locked project, even without child nodes. Need to check why we're not generating a ProjectDeclaration for a locked project - the likely explanation being that the project declaration is being created just before its components get iterated.

MDoerner commented 3 years ago

We always generate the project declarations for locked and ignored projects. (Actually, we generate all declarations for them based on the type library.) However, they are treated as built-in declarations, for which we generally do not generate nodes in the Code Explorer. The only built-in items we show are the library reference headers.

MDoerner commented 3 years ago

One question, do you reference the locked project from your other project? in that case, there should be a Referenced Projects node listing the other project.

Talorthain commented 3 years ago

Hi,

The other project is an Add-in that I design and manage. The projects that open, load the add-in, then uses the add-in to create instances of classes the add-in holds.

e.g.

set m_objSharePoint = application.run(addin, "create SharePoint class")

m_objSharePoint then hold an instance of the class from the addin

Regards

Anthony Taylor


From: Max Dörner @.> Sent: 08 May 2021 16:05 To: rubberduck-vba/Rubberduck @.> Cc: Anthony @.>; Author @.> Subject: Re: [rubberduck-vba/Rubberduck] Show Modules of Locked Projects in Code Explorer (#5769)

One question, do you reference the locked project from your other project? in that case, there should be a Referenced Projects node listing the other project.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rubberduck-vba/Rubberduck/issues/5769#issuecomment-835395761, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABT3JV3B47B3TDWANSU4FNDTMVHMFANCNFSM44NG3ZCA.

retailcoder commented 3 years ago

@MDoerner it looks like OP is late-binding the add-in reference, because an early-bound one would have the add-in show up under "Project References":

Code Explorer with a 'project references' node

Talorthain commented 3 years ago

Hi,

Just to add, and I apologise if this is already a know, I don't even see the file project if locked.

[cid:3b04c6f9-5e26-4da2-af49-7d29723ec62f]

If they can be listed with option to unlock, that would be great.

(This file doesn't use the add-in)

Regards

Anthony Taylor


From: Mathieu Guindon @.> Sent: 10 May 2021 22:23 To: rubberduck-vba/Rubberduck @.> Cc: Anthony @.>; Author @.> Subject: Re: [rubberduck-vba/Rubberduck] Show Modules of Locked Projects in Code Explorer (#5769)

@MDoernerhttps://github.com/MDoerner it looks like OP is late-binding the add-in reference, because an early-bound one would have the add-in show up under "Project References":

[Code Explorer with a 'project references' node]https://user-images.githubusercontent.com/5751684/117726080-10dbc500-b1b4-11eb-8a7d-959e7044236b.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rubberduck-vba/Rubberduck/issues/5769#issuecomment-837366173, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABT3JV3ZYIO6ERZQF5ZLLHDTNBFDVANCNFSM44NG3ZCA.

Talorthain commented 3 years ago

Hi,

The add-in is late bound, because it is replaced when the file is opened, to ensure the user has the most recent version.

If all projects could be listed (not parsed) then I would select and unlock.

Regards

Anthony Taylor


From: Mathieu Guindon @.> Sent: 10 May 2021 22:23 To: rubberduck-vba/Rubberduck @.> Cc: Anthony @.>; Author @.> Subject: Re: [rubberduck-vba/Rubberduck] Show Modules of Locked Projects in Code Explorer (#5769)

@MDoernerhttps://github.com/MDoerner it looks like OP is late-binding the add-in reference, because an early-bound one would have the add-in show up under "Project References":

[Code Explorer with a 'project references' node]https://user-images.githubusercontent.com/5751684/117726080-10dbc500-b1b4-11eb-8a7d-959e7044236b.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rubberduck-vba/Rubberduck/issues/5769#issuecomment-837366173, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABT3JV3ZYIO6ERZQF5ZLLHDTNBFDVANCNFSM44NG3ZCA.