Skip to content

Commit 8fc93ec

Browse files
authored
Merge pull request #1994 from Hosch250/parserUpdates
Get rid of single-component parse. Fix bug in cache. Fix bug in New…
2 parents 1a0ddf4 + 26cbb1a commit 8fc93ec

File tree

13 files changed

+44
-155
lines changed

13 files changed

+44
-155
lines changed

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
3232

3333
_refreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param => _state.OnParseRequested(this),
3434
param => !IsBusy && _state.IsDirty());
35-
36-
_refreshComponentCommand = commands.OfType<CodeExplorer_RefreshComponentCommand>().FirstOrDefault();
35+
3736
_navigateCommand = commands.OfType<CodeExplorer_NavigateCommand>().FirstOrDefault();
3837

3938
_addTestModuleCommand = commands.OfType<CodeExplorer_AddTestModuleCommand>().FirstOrDefault();
@@ -413,9 +412,6 @@ private void SetErrorState(CodeExplorerItemViewModel itemNode, VBComponent compo
413412
private readonly CommandBase _refreshCommand;
414413
public CommandBase RefreshCommand { get { return _refreshCommand; } }
415414

416-
private readonly CommandBase _refreshComponentCommand;
417-
public CommandBase RefreshComponentCommand { get { return _refreshComponentCommand; } }
418-
419415
private readonly CommandBase _navigateCommand;
420416
public CommandBase NavigateCommand { get { return _navigateCommand; } }
421417

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@
418418
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_AddUserFormCommand.cs" />
419419
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_CopyResultsCommand.cs" />
420420
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_OpenProjectPropertiesCommand.cs" />
421-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_RefreshComponentCommand.cs" />
422421
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_RenameCommand.cs" />
423422
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_FindAllReferencesCommand.cs" />
424423
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_FindAllImplementationsCommand.cs" />
@@ -952,7 +951,7 @@
952951
<Compile Include="UnitTesting\AssertClass.cs" />
953952
<Compile Include="UnitTesting\AssertCompletedEventArgs.cs" />
954953
<Compile Include="UnitTesting\AssertHandler.cs" />
955-
<Compile Include="UnitTesting\UnitTestHelpers.cs" />
954+
<Compile Include="UnitTesting\UnitTestUtils.cs" />
956955
<Compile Include="UnitTesting\IAssert.cs" />
957956
<Compile Include="UnitTesting\ITestEngine.cs" />
958957
<Compile Include="UnitTesting\ITestRunner.cs" />

RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,8 @@
357357
<Setter Property="ContextMenu">
358358
<Setter.Value>
359359
<ContextMenu DataContext="{Binding DataContext, Source={x:Reference CodeExplorer}}">
360-
<MenuItem Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=CodeExplorer_RefreshComponent}"
361-
Command="{Binding RefreshComponentCommand}"
362-
CommandParameter="{Binding SelectedItem}">
360+
<MenuItem Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Refresh}"
361+
Command="{Binding RefreshCommand}">
363362
<MenuItem.Icon>
364363
<Image Source="{StaticResource RefreshImage}" />
365364
</MenuItem.Icon>

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_RefreshComponentCommand.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

RetailCoder.VBE/UI/RubberduckUI.Designer.cs

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/RubberduckUI.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,9 +1565,6 @@ All our stargazers, likers &amp; followers, for the warm fuzzies
15651565
<data name="SortStyle_ByCodeOrder" xml:space="preserve">
15661566
<value>By code order</value>
15671567
</data>
1568-
<data name="CodeExplorer_RefreshComponent" xml:space="preserve">
1569-
<value>Refresh component</value>
1570-
</data>
15711568
<data name="TestOutcome_Ignored" xml:space="preserve">
15721569
<value>Ignored</value>
15731570
</data>

RetailCoder.VBE/UI/UnitTesting/TestExplorerModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private void State_StateChanged(object sender, ParserStateEventArgs e)
3131

3232
_dispatcher.Invoke(() =>
3333
{
34-
var tests = UnitTestHelpers.GetAllTests(_vbe, _state).ToList();
34+
var tests = UnitTestUtils.GetAllTests(_vbe, _state).ToList();
3535

3636
var removedTests = Tests.Where(test =>
3737
!tests.Any(t =>

RetailCoder.VBE/UnitTesting/NewTestMethodCommand.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System.Linq;
22
using System.Runtime.InteropServices;
33
using Microsoft.Vbe.Interop;
4-
using Rubberduck.Parsing.Annotations;
5-
using Rubberduck.Parsing.Symbols;
64
using Rubberduck.Parsing.VBA;
75
using Rubberduck.UI;
86

@@ -68,12 +66,10 @@ public void NewTestMethod()
6866

6967
try
7068
{
71-
var declaration = _state.AllUserDeclarations.FirstOrDefault(f =>
69+
var declaration = _state.GetTestModules().FirstOrDefault(f =>
7270
f.QualifiedName.QualifiedModuleName.Component.CodeModule == _vbe.ActiveCodePane.CodeModule);
7371

74-
if (declaration != null &&
75-
declaration.DeclarationType == DeclarationType.ProceduralModule &&
76-
declaration.Annotations.Any(a => a.AnnotationType == AnnotationType.TestModule))
72+
if (declaration != null)
7773
{
7874
var module = _vbe.ActiveCodePane.CodeModule;
7975
var name = GetNextTestMethodName(module.Parent);
@@ -97,12 +93,10 @@ public void NewExpectedErrorTestMethod()
9793

9894
try
9995
{
100-
var declaration = _state.AllUserDeclarations.FirstOrDefault(f =>
96+
var declaration = _state.GetTestModules().FirstOrDefault(f =>
10197
f.QualifiedName.QualifiedModuleName.Component.CodeModule == _vbe.ActiveCodePane.CodeModule);
10298

103-
if (declaration != null &&
104-
declaration.DeclarationType == DeclarationType.ProceduralModule &&
105-
declaration.Annotations.Any(a => a.AnnotationType == AnnotationType.TestModule))
99+
if (declaration != null)
106100
{
107101
var module = _vbe.ActiveCodePane.CodeModule;
108102
var name = GetNextTestMethodName(module.Parent);

RetailCoder.VBE/UnitTesting/UnitTestHelpers.cs renamed to RetailCoder.VBE/UnitTesting/UnitTestUtils.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Rubberduck.UnitTesting
1010
{
11-
public static class UnitTestHelpers
11+
public static class UnitTestUtils
1212
{
1313
public static IEnumerable<TestMethod> GetAllTests(VBE vbe, RubberduckParserState state)
1414
{
@@ -77,5 +77,12 @@ private static IEnumerable<Declaration> GetTestModuleProcedures(RubberduckParser
7777
item.ParentDeclaration.DeclarationType == DeclarationType.ProceduralModule &&
7878
item.ParentDeclaration.Annotations.Any(a => a.AnnotationType == AnnotationType.TestModule));
7979
}
80+
81+
public static IEnumerable<Declaration> GetTestModules(this RubberduckParserState state)
82+
{
83+
return state.AllUserDeclarations.Where(item =>
84+
item.DeclarationType == DeclarationType.ProceduralModule &&
85+
item.Annotations.Any(a => a.AnnotationType == AnnotationType.TestModule));
86+
}
8087
}
8188
}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
using System;
2-
using Microsoft.Vbe.Interop;
32
using Rubberduck.Parsing.VBA;
43

54
namespace Rubberduck.Parsing
65
{
76
public interface IRubberduckParser : IDisposable
87
{
98
RubberduckParserState State { get; }
10-
void Cancel(VBComponent component = null);
119
}
1210
}

0 commit comments

Comments
 (0)