Skip to content

Commit b54cbb2

Browse files
authored
Merge pull request #2000 from rubberduck-vba/next
Release 2.0.5
2 parents 31651f2 + c2d73c5 commit b54cbb2

File tree

515 files changed

+3274
-2403
lines changed

Some content is hidden

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

515 files changed

+3274
-2403
lines changed

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ This beautiful suite of professional-grade icons packs over 3,570 icons (16x16).
105105
These icons are licensed under a [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/).
106106
If you can't or don't want to provide attribution, please [purchase a royalty-free license](http://p.yusukekamiyamane.com/).
107107

108-
###[Microsoft Visual Studio Image Library](http://www.microsoft.com/en-ca/download/details.aspx?id=35825)
108+
###[SharpDevelop](https://github.com/icsharpcode/SharpDevelop.git)
109109

110-
Icons in the `./Resources/Microsoft/` directory are licensed under Microsoft's Software License Terms, must be used accordingly with their meaning / file name.
111-
112-
> You have a right to Use and Distribute these files. This means that you are free to copy and use these images in documents and projects that you create, but you may not modify them in anyway.
113-
114-
For more information, please see the EULAs in the [./Resources/Microsoft/ directory](https://github.com/retailcoder/Rubberduck/tree/master/RetailCoder.VBE/Resources/Microsoft).
115-
116-
* [Visual Studio 2013 Image Library EULA](https://github.com/retailcoder/Rubberduck/blob/master/RetailCoder.VBE/Resources/Microsoft/Visual%20Studio%202013%20Image%20Library%20EULA.rtf)
117-
* [Visual Studio 2012 Image Library EULA](https://github.com/retailcoder/Rubberduck/blob/master/RetailCoder.VBE/Resources/Microsoft/Visual%20Studio%202012%20Image%20Library%20EULA.rtf)
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).

RetailCoder.VBE/API/ParserState.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public void Initialize(VBE vbe)
6868

6969
Func<IVBAPreprocessor> preprocessorFactory = () => new VBAPreprocessor(double.Parse(vbe.Version, CultureInfo.InvariantCulture));
7070
_attributeParser = new AttributeParser(new ModuleExporter(), preprocessorFactory);
71-
_parser = new RubberduckParser(vbe, _state, _attributeParser, preprocessorFactory,
72-
new List<ICustomDeclarationLoader> { new DebugDeclarations(_state), new FormEventDeclarations(_state) });
71+
_parser = new RubberduckParser(_state, _attributeParser, preprocessorFactory,
72+
new List<ICustomDeclarationLoader> { new DebugDeclarations(_state), new FormEventDeclarations(_state), new AliasDeclarations(_state) });
7373
}
7474

7575
/// <summary>
@@ -78,7 +78,7 @@ public void Initialize(VBE vbe)
7878
public void Parse()
7979
{
8080
// blocking call
81-
_parser.Parse();
81+
_parser.Parse(new System.Threading.CancellationTokenSource());
8282
}
8383

8484
/// <summary>

RetailCoder.VBE/App.cs

Lines changed: 5 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using Rubberduck.UI.Command.MenuItems;
1212
using System;
1313
using System.Globalization;
14-
using System.Threading.Tasks;
1514
using System.Windows.Forms;
1615

1716
namespace Rubberduck
@@ -141,8 +140,12 @@ public void Startup()
141140
_appMenus.Initialize();
142141
_hooks.HookHotkeys(); // need to hook hotkeys before we localize menus, to correctly display ShortcutTexts
143142
_appMenus.Localize();
144-
Task.Delay(1000).ContinueWith(t => UiDispatcher.Invoke(() => _parser.State.OnParseRequested(this)));
145143
UpdateLoggingLevel();
144+
145+
if (_vbe.VBProjects.Count != 0)
146+
{
147+
_parser.State.OnParseRequested(this);
148+
}
146149
}
147150

148151
public void Shutdown()
@@ -157,168 +160,6 @@ public void Shutdown()
157160
}
158161
}
159162

160-
/*#region sink handlers.
161-
async void sink_ProjectRemoved(object sender, DispatcherEventArgs<VBProject> e)
162-
{
163-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
164-
165-
if (e.Item.Protection == vbext_ProjectProtection.vbext_pp_locked)
166-
{
167-
Logger.Debug("Locked project '{0}' was removed.", e.Item.Name);
168-
return;
169-
}
170-
171-
_parser.Cancel();
172-
173-
var projectId = e.Item.HelpFile;
174-
Debug.Assert(projectId != null);
175-
176-
_parser.State.RemoveProject(e.Item);
177-
_parser.State.OnParseRequested(this);
178-
}
179-
180-
async void sink_ProjectAdded(object sender, DispatcherEventArgs<VBProject> e)
181-
{
182-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
183-
184-
Logger.Debug("Project '{0}' was added.", e.Item.Name);
185-
if (e.Item.Protection == vbext_ProjectProtection.vbext_pp_locked)
186-
{
187-
Logger.Debug("Project is protected and will not be added to parser state.");
188-
return;
189-
}
190-
191-
_parser.State.AddProject(e.Item); // note side-effect: assigns ProjectId/HelpFile
192-
var projectId = e.Item.HelpFile;
193-
RegisterComponentsEventSink(e.Item.VBComponents, projectId);
194-
195-
if (!_parser.State.AllDeclarations.Any())
196-
{
197-
// forces menus to evaluate their CanExecute state:
198-
Parser_StateChanged(this, new ParserStateEventArgs(ParserState.Pending));
199-
_stateBar.SetStatusText();
200-
return;
201-
}
202-
203-
_parser.State.OnParseRequested(sender);
204-
}
205-
206-
async void sink_ComponentSelected(object sender, DispatcherEventArgs<VBComponent> e)
207-
{
208-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
209-
210-
if (!_parser.State.AllDeclarations.Any())
211-
{
212-
return;
213-
}
214-
}
215-
216-
async void sink_ComponentRenamed(object sender, DispatcherRenamedEventArgs<VBComponent> e)
217-
{
218-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
219-
220-
if (!_parser.State.AllDeclarations.Any())
221-
{
222-
return;
223-
}
224-
225-
_parser.Cancel();
226-
227-
_sourceControlPanelVM.HandleRenamedComponent(e.Item, e.OldName);
228-
229-
Logger.Debug("Component '{0}' was renamed to '{1}'.", e.OldName, e.Item.Name);
230-
231-
var projectId = e.Item.Collection.Parent.HelpFile;
232-
var componentDeclaration = _parser.State.AllDeclarations.FirstOrDefault(f =>
233-
f.ProjectId == projectId &&
234-
f.DeclarationType == DeclarationType.ClassModule &&
235-
f.IdentifierName == e.OldName);
236-
237-
if (e.Item.Type == vbext_ComponentType.vbext_ct_Document &&
238-
componentDeclaration != null &&
239-
240-
// according to ThunderFrame, Excel is the only one we explicitly support
241-
// with two Document-component types just skip the Worksheet component
242-
((ClassModuleDeclaration) componentDeclaration).Supertypes.All(a => a.IdentifierName != "Worksheet"))
243-
{
244-
_parser.State.RemoveProject(projectId);
245-
246-
_parser.State.AddProject(e.Item.Collection.Parent);
247-
}
248-
else
249-
{
250-
_parser.State.RemoveRenamedComponent(e.Item, e.OldName);
251-
}
252-
253-
_parser.State.OnParseRequested(this);
254-
}
255-
256-
async void sink_ComponentRemoved(object sender, DispatcherEventArgs<VBComponent> e)
257-
{
258-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
259-
260-
if (!_parser.State.AllDeclarations.Any())
261-
{
262-
return;
263-
}
264-
265-
_parser.Cancel(e.Item);
266-
267-
_sourceControlPanelVM.HandleRemovedComponent(e.Item);
268-
269-
Logger.Debug("Component '{0}' was removed.", e.Item.Name);
270-
_parser.State.ClearStateCache(e.Item, true);
271-
}
272-
273-
async void sink_ComponentReloaded(object sender, DispatcherEventArgs<VBComponent> e)
274-
{
275-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
276-
277-
if (!_parser.State.AllDeclarations.Any())
278-
{
279-
return;
280-
}
281-
282-
_parser.Cancel(e.Item);
283-
284-
_parser.State.OnParseRequested(sender, e.Item);
285-
}
286-
287-
async void sink_ComponentAdded(object sender, DispatcherEventArgs<VBComponent> e)
288-
{
289-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
290-
291-
if (!_parser.State.AllDeclarations.Any())
292-
{
293-
return;
294-
}
295-
296-
_sourceControlPanelVM.HandleAddedComponent(e.Item);
297-
298-
Logger.Debug("Component '{0}' was added.", e.Item.Name);
299-
_parser.State.OnParseRequested(sender, e.Item);
300-
}
301-
302-
async void sink_ProjectRenamed(object sender, DispatcherRenamedEventArgs<VBProject> e)
303-
{
304-
if (!_handleSinkEvents || !_vbe.IsInDesignMode()) { return; }
305-
306-
if (!_parser.State.AllDeclarations.Any())
307-
{
308-
return;
309-
}
310-
311-
_parser.Cancel();
312-
313-
Logger.Debug("Project '{0}' (ID {1}) was renamed to '{2}'.", e.OldName, e.Item.HelpFile, e.Item.Name);
314-
315-
_parser.State.RemoveProject(e.Item.HelpFile);
316-
_parser.State.AddProject(e.Item);
317-
318-
_parser.State.OnParseRequested(sender);
319-
}
320-
#endregion*/
321-
322163
private void _stateBar_Refresh(object sender, EventArgs e)
323164
{
324165
// handles "refresh" button click on "Rubberduck" command bar

RetailCoder.VBE/Common/DeclarationExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,9 @@ public static Declaration FindInterfaceMember(this IEnumerable<Declaration> decl
456456
var members = FindInterfaceMembers(declarations);
457457
var matches = members.Where(m => !m.IsBuiltIn && implementation.IdentifierName == m.ComponentName + '_' + m.IdentifierName).ToList();
458458

459-
return matches.Count > 1
460-
? matches.SingleOrDefault(m => m.ProjectId == implementation.ProjectId)
461-
: matches.First();
459+
return matches.Count > 1
460+
? matches.SingleOrDefault(m => m.ProjectId == implementation.ProjectId)
461+
: matches.FirstOrDefault();
462462
}
463463

464464
public static Declaration FindTarget(this IEnumerable<Declaration> declarations, QualifiedSelection selection)

0 commit comments

Comments
 (0)