Skip to content

Commit d0b2b6c

Browse files
authored
Merge pull request #3572 from rubberduck-vba/next
Release 2.1.1
2 parents 538dfca + a4d6173 commit d0b2b6c

File tree

317 files changed

+23691
-13678
lines changed

Some content is hidden

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

317 files changed

+23691
-13678
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!

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Branch | Description | Build Status |
1616
[nextBuildStatus]:https://ci.appveyor.com/api/projects/status/we3pdnkeebo4nlck/branch/next?svg=true
1717
[masterBuildStatus]:https://ci.appveyor.com/api/projects/status/we3pdnkeebo4nlck/branch/master?svg=true
1818

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")
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")
2020

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

RetailCoder.VBE/App.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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/Common/ModuleExporter.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.IO;
1+
using System.IO;
32
using System.Reflection;
43
using Rubberduck.Parsing.VBA;
54
using Rubberduck.VBEditor.SafeComWrappers.Abstract;

RetailCoder.VBE/Extension.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using Extensibility;
2-
using Ninject;
3-
using Ninject.Extensions.Factory;
4-
using Rubberduck.Root;
52
using Rubberduck.UI;
63
using System;
74
using System.ComponentModel;
@@ -13,9 +10,10 @@
1310
using System.Runtime.InteropServices;
1411
using System.Windows.Forms;
1512
using System.Windows.Threading;
13+
using Castle.Windsor;
1614
using Microsoft.Vbe.Interop;
17-
using Ninject.Extensions.Interception;
1815
using NLog;
16+
using Rubberduck.Root;
1917
using Rubberduck.Settings;
2018
using Rubberduck.SettingsProvider;
2119
using Rubberduck.VBEditor.Events;
@@ -41,7 +39,9 @@ public class _Extension : IDTExtensibility2
4139
private bool _isInitialized;
4240
private bool _isBeginShutdownExecuted;
4341

44-
private IKernel _kernel;
42+
private GeneralSettings _initialSettings;
43+
44+
private IWindsorContainer _container;
4545
private App _app;
4646
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
4747

@@ -152,12 +152,12 @@ private void InitializeAddIn()
152152
};
153153
var configProvider = new GeneralConfigProvider(configLoader);
154154

155-
var settings = configProvider.Create();
156-
if (settings != null)
155+
_initialSettings = configProvider.Create();
156+
if (_initialSettings != null)
157157
{
158158
try
159159
{
160-
var cultureInfo = CultureInfo.GetCultureInfo(settings.Language.Code);
160+
var cultureInfo = CultureInfo.GetCultureInfo(_initialSettings.Language.Code);
161161
Dispatcher.CurrentDispatcher.Thread.CurrentUICulture = cultureInfo;
162162
}
163163
catch (CultureNotFoundException)
@@ -170,7 +170,7 @@ private void InitializeAddIn()
170170
}
171171

172172
Splash splash = null;
173-
if (settings.ShowSplash)
173+
if (_initialSettings.ShowSplash)
174174
{
175175
splash = new Splash
176176
{
@@ -210,10 +210,9 @@ private void Startup()
210210
currentDomain.UnhandledException += HandlAppDomainException;
211211
currentDomain.AssemblyResolve += LoadFromSameFolder;
212212

213-
_kernel = new StandardKernel(new NinjectSettings {LoadExtensions = true}, new FuncModule(), new DynamicProxyModule());
214-
_kernel.Load(new RubberduckModule(_ide, _addin));
215-
216-
_app = _kernel.Get<App>();
213+
_container = new WindsorContainer().Install(new RubberduckIoCInstaller(_ide, _addin, _initialSettings));
214+
215+
_app = _container.Resolve<App>();
217216
_app.Startup();
218217

219218
_isInitialized = true;
@@ -222,7 +221,9 @@ private void Startup()
222221
catch (Exception e)
223222
{
224223
_logger.Log(LogLevel.Fatal, e, "Startup sequence threw an unexpected exception.");
225-
//throw; // <<~ uncomment to crash the process
224+
#if DEBUG
225+
throw; // <<~ uncomment to crash the process
226+
#endif
226227
}
227228
}
228229

@@ -253,11 +254,11 @@ private void ShutdownAddIn()
253254
_app = null;
254255
}
255256

256-
if (_kernel != null)
257+
if (_container != null)
257258
{
258259
_logger.Log(LogLevel.Trace, "Disposing IoC container...");
259-
_kernel.Dispose();
260-
_kernel = null;
260+
_container.Dispose();
261+
_container = null;
261262
}
262263

263264
_isInitialized = false;

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public sealed class CodeExplorerViewModel : ViewModelBase, IDisposable
3535
private GeneralSettings _generalSettings;
3636
private WindowSettings _windowSettings;
3737

38+
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
39+
3840
public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState state, List<CommandBase> commands,
3941
IConfigProvider<GeneralSettings> generalSettingsProvider, IConfigProvider<WindowSettings> windowSettingsProvider)
4042
{
@@ -374,7 +376,7 @@ private void ParserState_ModuleStateChanged(object sender, Parsing.ParseProgress
374376
return;
375377
}
376378

377-
var components = e.Component.Collection;
379+
var components = e.Module.Component.Collection;
378380
var componentProject = components.Parent;
379381
{
380382
var projectNode = Projects.OfType<CodeExplorerProjectViewModel>()
@@ -385,7 +387,7 @@ private void ParserState_ModuleStateChanged(object sender, Parsing.ParseProgress
385387
return;
386388
}
387389

388-
SetErrorState(projectNode, e.Component);
390+
SetErrorState(projectNode, e.Module);
389391

390392
if (_errorStateSet) { return; }
391393

@@ -395,42 +397,49 @@ private void ParserState_ModuleStateChanged(object sender, Parsing.ParseProgress
395397

396398
UiDispatcher.Invoke(() =>
397399
{
398-
if (folderNode == null)
400+
try
399401
{
400-
folderNode = new CodeExplorerCustomFolderViewModel(projectNode, projectName, projectName);
401-
projectNode.AddChild(folderNode);
402+
if (folderNode == null)
403+
{
404+
folderNode = new CodeExplorerCustomFolderViewModel(projectNode, projectName, projectName);
405+
projectNode.AddChild(folderNode);
406+
}
407+
408+
var declaration = CreateDeclaration(e.Module);
409+
var newNode =
410+
new CodeExplorerComponentViewModel(folderNode, declaration, new List<Declaration>())
411+
{
412+
IsErrorState = true
413+
};
414+
415+
folderNode.AddChild(newNode);
416+
417+
// Force a refresh. OnPropertyChanged("Projects") didn't work.
418+
Projects = Projects;
402419
}
403-
404-
var declaration = CreateDeclaration(e.Component);
405-
var newNode = new CodeExplorerComponentViewModel(folderNode, declaration, new List<Declaration>())
420+
catch (Exception exception)
406421
{
407-
IsErrorState = true
408-
};
409-
410-
folderNode.AddChild(newNode);
411-
412-
// Force a refresh. OnPropertyChanged("Projects") didn't work.
413-
Projects = Projects;
422+
Logger.Error(exception, "Exception thrown trying to refresh the code explorer view on the UI thread.");
423+
}
414424
});
415425
}
416426
}
417427

418-
private Declaration CreateDeclaration(IVBComponent component)
428+
private Declaration CreateDeclaration(QualifiedModuleName module)
419429
{
420430
var projectDeclaration =
421-
_state.AllUserDeclarations.FirstOrDefault(item =>
422-
item.DeclarationType == DeclarationType.Project &&
423-
item.Project.VBComponents.Contains(component));
431+
_state.DeclarationFinder.UserDeclarations(DeclarationType.Project)
432+
.FirstOrDefault(item => item.Project.VBComponents.Contains(module.Component));
424433

425-
if (component.Type == ComponentType.StandardModule)
434+
if (module.ComponentType == ComponentType.StandardModule)
426435
{
427436
return new ProceduralModuleDeclaration(
428-
new QualifiedMemberName(new QualifiedModuleName(component), component.Name), projectDeclaration,
429-
component.Name, true, new List<IAnnotation>(), null);
437+
new QualifiedMemberName(module, module.ComponentName), projectDeclaration,
438+
module.ComponentName, true, new List<IAnnotation>(), null);
430439
}
431440

432-
return new ClassModuleDeclaration(new QualifiedMemberName(new QualifiedModuleName(component), component.Name),
433-
projectDeclaration, component.Name, true, new List<IAnnotation>(), null);
441+
return new ClassModuleDeclaration(new QualifiedMemberName(module, module.ComponentName),
442+
projectDeclaration, module.ComponentName, true, new List<IAnnotation>(), null);
434443
}
435444

436445
private void ReorderChildNodes(IEnumerable<CodeExplorerItemViewModel> nodes)
@@ -443,15 +452,15 @@ private void ReorderChildNodes(IEnumerable<CodeExplorerItemViewModel> nodes)
443452
}
444453

445454
private bool _errorStateSet;
446-
private void SetErrorState(CodeExplorerItemViewModel itemNode, IVBComponent component)
455+
private void SetErrorState(CodeExplorerItemViewModel itemNode, QualifiedModuleName module)
447456
{
448457
_errorStateSet = false;
449458

450459
foreach (var node in itemNode.Items)
451460
{
452461
if (node is CodeExplorerCustomFolderViewModel)
453462
{
454-
SetErrorState(node, component);
463+
SetErrorState(node, module);
455464
}
456465

457466
if (_errorStateSet)
@@ -460,7 +469,7 @@ private void SetErrorState(CodeExplorerItemViewModel itemNode, IVBComponent comp
460469
}
461470

462471
var componentNode = node as CodeExplorerComponentViewModel;
463-
if (componentNode?.GetSelectedDeclaration().QualifiedName.QualifiedModuleName.Component.Equals(component) == true)
472+
if (componentNode?.GetSelectedDeclaration().QualifiedName.QualifiedModuleName.Equals(module) == true)
464473
{
465474
componentNode.IsErrorState = true;
466475
_errorStateSet = true;

0 commit comments

Comments
 (0)