Skip to content

Commit 3c28b61

Browse files
committed
added ParseRequestEventArgs and component parameter to OnParseRequested, to support requesting a reparse of a specific module.
1 parent 85ef392 commit 3c28b61

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void ApplyAbstractFactoryConvention(IEnumerable<Assembly> assemblies)
132132
.Configure(binding => binding.InSingletonScope()));
133133
}
134134

135-
// note: IInspection implementations are discovered in the Rubberduck assembly via reflection.
135+
// note: InspectionBase implementations are discovered in the Rubberduck assembly via reflection.
136136
private void BindCodeInspectionTypes()
137137
{
138138
var inspections = Assembly.GetExecutingAssembly()

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,22 @@ public ParserStateEventArgs(ParserState state)
2828
public ParserState State { get {return _state; } }
2929
}
3030

31+
public class ParseRequestEventArgs : EventArgs
32+
{
33+
private readonly VBComponent _component;
34+
35+
public ParseRequestEventArgs(VBComponent component)
36+
{
37+
_component = component;
38+
}
39+
40+
public VBComponent Component { get { return _component; } }
41+
public bool IsFullReparseRequest { get { return _component == null; } }
42+
}
43+
3144
public sealed class RubberduckParserState
3245
{
33-
public event EventHandler ParseRequest;
46+
public event EventHandler<ParseRequestEventArgs> ParseRequest;
3447

3548
// keys are the declarations; values indicate whether a declaration is resolved.
3649
private readonly ConcurrentDictionary<Declaration, ResolutionState> _declarations =
@@ -291,12 +304,18 @@ public void AddBuiltInDeclarations(IHostApplication hostApplication)
291304
}
292305
}
293306

294-
public void OnParseRequested()
307+
/// <summary>
308+
/// Requests reparse for specified component.
309+
/// Omit parameter to request a full reparse.
310+
/// </summary>
311+
/// <param name="component">The component to reparse.</param>
312+
public void OnParseRequested(VBComponent component = null)
295313
{
296314
var handler = ParseRequest;
297315
if (handler != null)
298316
{
299-
handler.Invoke(this, EventArgs.Empty);
317+
var args = new ParseRequestEventArgs(component);
318+
handler.Invoke(this, args);
300319
}
301320
}
302321
}

0 commit comments

Comments
 (0)