Per editor Connect support v0.1

- Basic plumbing to support connections for a URI rather than global connections. Typical use case is editor requests to connect, but this isn't the only possible use
- Tests pass but need updating to cover new functionality, and re-enable AutoCompleteService test once there is a ServiceDiscovery component that registers and returns services. This is necessary as .Instance won't allow for dependency injection and proper testing.
This commit is contained in:
Kevin Cunnane
2016-08-02 18:55:25 -07:00
committed by Mitchell Sternke
parent d191b0483c
commit 402e25f77d
13 changed files with 645 additions and 244 deletions

View File

@@ -8,7 +8,7 @@ using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.Hosting.Protocol
{
internal interface IMessageSender
public interface IMessageSender
{
Task SendEvent<TParams>(
EventType<TParams> eventType,

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.Hosting.Protocol
{
/// <summary>
/// A ProtocolEndpoint is used for inter-process communication. Services can register to
/// respond to requests and events, send their own requests, and listen for notifications
/// sent by the other side of the endpoint
/// </summary>
public interface IProtocolEndpoint : IMessageSender
{
void SetRequestHandler<TParams, TResult>(
RequestType<TParams, TResult> requestType,
Func<TParams, RequestContext<TResult>, Task> requestHandler);
void SetEventHandler<TParams>(
EventType<TParams> eventType,
Func<TParams, EventContext, Task> eventHandler);
void SetEventHandler<TParams>(
EventType<TParams> eventType,
Func<TParams, EventContext, Task> eventHandler,
bool overrideExisting);
}
}

View File

@@ -16,7 +16,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Hosting.Protocol
/// Provides behavior for a client or server endpoint that
/// communicates using the specified protocol.
/// </summary>
public class ProtocolEndpoint : IMessageSender
public class ProtocolEndpoint : IMessageSender, IProtocolEndpoint
{
private bool isStarted;
private int currentMessageId;