4 interfaces inheriting from IMethodHandler
Microsoft.CodeAnalysis.LanguageServer.Protocol (4)
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\INotificationHandler.cs (2)
17
internal interface INotificationHandler<TRequestContext> :
IMethodHandler
27
internal interface INotificationHandler<TRequest, TRequestContext> :
IMethodHandler
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\IRequestHandler.cs (2)
13
internal interface IRequestHandler<TRequest, TResponse, TRequestContext> :
IMethodHandler
25
internal interface IRequestHandler<TResponse, TRequestContext> :
IMethodHandler
92 references to IMethodHandler
Microsoft.CodeAnalysis.EditorFeatures (1)
ExternalAccess\VSTypeScript\Api\AbstractVSTypeScriptRequestHandler.cs (1)
20
bool
IMethodHandler
.MutatesSolutionState => MutatesSolutionState;
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (2)
AbstractRazorRequestHandler.cs (1)
14
bool
IMethodHandler
.MutatesSolutionState => MutatesSolutionState;
Cohost\AbstractRazorRequestHandler.cs (1)
14
bool
IMethodHandler
.MutatesSolutionState => MutatesSolutionState;
Microsoft.CodeAnalysis.LanguageServer.Protocol (56)
Handler\RequestContext.cs (1)
20
/// Context for requests handled by <see cref="
IMethodHandler
"/>
Handler\RequestContextFactory.cs (2)
22
public override Task<RequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<RequestContext> queueItem,
IMethodHandler
methodHandler, TRequestParam requestParam, CancellationToken cancellationToken)
68
throw new InvalidOperationException($"{nameof(
IMethodHandler
)} implementation {methodHandler.GetType()} does not implement {nameof(ISolutionRequiredHandler)}");
LspServices\AbstractExportLspServiceAttribute.cs (2)
51
/// If this this service implements <see cref="
IMethodHandler
"/>, returns a blob of binary data
77
_lazyMethodHandlerData = typeof(
IMethodHandler
).IsAssignableFrom(serviceType)
LspServices\LspServiceMetadataView.cs (1)
23
/// Returns an array of request handler method details if this services is an <see cref="
IMethodHandler
"/>.
LspServices\LspServices.cs (4)
169
public ImmutableArray<(
IMethodHandler
? Instance, TypeRef HandlerTypeRef, ImmutableArray<MethodHandlerDetails> HandlerDetails)> GetMethodHandlers()
171
using var _ = ArrayBuilder<(
IMethodHandler
?, TypeRef, ImmutableArray<MethodHandlerDetails>)>.GetInstance(out var builder);
174
foreach (
var
handler in GetBaseServices<
IMethodHandler
>())
RoslynLanguageServer.cs (2)
91
AddService<
IMethodHandler
>(new InitializeHandler());
92
AddService<
IMethodHandler
>(new InitializedHandler());
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\AbstractHandlerProvider.cs (2)
23
/// Gets the <see cref="
IMethodHandler
"/>s for a particular request.
34
public abstract
IMethodHandler
GetMethodHandler(string method, TypeRef? requestTypeRef, TypeRef? responseTypeRef, string language);
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\AbstractRequestContextFactory.cs (3)
18
/// RequestContext's are useful for passing document context, since by default <see cref="CreateRequestContextAsync{TRequestParam}(IQueueItem{TRequestContext},
IMethodHandler
, TRequestParam, CancellationToken)"/>
31
/// <param name="methodHandler">The <see cref="
IMethodHandler
"/> for which to create the request context</param>
36
public abstract Task<TRequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<TRequestContext> queueItem,
IMethodHandler
methodHandler, TRequestParam requestParam, CancellationToken cancellationToken);
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\HandlerProvider.cs (12)
21
private FrozenDictionary<RequestHandlerMetadata, Lazy<
IMethodHandler
>>? _requestHandlers;
23
public
IMethodHandler
GetMethodHandler(string method, TypeRef? requestTypeRef, TypeRef? responseTypeRef)
26
public override
IMethodHandler
GetMethodHandler(string method, TypeRef? requestTypeRef, TypeRef? responseTypeRef, string language)
45
private FrozenDictionary<RequestHandlerMetadata, Lazy<
IMethodHandler
>> GetRequestHandlers()
48
private static FrozenDictionary<RequestHandlerMetadata, Lazy<
IMethodHandler
>> CreateMethodToHandlerMap(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver)
50
var builder = new Dictionary<RequestHandlerMetadata, Lazy<
IMethodHandler
>>();
76
var handlers = lspServices.GetRequiredServices<
IMethodHandler
>();
78
foreach (
var
handler in handlers)
98
static Lazy<
IMethodHandler
> GetLazyHandlerFromInstance(
IMethodHandler
instance)
103
static Lazy<
IMethodHandler
> GetLazyHandlerFromTypeRef(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver, TypeRef handlerTypeRef)
115
return (
IMethodHandler
)lspService;
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\IMethodHandlerProvider.cs (2)
14
/// to provide faster access to <see cref="
IMethodHandler
"/>s.
18
ImmutableArray<(
IMethodHandler
? Instance, TypeRef HandlerTypeRef, ImmutableArray<MethodHandlerDetails> HandlerDetails)> GetMethodHandlers();
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\IQueueItem.cs (4)
23
/// <param name="context">The context created by <see cref="CreateRequestContextAsync{TRequest}(
IMethodHandler
, RequestHandlerMetadata, AbstractLanguageServer{TRequestContext}, CancellationToken)"/>.</param>
28
Task StartRequestAsync<TRequest, TResponse>(TRequest request, TRequestContext? context,
IMethodHandler
handler, string language, CancellationToken cancellationToken);
33
/// running the actual request in <see cref="StartRequestAsync{TRequest, TResponse}(TRequest, TRequestContext?,
IMethodHandler
, string, CancellationToken)"/>
38
Task<(TRequestContext, TRequest)?> CreateRequestContextAsync<TRequest>(
IMethodHandler
handler, RequestHandlerMetadata requestHandlerMetadata, AbstractLanguageServer<TRequestContext> languageServer, CancellationToken cancellationToken);
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\LanguageServerEndpointAttribute.cs (6)
13
/// An attribute which identifies the method which an <see cref="
IMethodHandler
"/> implements.
19
/// Contains the method that this <see cref="
IMethodHandler
"/> implements.
24
/// Contains the language name(s) supported by this <see cref="
IMethodHandler
"/>.
35
/// Specifies the method that this <see cref="
IMethodHandler
"/> implements and the language(s) supported by it.
38
/// <param name="language">The language name supported by this <see cref="
IMethodHandler
"/>. For example, <see cref="LanguageServerConstants.DefaultLanguageName"/>, 'C#', etc.</param>
39
/// <param name="additionalLanguages">Additional language names supported by this <see cref="
IMethodHandler
"/>.</param>
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\MethodHandlerDetails.cs (3)
17
/// Provides information about an <see cref="
IMethodHandler
"/>.
20
/// <param name="Language">The language this <see cref="
IMethodHandler
"/> targets.</param>
94
throw new InvalidOperationException($"Provided handler type {handlerType.FullName} does not implement {nameof(
IMethodHandler
)}");
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\QueueItem.cs (3)
86
public async Task<(TRequestContext, TRequest)?> CreateRequestContextAsync<TRequest>(
IMethodHandler
handler, RequestHandlerMetadata requestHandlerMetadata, AbstractLanguageServer<TRequestContext> languageServer, CancellationToken cancellationToken)
161
public async Task StartRequestAsync<TRequest, TResponse>(TRequest request, TRequestContext? context,
IMethodHandler
handler, string language, CancellationToken cancellationToken)
217
throw new NotImplementedException($"Unrecognized {nameof(
IMethodHandler
)} implementation {handler.GetType()}.");
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\RequestExecutionQueue.cs (9)
76
private readonly FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata Metadata,
IMethodHandler
Handler, MethodInfo MethodInfo)>>> _handlerInfoMap;
94
private static FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata,
IMethodHandler
, MethodInfo)>>> BuildHandlerMap(AbstractHandlerProvider handlerProvider, AbstractTypeRefResolver typeRefResolver)
96
var genericMethodMap = new Dictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata,
IMethodHandler
, MethodInfo)>>>();
103
var languages = new Dictionary<string, Lazy<(RequestHandlerMetadata,
IMethodHandler
, MethodInfo)>>();
116
var
handler = handlerProvider.GetMethodHandler(metadata.MethodName, metadata.RequestTypeRef, metadata.ResponseTypeRef, metadata.Language);
303
/// Reflection invokes <see cref="ProcessQueueCoreAsync{TRequest, TResponse}(IQueueItem{TRequestContext},
IMethodHandler
, RequestHandlerMetadata, ConcurrentDictionary{Task, CancellationTokenSource}, CancellationTokenSource?, CancellationToken)"/>
309
IMethodHandler
handler,
331
IMethodHandler
handler,
413
private (RequestHandlerMetadata Metadata,
IMethodHandler
Handler, MethodInfo MethodInfo) GetHandlerForRequest(IQueueItem<TRequestContext> work, string language)
Microsoft.CommonLanguageServerProtocol.Framework.Example (4)
ExampleLanguageServer.cs (3)
55
.AddSingleton<
IMethodHandler
, MultiRegisteringHandler>()
56
.AddSingleton<
IMethodHandler
, InitializeHandler<InitializeParams, InitializeResult, ExampleRequestContext>>()
57
.AddSingleton<
IMethodHandler
, InitializedHandler<InitializedParams, ExampleRequestContext>>();
ExampleRequestContextFactory.cs (1)
19
public override Task<ExampleRequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<ExampleRequestContext> queueItem,
IMethodHandler
methodHandler, TRequestParam requestParam, CancellationToken cancellationToken)
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (29)
HandlerProviderTests.cs (10)
19
var
methodHandler = handlerProvider.GetMethodHandler(TestMethodHandler.Name, TestMethodHandler.RequestType, TestMethodHandler.ResponseType, LanguageServerConstants.DefaultLanguageName);
28
var
methodHandler = handlerProvider.GetMethodHandler(TestParameterlessMethodHandler.Name, requestTypeRef: null, TestParameterlessMethodHandler.ResponseTypeRef, LanguageServerConstants.DefaultLanguageName);
37
var
methodHandler = handlerProvider.GetMethodHandler(TestNotificationHandler.Name, TestNotificationHandler.RequestTypeRef, responseTypeRef: null, LanguageServerConstants.DefaultLanguageName);
46
var
methodHandler = handlerProvider.GetMethodHandler(TestParameterlessNotificationHandler.Name, requestTypeRef: null, responseTypeRef: null, LanguageServerConstants.DefaultLanguageName);
88
var
defaultMethodHandler = handlerProvider.GetMethodHandler(TestDefaultLanguageHandler.Name, TestDefaultLanguageHandler.RequestType, TestDefaultLanguageHandler.ResponseType, LanguageServerConstants.DefaultLanguageName);
91
var
xamlMethodHandler = handlerProvider.GetMethodHandler(TestDefaultLanguageHandler.Name, TestDefaultLanguageHandler.RequestType, TestDefaultLanguageHandler.ResponseType, TestXamlLanguageHandler.Language);
102
(typeof(
IMethodHandler
), TestMethodHandler.Instance),
103
(typeof(
IMethodHandler
), TestNotificationHandler.Instance),
104
(typeof(
IMethodHandler
), TestParameterlessMethodHandler.Instance),
105
(typeof(
IMethodHandler
), TestParameterlessNotificationHandler.Instance),
Mocks\TestHandlerProvider.cs (3)
13
private readonly IEnumerable<(RequestHandlerMetadata metadata,
IMethodHandler
provider)> _providers;
15
public TestHandlerProvider(IEnumerable<(RequestHandlerMetadata metadata,
IMethodHandler
provider)> providers)
18
public override
IMethodHandler
GetMethodHandler(string method, TypeRef? requestType, TypeRef? responseType, string language)
Mocks\TestLspServices.cs (3)
50
public ImmutableArray<(
IMethodHandler
? Instance, TypeRef HandlerTypeRef, ImmutableArray<MethodHandlerDetails> HandlerDetails)> GetMethodHandlers()
51
=> [.. Services.Where(s => s.instance is
IMethodHandler
).Select(s => ((
IMethodHandler
?)s.instance, TypeRef.From(s.instance.GetType()), MethodHandlerDetails.From(s.instance.GetType())))];
Mocks\TestMethodHandlers.cs (10)
19
public static readonly
IMethodHandler
Instance = new TestMethodHandler();
34
public static readonly
IMethodHandler
Instance = new TestParameterlessMethodHandler();
49
public static readonly
IMethodHandler
Instance = new TestNotificationHandler();
63
public static readonly
IMethodHandler
Instance = new TestParameterlessNotificationHandler();
86
public static readonly
IMethodHandler
Instance = new MutatingHandler();
106
public static readonly
IMethodHandler
Instance = new CompletingHandler();
128
public static readonly
IMethodHandler
Instance = new CancellingHandler();
147
public static readonly
IMethodHandler
Instance = new ThrowingHandler();
162
public static readonly
IMethodHandler
Instance = new TestDefaultLanguageHandler();
178
public static readonly
IMethodHandler
Instance = new TestXamlLanguageHandler();
Mocks\TestRequestContext.cs (1)
16
public override Task<TestRequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<TestRequestContext> queueItem,
IMethodHandler
methodHandler, TRequestParam requestParam, CancellationToken cancellationToken)
RequestExecutionQueueTests.cs (1)
33
params (RequestHandlerMetadata metadata,
IMethodHandler
handler)[] handlers)
TestExampleLanguageServer.cs (1)
120
serviceCollection.AddSingleton<
IMethodHandler
, ExtraDidOpenHandler>();