Skip to content

Commit 058ef42

Browse files
authored
Merge pull request #2370 from retailcoder/next
some more fixes
2 parents 2373066 + f3364e9 commit 058ef42

21 files changed

+126
-70
lines changed

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ public override void Load()
133133
.WhenInjectedInto<ToDoExplorerCommand>()
134134
.InSingletonScope();
135135

136+
BindDockableToolwindows();
136137
BindCommandsToCodeExplorer();
137138
ConfigureRubberduckMenu();
138139
ConfigureCodePaneContextMenu();
@@ -143,6 +144,15 @@ public override void Load()
143144
BindWindowsHooks();
144145
}
145146

147+
private void BindDockableToolwindows()
148+
{
149+
Kernel.Bind(t => t.FromThisAssembly()
150+
.SelectAllClasses()
151+
.InheritedFrom<IDockableUserControl>()
152+
.BindToSelf()
153+
.Configure(binding => binding.InSingletonScope()));
154+
}
155+
146156
private void BindWindowsHooks()
147157
{
148158
Rebind<IAttachable>().To<TimerHook>()

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,6 @@
896896
<Compile Include="UI\Splash.Designer.cs">
897897
<DependentUpon>Splash.cs</DependentUpon>
898898
</Compile>
899-
<Compile Include="UI\ToDoItems\IToDoExplorerWindow.cs" />
900899
<Compile Include="Settings\IConfigurationService.cs" />
901900
<Compile Include="Settings\ConfigurationLoader.cs" />
902901
<Compile Include="Settings\UserSettings.cs" />

RetailCoder.VBE/UI/ToDoItems/IToDoExplorerWindow.cs

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

Rubberduck.Parsing/Preprocessing/VBAPrecompilationParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public VBAConditionalCompilationParser.CompilationUnitContext Parse(string modul
1717
var lexer = new VBALexer(stream);
1818
var tokens = new CommonTokenStream(lexer);
1919
var parser = new VBAConditionalCompilationParser(tokens);
20-
parser.AddErrorListener(new ExceptionErrorListener());
21-
VBAConditionalCompilationParser.CompilationUnitContext tree = null;
20+
parser.AddErrorListener(new ExceptionErrorListener()); // notify?
21+
VBAConditionalCompilationParser.CompilationUnitContext tree;
2222
try
2323
{
2424
parser.Interpreter.PredictionMode = PredictionMode.Sll;

Rubberduck.Parsing/Rubberduck.Parsing.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@
244244
<Compile Include="Symbols\FunctionDeclaration.cs" />
245245
<Compile Include="Symbols\SubroutineDeclaration.cs" />
246246
<Compile Include="Symbols\ProjectReferencePass.cs" />
247+
<Compile Include="Symbols\SyntaxErrorInfo.cs" />
248+
<Compile Include="Symbols\SyntaxErrorNotificationListener.cs" />
247249
<Compile Include="Symbols\TypeHierarchyPass.cs" />
248250
<Compile Include="Symbols\TypeAnnotationPass.cs" />
249251
<Compile Include="Symbols\IdentifierReferenceResolver.cs" />
@@ -284,7 +286,6 @@
284286
<Compile Include="VBA\VBADateLiteralParser.cs" />
285287
<Compile Include="VBA\VBAExpressionParser.cs" />
286288
<Compile Include="VBA\VBAModuleParser.cs" />
287-
<Compile Include="VBA\WalkerCancelledException.cs" />
288289
</ItemGroup>
289290
<ItemGroup>
290291
<None Include="Grammar\VBAParser.g4">

Rubberduck.Parsing/Symbols/DeclarationFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public IEnumerable<Declaration> MatchName(string name)
103103
{
104104
return result;
105105
}
106-
return new List<Declaration>();
106+
return Enumerable.Empty<Declaration>();
107107
}
108108

109109
public Declaration FindProject(string name, Declaration currentScope = null)

Rubberduck.Parsing/Symbols/ExceptionErrorListener.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Antlr4.Runtime;
1+
using System;
2+
using Antlr4.Runtime;
23

34
namespace Rubberduck.Parsing.Symbols
45
{

Rubberduck.Parsing/Symbols/SyntaxErrorException.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public class SyntaxErrorException : Exception
1313
{
1414
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
1515

16+
public SyntaxErrorException(SyntaxErrorInfo info)
17+
: this(info.Message, info.Exception, info.OffendingSymbol, info.LineNumber, info.Position) { }
18+
1619
public SyntaxErrorException(string message, RecognitionException innerException, IToken offendingSymbol, int line, int position)
1720
: base(message, innerException)
1821
{
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Antlr4.Runtime;
2+
3+
namespace Rubberduck.Parsing.Symbols
4+
{
5+
public class SyntaxErrorInfo
6+
{
7+
public SyntaxErrorInfo(string message, RecognitionException innerException, IToken offendingSymbol, int line, int position)
8+
{
9+
_message = message;
10+
_innerException = innerException;
11+
_token = offendingSymbol;
12+
_line = line;
13+
_position = position;
14+
}
15+
16+
private readonly string _message;
17+
public string Message { get { return _message; } }
18+
19+
private readonly RecognitionException _innerException;
20+
public RecognitionException Exception { get { return _innerException; } }
21+
22+
private readonly IToken _token;
23+
public IToken OffendingSymbol { get { return _token; } }
24+
25+
private readonly int _line;
26+
public int LineNumber { get { return _line; } }
27+
28+
private readonly int _position;
29+
public int Position { get { return _position; } }
30+
}
31+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System;
2+
using Antlr4.Runtime;
3+
4+
namespace Rubberduck.Parsing.Symbols
5+
{
6+
public class SyntaxErrorNotificationListener : BaseErrorListener
7+
{
8+
public event EventHandler<SyntaxErrorEventArgs> OnSyntaxError;
9+
public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
10+
{
11+
var info = new SyntaxErrorInfo(msg, e, offendingSymbol, line, charPositionInLine);
12+
NotifySyntaxError(info);
13+
}
14+
15+
private void NotifySyntaxError(SyntaxErrorInfo info)
16+
{
17+
var handler = OnSyntaxError;
18+
if (handler != null)
19+
{
20+
handler.Invoke(this, new SyntaxErrorEventArgs(info));
21+
}
22+
}
23+
}
24+
25+
public class SyntaxErrorEventArgs : EventArgs
26+
{
27+
private readonly SyntaxErrorInfo _info;
28+
29+
public SyntaxErrorEventArgs(SyntaxErrorInfo info)
30+
{
31+
_info = info;
32+
}
33+
34+
public SyntaxErrorInfo Info { get { return _info; } }
35+
}
36+
}

0 commit comments

Comments
 (0)