Skip to content

Commit e25d536

Browse files
committed
Merge upstream
2 parents 25e534c + 3ce0920 commit e25d536

File tree

772 files changed

+63389
-26832
lines changed

Some content is hidden

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

772 files changed

+63389
-26832
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,5 @@ $RECYCLE.BIN/
177177
*.xlsm
178178
Installers/
179179
*.xlsx
180+
181+
CodeGraphData/

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,5 @@ If you contribute a translation for a brand new previously unsupported language,
9595

9696
Well ... the eternal gratitude of all Rubberduck users for one :wink:
9797
Aside from that, all contributors are explicitly listed by name (or alias) in the "About Rubberduck" window.
98-
In addition to that, there is some [Contributor-only Rubberduck swag](https://gofundme.com/rubberduckvba), that can be sent to you, at the discretion of @retailcoder.. while supplies last.
98+
99+
We ran a [fundraiser](https://gofundme.com/rubberduckvba) last summer, and had t-sihrts, mugs, pens, and stickers made - the goods are now unfortunately depleted; we'll probably run another campaign next year!

Installer Build Script.iss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#define BuildDir SourcePath + "RetailCoder.VBE\bin\release"
1+
#define BuildDir SourcePath + "RetailCoder.VBE\bin\Release"
22
#define AppName "Rubberduck"
33
#define AddinDLL "Rubberduck.dll"
44
#define InspectionsDLL "Rubberduck.Inspections.dll"
5-
#define AppVersion GetFileVersion(SourcePath + "RetailCoder.VBE\bin\release\Rubberduck.dll")
5+
#define AppVersion GetFileVersion(SourcePath + "RetailCoder.VBE\bin\Release\Rubberduck.dll")
66
#define AppPublisher "Rubberduck"
77
#define AppURL "http://rubberduckvba.com"
88
#define License SourcePath + "\License.rtf"
@@ -37,9 +37,9 @@ ArchitecturesInstallIn64BitMode=x64
3737
Name: "English"; MessagesFile: "compiler:Default.isl"
3838

3939
[Files]
40-
; Install the correct bitness binaries.
41-
Source: "libs\NativeBinaries\amd64\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "{#AddinDLL}"; Check: Is64BitOfficeInstalled
42-
Source: "libs\NativeBinaries\x86\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "{#AddinDLL}"; Check: Is32BitOfficeInstalled
40+
; Install the correct bitness binaries.
41+
Source: "{#BuildDir}\lib\win32\x64\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "{#AddinDLL}"; Check: Is64BitOfficeInstalled
42+
Source: "{#BuildDir}\lib\win32\x86\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "{#AddinDLL}"; Check: Is32BitOfficeInstalled
4343

4444
Source: "{#BuildDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Excludes: "{#AddinDLL},\NativeBinaries"
4545
Source: "{#BuildDir}\{#InspectionsDLL}"; DestDir: "{app}"; Flags: ignoreversion

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<img src="http://i.stack.imgur.com/jnBEp.jpg" width=100% />
22

3+
<!-- campaign is no longer accepting donations
34
### Donate!
45
56
If you like this project and would like to thank its contributors, you are welcome to support our GoFundMe campaign to finance Rubberduck swag and international shipping - contributors will be getting t-shirts, mugs, and other cool things.
67
78
[![GoFundMe campaign](https://user-images.githubusercontent.com/5751684/29191799-e3d20b72-7dec-11e7-8ec6-0c69da4a3135.png)](https://www.gofundme.com/rubberduckvba)
9+
-->
810

911
Branch | Description | Build Status |
1012
|------------|---|--------------|
@@ -14,7 +16,7 @@ Branch | Description | Build Status |
1416
[nextBuildStatus]:https://ci.appveyor.com/api/projects/status/we3pdnkeebo4nlck/branch/next?svg=true
1517
[masterBuildStatus]:https://ci.appveyor.com/api/projects/status/we3pdnkeebo4nlck/branch/master?svg=true
1618

17-
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/rubberduck-vba/rubberduck.svg)](http://isitmaintained.com/project/rubberduck-vba/rubberduck "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/rubberduck-vba/rubberduck.svg)](http://isitmaintained.com/project/rubberduck-vba/rubberduck "Percentage of issues still open")
19+
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/rubberduck-vba/Rubberduck.svg)](http://isitmaintained.com/project/rubberduck-vba/Rubberduck "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/rubberduck-vba/Rubberduck.svg)](http://isitmaintained.com/project/rubberduck-vba/Rubberduck "Percentage of issues still open")
1820

1921
> **[rubberduckvba.com](http://rubberduckvba.com)** [Wiki](https://github.com/retailcoder/Rubberduck/wiki) [Rubberduck News](https://rubberduckvba.wordpress.com/)
2022
> contact@rubberduckvba.com

RetailCoder.VBE/API/VBA/Declaration.cs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,18 @@ public interface IDeclaration
3232
[EditorBrowsable(EditorBrowsableState.Always)]
3333
public class Declaration : IDeclaration
3434
{
35-
private readonly RubberduckDeclaration _declaration;
36-
3735
internal Declaration(RubberduckDeclaration declaration)
3836
{
39-
_declaration = declaration;
37+
Instance = declaration;
4038
}
4139

42-
protected RubberduckDeclaration Instance { get { return _declaration; } }
40+
protected RubberduckDeclaration Instance { get; }
4341

44-
public bool IsArray { get { return _declaration.IsArray; } }
45-
public string Name { get { return _declaration.IdentifierName; } }
46-
public Accessibility Accessibility { get { return (Accessibility)_declaration.Accessibility; } }
47-
public DeclarationType DeclarationType {get { return TypeMappings[_declaration.DeclarationType]; }}
48-
public string TypeName { get { return _declaration.AsTypeName; } }
42+
public bool IsArray => Instance.IsArray;
43+
public string Name => Instance.IdentifierName;
44+
public Accessibility Accessibility => (Accessibility)Instance.Accessibility;
45+
public DeclarationType DeclarationType => TypeMappings[Instance.DeclarationType];
46+
public string TypeName => Instance.AsTypeName;
4947

5048
private static readonly IDictionary<Parsing.Symbols.DeclarationType,DeclarationType> TypeMappings =
5149
new Dictionary<Parsing.Symbols.DeclarationType, DeclarationType>
@@ -75,20 +73,14 @@ internal Declaration(RubberduckDeclaration declaration)
7573
};
7674

7775
private Declaration _parentDeclaration;
78-
public Declaration ParentDeclaration
79-
{
80-
get
81-
{
82-
return _parentDeclaration ?? (_parentDeclaration = new Declaration(Instance.ParentDeclaration));
83-
}
84-
}
76+
public Declaration ParentDeclaration => _parentDeclaration ?? (_parentDeclaration = new Declaration(Instance.ParentDeclaration));
8577

8678
private IdentifierReference[] _references;
8779
public IdentifierReference[] References
8880
{
8981
get
9082
{
91-
return _references ?? (_references = _declaration.References.Select(item => new IdentifierReference(item)).ToArray());
83+
return _references ?? (_references = Instance.References.Select(item => new IdentifierReference(item)).ToArray());
9284
}
9385
}
9486
}

RetailCoder.VBE/API/VBA/IdentifierReference.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,19 @@ public IdentifierReference(Parsing.Symbols.IdentifierReference reference)
3131
}
3232

3333
private Declaration _declaration;
34-
public Declaration Declaration
35-
{
36-
get { return _declaration ?? (_declaration = new Declaration(_reference.Declaration)); }
37-
}
34+
public Declaration Declaration => _declaration ?? (_declaration = new Declaration(_reference.Declaration));
3835

3936
private Declaration _parentScoping;
40-
public Declaration ParentScope
41-
{
42-
get { return _parentScoping ?? (_parentScoping = new Declaration(_reference.ParentScoping)); }
43-
}
37+
public Declaration ParentScope => _parentScoping ?? (_parentScoping = new Declaration(_reference.ParentScoping));
4438

4539
private Declaration _parentNonScoping;
46-
public Declaration ParentNonScoping
47-
{
48-
get { return _parentNonScoping ?? (_parentNonScoping = new Declaration(_reference.ParentNonScoping)); }
49-
}
40+
public Declaration ParentNonScoping => _parentNonScoping ?? (_parentNonScoping = new Declaration(_reference.ParentNonScoping));
5041

51-
public bool IsAssignment { get { return _reference.IsAssignment; } }
42+
public bool IsAssignment => _reference.IsAssignment;
5243

53-
public int StartLine { get { return _reference.Selection.StartLine; } }
54-
public int EndLine { get { return _reference.Selection.EndLine; } }
55-
public int StartColumn { get { return _reference.Selection.StartColumn; } }
56-
public int EndColumn { get { return _reference.Selection.EndColumn; } }
44+
public int StartLine => _reference.Selection.StartLine;
45+
public int EndLine => _reference.Selection.EndLine;
46+
public int StartColumn => _reference.Selection.StartColumn;
47+
public int EndColumn => _reference.Selection.EndColumn;
5748
}
5849
}

RetailCoder.VBE/API/VBA/ParserState.cs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ public void BeginParse()
150150

151151
private void _state_StateChanged(object sender, EventArgs e)
152152
{
153-
_allDeclarations = _state.AllDeclarations
153+
AllDeclarations = _state.AllDeclarations
154154
.Select(item => new Declaration(item))
155155
.ToArray();
156156

157-
_userDeclarations = _state.AllUserDeclarations
157+
UserDeclarations = _state.AllUserDeclarations
158158
.Select(item => new Declaration(item))
159159
.ToArray();
160160

@@ -177,20 +177,9 @@ private void _state_StateChanged(object sender, EventArgs e)
177177
}
178178
}
179179

180-
private Declaration[] _allDeclarations;
180+
public Declaration[] AllDeclarations { get; private set; }
181181

182-
public Declaration[] AllDeclarations
183-
{
184-
//[return: MarshalAs(UnmanagedType.SafeArray/*, SafeArraySubType = VarEnum.VT_VARIANT*/)]
185-
get { return _allDeclarations; }
186-
}
187-
188-
private Declaration[] _userDeclarations;
189-
public Declaration[] UserDeclarations
190-
{
191-
//[return: MarshalAs(UnmanagedType.SafeArray/*, SafeArraySubType = VarEnum.VT_VARIANT*/)]
192-
get { return _userDeclarations; }
193-
}
182+
public Declaration[] UserDeclarations { get; private set; }
194183

195184
private bool _disposed;
196185
public void Dispose()

RetailCoder.VBE/App.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void Startup()
120120
_hooks.HookHotkeys(); // need to hook hotkeys before we localize menus, to correctly display ShortcutTexts
121121
_appMenus.Localize();
122122

123-
if (_config.UserSettings.GeneralSettings.CheckVersion)
123+
if (_config.UserSettings.GeneralSettings.CanCheckVersion)
124124
{
125125
_checkVersionCommand.Execute(null);
126126
}
@@ -165,7 +165,7 @@ private void CheckForLegacyIndenterSettings()
165165
try
166166
{
167167
Logger.Trace("Checking for legacy Smart Indenter settings.");
168-
if (_config.UserSettings.GeneralSettings.SmartIndenterPrompted ||
168+
if (_config.UserSettings.GeneralSettings.IsSmartIndenterPrompted ||
169169
!_config.UserSettings.IndenterSettings.LegacySettingsExist())
170170
{
171171
return;
@@ -177,7 +177,7 @@ private void CheckForLegacyIndenterSettings()
177177
Logger.Trace("Attempting to load legacy Smart Indenter settings.");
178178
_config.UserSettings.IndenterSettings.LoadLegacyFromRegistry();
179179
}
180-
_config.UserSettings.GeneralSettings.SmartIndenterPrompted = true;
180+
_config.UserSettings.GeneralSettings.IsSmartIndenterPrompted = true;
181181
_configService.SaveConfiguration(_config);
182182
}
183183
catch
@@ -192,11 +192,11 @@ public void LogRubberduckStart()
192192
GlobalDiagnosticsContext.Set("RubberduckVersion", version.ToString());
193193
var headers = new List<string>
194194
{
195-
string.Format("\r\n\tRubberduck version {0} loading:", version),
196-
string.Format("\tOperating System: {0} {1}", Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"),
197-
string.Format("\tHost Product: {0} {1}", Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86"),
198-
string.Format("\tHost Version: {0}", Application.ProductVersion),
199-
string.Format("\tHost Executable: {0}", Path.GetFileName(Application.ExecutablePath)),
195+
$"\r\n\tRubberduck version {version} loading:",
196+
$"\tOperating System: {Environment.OSVersion.VersionString} {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}",
197+
$"\tHost Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}",
198+
$"\tHost Version: {Application.ProductVersion}",
199+
$"\tHost Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}", // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
200200
};
201201
LogLevelHelper.SetDebugInfo(string.Join(Environment.NewLine, headers));
202202
}

RetailCoder.VBE/AppMenu.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Threading;
5+
using NLog;
46
using Rubberduck.Parsing;
57
using Rubberduck.Parsing.VBA;
68
using Rubberduck.UI;
@@ -17,6 +19,8 @@ public class AppMenu : IAppMenu, IDisposable
1719
private readonly ISelectionChangeService _selectionService;
1820
private readonly RubberduckCommandBar _stateBar;
1921

22+
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
23+
2024
public AppMenu(IEnumerable<IParentMenuItem> menus, IParseCoordinator parser, ISelectionChangeService selectionService, RubberduckCommandBar stateBar)
2125
{
2226
_menus = menus.ToList();
@@ -77,7 +81,13 @@ private void RemoveMenus()
7781
{
7882
foreach (var menu in _menus.Where(menu => menu.Item != null))
7983
{
84+
_logger.Debug($"Starting removal of top-level menu {menu.GetType()}.");
8085
menu.RemoveMenu();
86+
//We do this here and not in the menu items because we only want to dispose of/release the parents of the top level parent menus.
87+
//The parents further down get disposed of/released as part of the remove chain.
88+
_logger.Trace($"Removing parent menu of top-level menu {menu.GetType()}.");
89+
menu.Parent.Dispose();
90+
menu.Parent = null;
8191
}
8292
}
8393
}

RetailCoder.VBE/Common/ClipboardWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public class ClipboardWriter : IClipboardWriter
1919

2020
public void Write(string text)
2121
{
22-
this.AppendString(DataFormats.UnicodeText, text);
23-
this.Flush();
22+
AppendString(DataFormats.UnicodeText, text);
23+
Flush();
2424
}
2525

2626
public void AppendImage(BitmapSource image)

0 commit comments

Comments
 (0)