Skip to content

Commit 8a6754a

Browse files
authored
Merge branch 'next' into resolverPerformance
2 parents 93234c3 + a01fae0 commit 8a6754a

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerMemberViewModel.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Text;
45
using System.Windows.Media.Imaging;
56
using Rubberduck.Parsing.Grammar;
67
using Rubberduck.Parsing.Symbols;
@@ -80,6 +81,25 @@ public CodeExplorerMemberViewModel(CodeExplorerItemViewModel parent, Declaration
8081
_icon = Mappings[key];
8182
}
8283

84+
private string RemoveExtraWhiteSpace(string value)
85+
{
86+
var newStr = new StringBuilder();
87+
var trimmedJoinedString = value.Replace(" _\r\n", " ").Trim();
88+
89+
for (var i = 0; i < trimmedJoinedString.Length; i++)
90+
{
91+
// this will not throw because `Trim` ensures the first character is not whitespace
92+
if (char.IsWhiteSpace(trimmedJoinedString[i]) && char.IsWhiteSpace(trimmedJoinedString[i - 1]))
93+
{
94+
continue;
95+
}
96+
97+
newStr.Append(trimmedJoinedString[i]);
98+
}
99+
100+
return newStr.ToString();
101+
}
102+
83103
private readonly string _name;
84104
public override string Name { get { return _name; } }
85105

@@ -108,11 +128,11 @@ public override string NameWithSignature
108128
|| _declaration.DeclarationType == DeclarationType.PropertySet)
109129
{
110130
// 6 being the three-letter "get/let/set" + parens + space
111-
_signature = Name.Insert(Name.Length - 6, context.GetText());
131+
_signature = Name.Insert(Name.Length - 6, RemoveExtraWhiteSpace(context.GetText()));
112132
}
113133
else
114134
{
115-
_signature = Name + context.GetText();
135+
_signature = Name + RemoveExtraWhiteSpace(context.GetText());
116136
}
117137
return _signature;
118138
}

Rubberduck.Parsing/VBA/RubberduckParser.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,12 @@ public void Dispose()
667667

668668
if (_cancellationTokens[0] != null)
669669
{
670-
_cancellationTokens[0].Cancel();
671-
_cancellationTokens[0].Dispose();
670+
try
671+
{
672+
_cancellationTokens[0].Cancel();
673+
_cancellationTokens[0].Dispose();
674+
}
675+
catch (ObjectDisposedException) { /* todo: avoid this being thrown in the first place */ }
672676
}
673677
}
674678
}

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private void Sinks_ProjectRenamed(object sender, IProjectRenamedEventArgs e)
119119
return;
120120
}
121121

122-
Logger.Debug("Project {1} renamed.", e.ProjectId);
122+
Logger.Debug("Project {0} was renamed.", e.ProjectId);
123123

124124
RemoveProject(e.ProjectId);
125125
AddProject(e.ProjectId);

0 commit comments

Comments
 (0)