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

Code Explorer sort options partially working. #4883

Open daFreeMan opened 5 years ago

daFreeMan commented 5 years ago

Rubberduck version information Version 2.4.1.4627 OS: Microsoft Windows NT 10.0.15063.0, x64 Host Product: Microsoft Office 2016 x64 Host Version: 16.0.4813.1000 Host Executable: MSACCESS.EXE

Description Members within a module are sorted according to the sort option setting, however, the modules themselves are not sorted by this setting.

To Reproduce Steps to reproduce the behavior:

  1. Using the '@folder annotation, put several modules in an RD folder
  2. Click on CE's Sort button to select a sort order
  3. Note that the order of the modules does not change based on this setting.

Expected behavior I would expect that modules themselves would sort alphabetically, with the Group by type setting being applied if selected. I'm not sure how the As in module function would work, since there is no order to the modules themselves. Effectively, the sort should always be alpha, with the option to Group by type.

Screenshots This could be considered sorted alpha and grouped by type, however, Group by type is not selected. Also, I believe that the "green circle" icon indicates an interface, and I would think that Group by type would consider that a different type. 2019-04-01 09_01_19-Microsoft Visual Basic for Applications - ROIReport 2 2 7 -  WebResponse (Code)

Logfile RubberduckLog.txt

daFreeMan commented 4 years ago
Version 2.5.0.5394
OS: Microsoft Windows NT 10.0.17134.0, x64
Host Product: Microsoft Office 2016 x64
Host Version: 16.0.4924.1000
Host Executable: MSACCESS.EXE

I believe that I have just noticed a related issue - Items within a UDT are not sorted in the CE - they're listed in the order they're defined in the UDT in code until I manually change sort order.

By default (and by my preference), by Name is selected as the sort order, and this is what I get for my UDT: 2020-03-31 08_30_53-Microsoft Visual Basic for Applications - ROIReport -  WebDriverSelenium (Code)

When I switch to As in Module, I get this: 2020-03-31 08_38_38-Microsoft Visual Basic for Applications - ROIReport -  WebDriverSelenium (Code)

Then, when I switch back to by Name, I finally get this: 2020-03-31 08_39_38-Microsoft Visual Basic for Applications - ROIReport -  WebDriverSelenium (Code)

I'm not 100% certain that this is related, perhaps it's a new item. As I was posting this I think that this is because the CE is not sorting after a parse, as opposed to not sorting properly. However, the more I've investigated, attempting to determine exactly what's going on, it appears that on initial parse, the CE is ignoring the sort order and group by flags. On changing these flags, it seems to display properly.

Attached is a new log where I've done the initial parse, then turned on the Group by type flag (which is initially off), then turned that flag back off. After turning the flag on (and also after it's off), everything seems to be sorted just fine. RubberduckLog.txt