Skip to content

Commit 59edcb0

Browse files
committed
Add IMessageDispatcher interface
1 parent 3690435 commit 59edcb0

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/PowerShellEditorServices.Protocol/MessageProtocol/MessageDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol
1515
{
16-
public class MessageDispatcher : IMessageHandlers
16+
public class MessageDispatcher : IMessageHandlers, IMessageDispatcher
1717
{
1818
#region Fields
1919

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
//
5+
6+
using System.Threading.Tasks;
7+
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
8+
9+
namespace Microsoft.PowerShell.EditorServices.Protocol
10+
{
11+
public interface IMessageDispatcher
12+
{
13+
Task DispatchMessage(
14+
Message messageToDispatch,
15+
MessageWriter messageWriter);
16+
}
17+
}

src/PowerShellEditorServices/Session/EditorSession.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
using Microsoft.PowerShell.EditorServices.Console;
77
using Microsoft.PowerShell.EditorServices.Extensions;
8+
using Microsoft.PowerShell.EditorServices.Protocol;
9+
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
810
using Microsoft.PowerShell.EditorServices.Session;
911
using Microsoft.PowerShell.EditorServices.Templates;
1012
using Microsoft.PowerShell.EditorServices.Utility;
@@ -77,12 +79,14 @@ public class EditorSession
7779
/// </summary>
7880
public bool UsesConsoleHost { get; private set; }
7981

82+
public IMessageDispatcher MessageDispatcher { get; private set; }
83+
8084
#endregion
8185

8286
#region Constructors
8387

8488
/// <summary>
85-
///
89+
///
8690
/// </summary>
8791
/// <param name="logger">An ILogger implementation used for writing log messages.</param>
8892
public EditorSession(ILogger logger)
@@ -109,6 +113,8 @@ public void StartSession(
109113
this.ConsoleService = consoleService;
110114
this.UsesConsoleHost = this.ConsoleService.EnableConsoleRepl;
111115

116+
// Initialize all services
117+
this.MessageDispatcher = new MessageDispatcher(this.logger);
112118
this.LanguageService = new LanguageService(this.PowerShellContext, this.logger);
113119
this.ExtensionService = new ExtensionService(this.PowerShellContext);
114120
this.TemplateService = new TemplateService(this.PowerShellContext, this.logger);
@@ -137,6 +143,8 @@ public void StartDebugSession(
137143
this.PowerShellContext = powerShellContext;
138144
this.ConsoleService = consoleService;
139145

146+
// Initialize all services
147+
this.MessageDispatcher = new MessageDispatcher(this.logger);
140148
this.RemoteFileManager = new RemoteFileManager(this.PowerShellContext, editorOperations, logger);
141149
this.DebugService = new DebugService(this.PowerShellContext, this.RemoteFileManager, logger);
142150

0 commit comments

Comments
 (0)