Skip to content

Commit 9857a8e

Browse files
committed
Super merge from next.
2 parents 5f0fad9 + b69df78 commit 9857a8e

File tree

229 files changed

+60706
-30318
lines changed

Some content is hidden

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

229 files changed

+60706
-30318
lines changed

RetailCoder.VBE/App.cs

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ async void sink_ProjectRemoved(object sender, DispatcherEventArgs<VBProject> e)
9696

9797
async void sink_ProjectAdded(object sender, DispatcherEventArgs<VBProject> e)
9898
{
99+
if (!_parser.State.AllDeclarations.Any())
100+
{
101+
// forces menus to evaluate their CanExecute state:
102+
Parser_StateChanged(this, new ParserStateEventArgs(ParserState.Pending));
103+
_stateBar.SetStatusText();
104+
return;
105+
}
106+
99107
Debug.WriteLine(string.Format("Project '{0}' was added.", e.Item.Name));
100108
var connectionPointContainer = (IConnectionPointContainer)e.Item.VBComponents;
101109
var interfaceId = typeof(_dispVBComponentsEvents).GUID;
@@ -115,57 +123,95 @@ async void sink_ProjectAdded(object sender, DispatcherEventArgs<VBProject> e)
115123
connectionPoint.Advise(sink, out cookie);
116124

117125
_componentsEventsConnectionPoints.Add(e.Item.VBComponents, Tuple.Create(connectionPoint, cookie));
118-
_parser.State.OnParseRequested();
126+
_parser.State.OnParseRequested(sender);
119127
}
120128

121129
async void sink_ComponentSelected(object sender, DispatcherEventArgs<VBComponent> e)
122130
{
131+
if (!_parser.State.AllDeclarations.Any())
132+
{
133+
return;
134+
}
135+
123136
Debug.WriteLine(string.Format("Component '{0}' was selected.", e.Item.Name));
124137
// do something?
125138
}
126139

127140
async void sink_ComponentRenamed(object sender, DispatcherRenamedEventArgs<VBComponent> e)
128141
{
142+
if (!_parser.State.AllDeclarations.Any())
143+
{
144+
return;
145+
}
146+
129147
Debug.WriteLine(string.Format("Component '{0}' was renamed.", e.Item.Name));
130148

131-
_parser.State.ClearDeclarations(e.Item);
132-
_parser.State.OnParseRequested(e.Item);
149+
_parser.State.OnParseRequested(sender, e.Item);
133150
}
134151

135152
async void sink_ComponentRemoved(object sender, DispatcherEventArgs<VBComponent> e)
136153
{
154+
if (!_parser.State.AllDeclarations.Any())
155+
{
156+
return;
157+
}
158+
137159
Debug.WriteLine(string.Format("Component '{0}' was removed.", e.Item.Name));
138160
_parser.State.ClearDeclarations(e.Item);
139161
}
140162

141163
async void sink_ComponentReloaded(object sender, DispatcherEventArgs<VBComponent> e)
142164
{
165+
if (!_parser.State.AllDeclarations.Any())
166+
{
167+
return;
168+
}
169+
143170
Debug.WriteLine(string.Format("Component '{0}' was reloaded.", e.Item.Name));
144-
_parser.State.ClearDeclarations(e.Item);
145-
_parser.State.OnParseRequested(e.Item);
171+
_parser.State.OnParseRequested(sender, e.Item);
146172
}
147173

148174
async void sink_ComponentAdded(object sender, DispatcherEventArgs<VBComponent> e)
149175
{
176+
if (!_parser.State.AllDeclarations.Any())
177+
{
178+
return;
179+
}
180+
150181
Debug.WriteLine(string.Format("Component '{0}' was added.", e.Item.Name));
151-
_parser.State.OnParseRequested(e.Item);
182+
_parser.State.OnParseRequested(sender, e.Item);
152183
}
153184

154185
async void sink_ComponentActivated(object sender, DispatcherEventArgs<VBComponent> e)
155186
{
187+
if (!_parser.State.AllDeclarations.Any())
188+
{
189+
return;
190+
}
191+
156192
Debug.WriteLine(string.Format("Component '{0}' was activated.", e.Item.Name));
157193
// do something?
158194
}
159195

160196
async void sink_ProjectRenamed(object sender, DispatcherRenamedEventArgs<VBProject> e)
161197
{
198+
if (!_parser.State.AllDeclarations.Any())
199+
{
200+
return;
201+
}
202+
162203
Debug.WriteLine(string.Format("Project '{0}' was renamed.", e.Item.Name));
163204
_parser.State.ClearDeclarations(e.Item);
164-
_parser.State.OnParseRequested();
205+
_parser.State.OnParseRequested(sender);
165206
}
166207

167208
async void sink_ProjectActivated(object sender, DispatcherEventArgs<VBProject> e)
168209
{
210+
if (!_parser.State.AllDeclarations.Any())
211+
{
212+
return;
213+
}
214+
169215
Debug.WriteLine(string.Format("Project '{0}' was activated.", e.Item.Name));
170216
// do something?
171217
}
@@ -244,11 +290,12 @@ private async void hooks_MessageReceived(object sender, HookEventArgs e)
244290

245291
private void _stateBar_Refresh(object sender, EventArgs e)
246292
{
247-
_parser.State.OnParseRequested();
293+
_parser.State.OnParseRequested(sender);
248294
}
249295

250-
private void Parser_StateChanged(object sender, ParserStateEventArgs e)
296+
private void Parser_StateChanged(object sender, EventArgs e)
251297
{
298+
Debug.WriteLine("App handles StateChanged ({0}), evaluating menu states...", _parser.State.Status);
252299
_appMenus.EvaluateCanExecute(_parser.State);
253300
}
254301

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using Microsoft.Vbe.Interop;
9+
using Rubberduck.VBEditor.Extensions;
10+
using Rubberduck.Parsing.VBA;
11+
12+
namespace Rubberduck.Common
13+
{
14+
public class ModuleExporter : IModuleExporter
15+
{
16+
public string ExportPath
17+
{
18+
get
19+
{
20+
var assemblyLocation = Assembly.GetAssembly(typeof(App)).Location;
21+
return Path.GetDirectoryName(assemblyLocation);
22+
}
23+
}
24+
25+
public string Export(VBComponent component)
26+
{
27+
return component.ExportAsSourceFile(ExportPath);
28+
}
29+
}
30+
}

RetailCoder.VBE/Inspections/InspectionsUI.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/Inspections/InspectionsUI.de.Designer.cs

Whitespace-only changes.

0 commit comments

Comments
 (0)