Questions tagged [rubberduck]

Rubberduck is an open-source COM add-in project for the VBA/VB6 IDE written in C#. Use this tag for reviews of the C# source code, or for reviews of VBA/VB6 client code.

Filter by
Sorted by
Tagged with
3
votes
0answers
74 views

Rich data types - boolean object

Context You can probably skim most of this, it's unlikely to be useful for a review and is just for background info. Also download the files I've tried to create a ...
5
votes
1answer
100 views

Custom lexer/parser-based code prettifier

I'm adding rather extensive xml-doc comments to all Rubberduck inspection classes, like this: ...
2
votes
2answers
80 views

Abstracting and unit testing lookups in Excel table

Background I have a vba solution that I use to ingest investment text reports and reformat them for analysis in Excel. It works, but the macros involve a lot of direct manipulation of Excel objects, ...
3
votes
0answers
79 views

Unit testing a custom collection

To enable unit testing in the VBA IDE I'm using https://github.com/rubberduck-vba/Rubberduck. I've created a class and a custom collection class to work with structural members I need to filter. The ...
10
votes
2answers
132 views

Prettifier isn't pretty

Some context I'm implementing a self-closing pairs auto-completion feature in Rubberduck. One of the challenges is that the VBIDE API doesn't allow editing a line of code by "injecting" characters: ...
10
votes
1answer
195 views

BattleShip Grid: Classes and Tests

In my ongoing quest to demonstrate how VBA code can absolutely be object-oriented, I've started implementing a game of Battleship in pure VBA. This is a rather large project, so I'll split the ...
15
votes
2answers
226 views

Enhancing autocompletion for VBA code

Context The Visual Basic Editor (VBE) does a good job at completing member scopes, for example when you type this and hit ENTER... Private Sub DoSomething You ...
3
votes
0answers
97 views

Maintaining a complicated installer supporting per-user and everyone

Another challenge for developing rubberduck VBA project is to develop an installer that support per-user mode and everyone-mode. Normally with an MSI package, one has a bootstrapper so it is possible ...
10
votes
1answer
922 views

Using build event to run Powershell script to run built DLL

As a rule, whenever I find myself doing something that nobody else is doing, I have to be quite suspicious about what I'm doing. This is why I want to get code review to verify I'm not doing something ...
12
votes
4answers
362 views

Constructor-injecting a truckload of commands

There's a problem in Rubberduck that we haven't neatly solved yet, and as we're exploring alternative approaches I figured I'd ask the CR community and see what our C# experts think. Here's the ...
5
votes
1answer
331 views

Antlr Visitor with complex result

I'm currently helping out on Rubberduck open source project, specifically on the Extract Method functionality. I wrote a purpose-built visitor to assist with ...
6
votes
3answers
167 views

Rubberduck Test Module Creation

I recently started learning C# and am taking the opportunity to try and accelerate my introduction by helping the RubberDuck team (Website and GitHub Repo). The full class code that I'm working on can ...
11
votes
1answer
171 views

Properly destroying the VBE

The disposable wrappers worked exactly as intended... and that turned out being a huge mistake: That's because the .net runtime creates a Runtime Callable Wrapper per-type, not per-instance*; it took ...
7
votes
2answers
368 views

A generic IEnumerator to enumerate COM collections

As I wrapped the VBIDE API, I encountered a number of "collection types" (Windows, CodePanes, ...
8
votes
3answers
815 views

Wrapping COM objects with IDisposable

One of the things believed to contribute to destabilizing Rubberduck 2.x, is the fact that a lot of COM object references are stored in many places, and ...
3
votes
1answer
88 views

ApplicationSettings Class for disabling/restoring Application State

This previous iteration of this question can be found here A utility class to handle the state of the Application object. Storing the application's initial state (...
4
votes
1answer
191 views

IDTExtensibility2 implementation for Rubberduck's entry point

Here is the new & improved Rubberduck 2.x entry point class, based on MZ-Tools 8.0's Connect.VBA implementation of the ...
3
votes
1answer
94 views

Avoiding a call to CommandBarControl.Picture

Earlier today, I encountered an Access Violation error when opening the VBE for SolidWorks 2006, while Rubberduck VBA was initializing. I traced the Access Violation back to an attempt to set the ...
14
votes
3answers
176 views

Fighting f̶i̶r̶e̶ regex with f̶i̶r̶e̶ regex

So someone requested a Regex Builder / Assistant for Rubberduck and since my CS class had been covering the topic only recently I was thinking to myself: "This sounds interesting, you should do this". ...
4
votes
2answers
126 views

Code Explorer UI

The third post in the Code Explorer series is about the UI and main VM. This is the XAML, except a few hundred lines of styling: ...
4
votes
1answer
69 views

Code Explorer View Models

Continuing the series of Code Explorer posts, here is the collection of view models for the tree nodes: This is the interface for nodes with a declaration. ...
7
votes
1answer
119 views

Code Explorer Commands

Rubberduck's Code Explorer was recently redesigned from scratch: Anything from modern features, such as virtual folders (limitation of the VBE--it doesn't support real folders), to ancient features ...
7
votes
2answers
523 views

Evaluating Parser State

The "parser state" of a module in rubberduck can be one of several values: ...
8
votes
1answer
287 views

A status bar for the VBE

One of the most annoying things about the VBE (VBA's IDE), is that it doesn't have a status bar. Rubberduck 2.0 works around this by introducing the ...
7
votes
2answers
274 views

Exporting a UserForm from the VBE… and working around API bugs

Rubberduck has been using an extension method to export code files, notably for source control purposes. While testing source control, I ran into a weird bug in the VBIDE API, which caused UserForm ...
7
votes
1answer
366 views

Milking a COM type library: “fun” with COM reflection

Once upon a time, there was a duck that wanted to know where and how user code was calling into the VBA standard library and Excel object model. To match the rest of its API, the poor little duck had ...
4
votes
1answer
57 views

FindAllReferencesCommand 2.0

Rubberduck 2.0 will feature a "Search Results" dockable toolwindow that will be used for displaying the results of Find all references, Find all implementations, and whatever else we need to find. It ...
5
votes
1answer
183 views

About Window in XAML

I just redid Rubberduck's About window in XAML: I do not like my XAML very much. The way I place the StackPanel for the white pane over two rows, only to provide ...
3
votes
3answers
504 views

Unit Test Settings

Recently, I redesigned the Rubberduck settings pane. Here is the unit test settings view, which is posted in this question: The part we are referring to is the section in the right pane. The rest ...
4
votes
1answer
151 views

Displaying inspection results, grouped per user selection

The Rubberduck 2.0 Code Inspections UI was recently redesigned (again!), this time featuring a GroupingGrid control (thanks @BrunoCosta!), and what appears to be a ...
6
votes
4answers
315 views

Unit Testing the Duck

I recently reinstated the unit tests in Rubberduck. Previously, our parser was a synchronous parser, with everything running in sequence, and we could just request a parse result. Now, however, it ...
10
votes
1answer
218 views

Code Explorer 2.0: A folder hierarchy to organize VBA projects

Next release of Rubberduck will introduce a very cool @Folder annotation system that the Code Explorer will use to organize modules into - you guessed it - folders: ...
6
votes
1answer
90 views

Inspector Rubberduck and the abstract inspections

The Rubberduck code inspections have just seen yet another structural change, hopefully for the better. The IInspectionModel interface was originally named ...
5
votes
1answer
74 views

Convert Procedure to Function

My latest inspection for Rubberduck determines whether a procedure should be a function by checking whether it has a single ByRef parameter (either explicit or ...
11
votes
1answer
113 views

Extract Interface

One of the latest refactorings for Rubberduck is Extract Interface. This refactoring will take a class, display all public members, and allow you to select which members you wish to include in your ...
5
votes
1answer
127 views

Implement Interface Refactoring

The latest refactoring for Rubberduck is Implement Interface. This refactoring will check whether the active class fully implements the selected interface by comparing the definitions. It knows the ...
10
votes
1answer
91 views

Move Closer To Usage

One of my latest refactorings for Rubberduck is Move Closer To Usage. The refactoring will take a field and move it just above the reference to it only if it is used in a single method, or take a ...
7
votes
1answer
78 views

The Realtor-duck: Encapsulating Fields with Properties

The latest new refactoring for our friend Rubberduck is Encapsulate Field: This image, for the sake of brevity, shows the result of the refactoring and the UI together. The three properties below the ...
8
votes
1answer
75 views

Climbing the Totem Pole - Local Variables Become Parameters

Along with the Introduce Field refactoring, I wrote an Introduce Parameter refactoring. I actually wrote this refactoring first, but due to a bug in the parser/resolver, I was unable to fully test it ...
18
votes
4answers
3k views

You are Promoted, You are Promoted, We All are Promoted!​

My latest refactoring for Rubberduck is called Introduce Field - it promotes a local variable to a private field. The three overridden Refactor() methods are the ...
15
votes
5answers
249 views

Step by Step, ooh HotKey

Still hooked on Windows, I refactored the hook into a number of interfaces, and I wanted to support 2-step hotkeys, so I started with defining an IHook that can be ...
23
votes
2answers
5k views

Hooked on Windows

The code that was just added to Rubberduck will allow us to set up hotkeys for our features, so that next release, Ctrl+Shift+R brings up the refactor/rename dialog, for example. The requirements ...
21
votes
2answers
305 views

RubberduckParser 2.0 - Asynchronous Parsing

The IRubberduckParser interface has seen breaking changes, and now looks like this: ...
11
votes
2answers
102 views

IdentifierReferenceResolver: resolving at project level

One of the most important parts at the core of rubberduck is the IdentifierReferenceResolver class, which is responsible for resolving each declaration as the parse ...
8
votes
2answers
425 views

Declaration of bloatedness: the class that knew too much?

I've already expressed concerns about this type's constructor, and I've sort-of* implemented the changes suggested in the answers I got there. Recently I added even more parameters to that ...
14
votes
2answers
240 views

Learning by translating - Follow the Rubberduck - Part 2: Beta

This project is my learning place for a few things: MVP (model view presenter) XML (parsing, editing and leveraging) deeper swing functionality Concerning the XML part I have already recieved a ...
8
votes
1answer
109 views

CommandBars, Buttons and Commands: Take 3

Following up on CommandBars, Buttons and Commands: Take 2, I've refactored quite a lot of the Rubberduck code base (like, a whole third of the entire code base has been affected), and successfully ...
8
votes
1answer
278 views

TestExplorer 2.0 - From Grid to TreeView

Rubberduck's unit testing feature (heck, the whole project) started with a VBA unit testing framework that was ported from vba to c#; the VBA logic was pretty much simply rewritten in another language,...
6
votes
2answers
155 views

CommandBars, Buttons and Commands: Take 2

Following-up on CommandBars, Buttons and Commands: Cleanup is on the menu, I decided to try a more ambitious approach, as suggested in Nikita's answer. It works, but there are a number of "gotchas" ...
14
votes
2answers
212 views

CommandBars, Buttons and Commands: Cleanup is on the menu

One of the biggest pain point in the entire rubberduck code base, is the way commandbar menus and menu items are created and wired up - something needs to be done to straighten that up, and while I ...