Skip to content

Commit 166f2e3

Browse files
authored
Merge pull request #2797 from rubberduck-vba/next
Release 2.0.12
2 parents 28bb596 + 8f5bccd commit 166f2e3

File tree

981 files changed

+47349
-24409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

981 files changed

+47349
-24409
lines changed

Installer Build Script.iss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ OutputDir={#OutputDirectory}
2727
OutputBaseFilename=Rubberduck.Setup.{#AppVersion}
2828
Compression=lzma
2929
SolidCompression=yes
30-
SignTool=RubberduckSignTool /d $qRubberduck Installer$q $f
3130

3231
ArchitecturesAllowed=x86 x64
3332
ArchitecturesInstallIn64BitMode=x64
@@ -53,6 +52,9 @@ Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/codebase {#AddinDLL}"; Workin
5352
Filename: "{dotnet4032}\RegAsm.exe"; Parameters: "/u {#AddinDLL}"; WorkingDir: "{app}"; StatusMsg: "Unregistering Controls..."; Flags: runascurrentuser runminimized; Check: Is32BitOfficeInstalled
5453
Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/u {#AddinDLL}"; WorkingDir: "{app}"; StatusMsg: "Unregistering Controls..."; Flags: runascurrentuser runminimized; Check: Is64BitOfficeInstalled
5554

55+
[UninstallDelete]
56+
Type: filesandordirs; Name: "{localappdata}\{#AppName}"
57+
5658
[CustomMessages]
5759
; TODO add additional languages here.
5860
English.NETFramework40NotInstalled=Microsoft .NET Framework 4.0 installation was not detected.

README.md

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,19 @@ LibGit2Sharp is the library that has allowed us to integrate Git right into the
8181
8282
Which basically means it's a reimplementation of Git in C. It also [happens to be the technology Microsoft uses for their own Git integration with Visual Studio](http://www.hanselman.com/blog/GitSupportForVisualStudioGitTFSAndVSPutIntoContext.aspx).
8383

84-
###[WPF Localization Using RESX Files](http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files)
84+
###[AvalonEdit](http://avalonedit.net)
8585

86-
This library makes localizing WPF applications at runtime using resx files a breeze. Thank you [Grant Frisken](http://www.codeproject.com/script/Membership/View.aspx?mid=1079060)!
86+
Source code looks a lot better with syntax highlighting, and AvalonEdit excels at it.
8787

88-
> Licensed under [The Code Project Open License](http://www.codeproject.com/info/cpol10.aspx) with the [author's permission](http://www.codeproject.com/Messages/5272045/Re-License.aspx) to re-release under the GPLv3.
88+
> AvalonEdit is a WPF-based text editor component. It was written by [Daniel Grunwald](https://github.com/dgrunwald) for the [SharpDevelop](http://www.icsharpcode.net/OpenSource/SD/) IDE. Starting with version 5.0, AvalonEdit is released under the [MIT license](http://opensource.org/licenses/MIT).
8989
90-
###[Using Raw Input from C# to handle multiple keyboards](http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard)
90+
We're currently only using a tiny bit of this code editor's functionality (more to come!).
91+
92+
###[WPF Localization Using RESX Files](http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files)
9193

92-
A library using the Raw Input API for reacting to low level keyboard/mouse events.
94+
This library makes localizing WPF applications at runtime using resx files a breeze. Thank you [Grant Frisken](http://www.codeproject.com/script/Membership/View.aspx?mid=1079060)!
9395

94-
> Licensed under [The Code Project Open License](http://www.codeproject.com/info/cpol10.aspx).
96+
> Licensed under [The Code Project Open License](http://www.codeproject.com/info/cpol10.aspx) with the [author's permission](http://www.codeproject.com/Messages/5272045/Re-License.aspx) to re-release under the GPLv3.
9597
9698
##Icons
9799

@@ -107,4 +109,92 @@ If you can't or don't want to provide attribution, please [purchase a royalty-fr
107109

108110
###[SharpDevelop](https://github.com/icsharpcode/SharpDevelop.git)
109111

110-
Icons in the `./Resources/Custom/` directory were created by (or modified using elements from) the SharpDevelop icon set licensed under the [MIT license](https://opensource.org/licenses/MIT).
112+
Icons in the `./Resources/Custom/` directory were created by (or modified using elements from) the SharpDevelop icon set licensed under the [MIT license](https://opensource.org/licenses/MIT).
113+
114+
---
115+
116+
##[JetBrains](https://www.jetbrains.com) | [ReSharper](https://www.jetbrains.com/resharper/)
117+
118+
[![JetBrains ReSharper logo](https://cloud.githubusercontent.com/assets/5751684/20271309/616bb740-aa58-11e6-91c9-65287b740985.png)](https://www.jetbrains.com/resharper/)
119+
120+
Since the project's early days, JetBrains' Open-Source team has been supporting Rubberduck - and we deeply thank them for that. ReSharper has been not only a tool we couldn't do without; it's been an inspiration, the ultimate level of polished perfection to strive for in our own IDE add-in project. So just like you're missing out if you write VBA and you're not using Rubberduck, you're missing out if you write C# and aren't using ReSharper.
121+
122+
<sub>Note: Rubberduck is not a JetBrains product. JetBrains does not contribute and is not affiliated to the Rubberduck project in any way.</sub>
123+
124+
---
125+
126+
# Overview
127+
128+
The first thing you will notice of Rubberduck is its commandbar and menus; Rubberduck becomes part of the VBE, but at startup you'll notice almost everything is disabled, and the Rubberduck commandbar says "Pending":
129+
130+
![A 'Refresh' button, and 'Pending' state label in the Rubberduck commandbar](https://cloud.githubusercontent.com/assets/5751684/21707782/2e5a1a42-d3a0-11e6-87a3-c36ff65f9a79.png)
131+
132+
This button is how Rubberduck keeps in sync with what's in the IDE: when it's Rubberduck itself making changes to the code, it will refresh automatically, but if you make changes to the code and then want to use Rubberduck features, you'll need Rubberduck to *parse* the code first.
133+
134+
The status label will display various steps:
135+
136+
- **Loading declarations**: Rubberduck noticed new project references and is retrieving information from the COM type libraries.
137+
- **Parsing**: Rubberduck is creating a parse tree for each new module, and/or updating the parse trees for the modified ones.
138+
- **Resolving declarations**: The parse trees are being traversed to identify all declarations (variables, procedures, parameters, locals, ...line labels, *everything*).
139+
- **Resolving references**: The parse trees are being traversed again, this time to locate all identifier references and resolve them all to a specific declaration.
140+
- **Inspecting**: At this point most features are enabled already; Rubberduck is running its inspections and displaying the results in the *inspection results* toolwindow.
141+
142+
That's if everything goes well. Rubberduck assumes the code it's parsing is valid, compilable code that VBA itself can understand.
143+
144+
It's possible you encounter (or write!) code that VBA has no problem with, but that Rubberduck's parser can't handle. When that's the case the Rubberduck commandbar will feature an "error" button:
145+
146+
![button tooltip is "1 module(s) failed to parse; click for details."](https://cloud.githubusercontent.com/assets/5751684/21708236/810e9ade-d3a4-11e6-8b4c-c4ec223c066a.png)
147+
148+
Clicking the button brings up a tab in the *Search Results* toolwindow, from which you can double-click to navigate to the exact problematic position in the code:
149+
150+
![Parser errors are all displayed in a "Parser Errors" search results tab](https://cloud.githubusercontent.com/assets/5751684/21708348/86e64b72-d3a5-11e6-9aa8-60cd8d0bec33.png)
151+
152+
The *Code Explorer* will also be displaying the corresponding module node with a red cross icon:
153+
154+
![Module "ThisWorkbook" didn't parse correctly](https://cloud.githubusercontent.com/assets/5751684/21708276/e8f67e50-d3a4-11e6-8c1d-e84d4e9ccce6.png)
155+
156+
You'll find the *Code Explorer* under the *Navigate* menu. By default the Ctrl+R hotkey to display it instead of the VBE's own *Project Explorer*. The treeview lists not only modules, but also every single one of their members, with their signatures if you want. And you can make it arrange your modules into folders, simply by adding a `@Folder("Parent.Child")` annotation/comment to your modules:
157+
158+
![Code Explorer toolwindow](https://cloud.githubusercontent.com/assets/5751684/21708614/90335a46-d3a8-11e6-9e76-61cc3f566c7a.png)
159+
160+
The *inspection results* toolwindow can be displayed by pressing Ctrl+Shift+i (default hotkey), and allows you to double-click to navigate all potential issues that Rubberduck found in your code.
161+
162+
![inspection results](https://cloud.githubusercontent.com/assets/5751684/21708911/d0c47bc4-d3aa-11e6-88f2-b0c9fcfda7ed.png)
163+
164+
Rubberduck also features a port of the popular "Smart Indenter" add-in (now supports 64-bit hosts, and with a few bugfixes on top of that!), so you can turn this:
165+
166+
````vb
167+
Sub DoSomething()
168+
With ActiveCell
169+
With .Offset(1, 2)
170+
If .value > 100 Then
171+
MsgBox "something"
172+
Else
173+
MsgBox "something else"
174+
End If
175+
End With
176+
End With
177+
End Sub
178+
````
179+
180+
Into this:
181+
182+
````vb
183+
Sub DoSomething()
184+
With ActiveCell
185+
With .Offset(1, 2)
186+
If .value > 100 Then
187+
MsgBox "something"
188+
Else
189+
MsgBox "something else"
190+
End If
191+
End With
192+
End With
193+
End Sub
194+
````
195+
196+
...with a single click.
197+
198+
---
199+
200+
There's *quite a lot* to Rubberduck, the above is barely even a "quick tour"; the project's [website](http://www.rubberduckvba.com/) lists all the features, and the [wiki](https://github.com/rubberduck-vba/Rubberduck/wiki) will eventually document everything there is to document. Feel free to poke around and break things and [request features / create new issues](https://github.com/rubberduck-vba/Rubberduck/issues/new) too!

RetailCoder.VBE/API/Declaration.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ namespace Rubberduck.API
1010
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
1111
public interface IDeclaration
1212
{
13+
[ComVisible(true)]
1314
string Name { get; }
15+
[ComVisible(true)]
1416
Accessibility Accessibility { get; }
17+
[ComVisible(true)]
1518
DeclarationType DeclarationType { get; }
1619
string TypeName { get; }
20+
[ComVisible(true)]
1721
bool IsArray { get; }
18-
22+
[ComVisible(true)]
1923
Declaration ParentDeclaration { get; }
20-
24+
[ComVisible(true)]
2125
IdentifierReference[] References { get; }
2226
}
2327

RetailCoder.VBE/API/ParserState.cs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
using System.ComponentModel;
44
using System.Linq;
55
using System.Runtime.InteropServices;
6-
using Microsoft.Vbe.Interop;
76
using Rubberduck.Common;
7+
using Rubberduck.Parsing.Symbols.DeclarationLoaders;
88
using Rubberduck.Parsing.VBA;
99
using Rubberduck.UI.Command.MenuItems;
1010
using Rubberduck.Parsing.Preprocessing;
1111
using System.Globalization;
12-
using Rubberduck.Parsing.Symbols;
12+
using Rubberduck.VBEditor.SafeComWrappers.VBA;
1313

1414
namespace Rubberduck.API
1515
{
1616
[ComVisible(true)]
1717
public interface IParserState
1818
{
19-
void Initialize(VBE vbe);
19+
void Initialize(Microsoft.Vbe.Interop.VBE vbe);
2020

2121
void Parse();
2222
void BeginParse();
@@ -49,27 +49,36 @@ public sealed class ParserState : IParserState, IDisposable
4949

5050
private RubberduckParserState _state;
5151
private AttributeParser _attributeParser;
52-
private RubberduckParser _parser;
52+
private ParseCoordinator _parser;
53+
private VBE _vbe;
5354

5455
public ParserState()
5556
{
5657
UiDispatcher.Initialize();
5758
}
5859

59-
public void Initialize(VBE vbe)
60+
public void Initialize(Microsoft.Vbe.Interop.VBE vbe)
6061
{
6162
if (_parser != null)
6263
{
6364
throw new InvalidOperationException("ParserState is already initialized.");
6465
}
6566

66-
_state = new RubberduckParserState(new Sinks(vbe));
67+
_vbe = new VBE(vbe);
68+
_state = new RubberduckParserState(null);
6769
_state.StateChanged += _state_StateChanged;
6870

69-
Func<IVBAPreprocessor> preprocessorFactory = () => new VBAPreprocessor(double.Parse(vbe.Version, CultureInfo.InvariantCulture));
71+
Func<IVBAPreprocessor> preprocessorFactory = () => new VBAPreprocessor(double.Parse(_vbe.Version, CultureInfo.InvariantCulture));
7072
_attributeParser = new AttributeParser(new ModuleExporter(), preprocessorFactory);
71-
_parser = new RubberduckParser(vbe, _state, _attributeParser, preprocessorFactory,
72-
new List<ICustomDeclarationLoader> { new DebugDeclarations(_state), new FormEventDeclarations(_state), new AliasDeclarations(_state) });
73+
_parser = new ParseCoordinator(_vbe, _state, _attributeParser, preprocessorFactory,
74+
new List<ICustomDeclarationLoader>
75+
{
76+
new DebugDeclarations(_state),
77+
new SpecialFormDeclarations(_state),
78+
new FormEventDeclarations(_state),
79+
new AliasDeclarations(_state),
80+
//new RubberduckApiDeclarations(_state)
81+
});
7382
}
7483

7584
/// <summary>
@@ -94,7 +103,7 @@ public void BeginParse()
94103
public event Action OnReady;
95104
public event Action OnError;
96105

97-
private void _state_StateChanged(object sender, System.EventArgs e)
106+
private void _state_StateChanged(object sender, EventArgs e)
98107
{
99108
_allDeclarations = _state.AllDeclarations
100109
.Select(item => new Declaration(item))
@@ -151,6 +160,8 @@ public void Dispose()
151160
_state.StateChanged -= _state_StateChanged;
152161
}
153162

163+
164+
_vbe.Release();
154165
_disposed = true;
155166
}
156167
}

0 commit comments

Comments
 (0)