4 interfaces inheriting from IMethodHandler
Microsoft.CodeAnalysis.LanguageServer.Protocol (4)
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\INotificationHandler.cs (2)
17internal interface INotificationHandler<TRequestContext> : IMethodHandler 27internal interface INotificationHandler<TRequest, TRequestContext> : IMethodHandler
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\IRequestHandler.cs (2)
13internal interface IRequestHandler<TRequest, TResponse, TRequestContext> : IMethodHandler 25internal interface IRequestHandler<TResponse, TRequestContext> : IMethodHandler
92 references to IMethodHandler
Microsoft.CodeAnalysis.EditorFeatures (1)
ExternalAccess\VSTypeScript\Api\AbstractVSTypeScriptRequestHandler.cs (1)
20bool IMethodHandler.MutatesSolutionState => MutatesSolutionState;
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (2)
AbstractRazorRequestHandler.cs (1)
14bool IMethodHandler.MutatesSolutionState => MutatesSolutionState;
Cohost\AbstractRazorRequestHandler.cs (1)
14bool 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)
22public override Task<RequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<RequestContext> queueItem, IMethodHandler methodHandler, TRequestParam requestParam, CancellationToken cancellationToken) 68throw 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)
169public ImmutableArray<(IMethodHandler? Instance, TypeRef HandlerTypeRef, ImmutableArray<MethodHandlerDetails> HandlerDetails)> GetMethodHandlers() 171using var _ = ArrayBuilder<(IMethodHandler?, TypeRef, ImmutableArray<MethodHandlerDetails>)>.GetInstance(out var builder); 174foreach (var handler in GetBaseServices<IMethodHandler>())
RoslynLanguageServer.cs (2)
91AddService<IMethodHandler>(new InitializeHandler()); 92AddService<IMethodHandler>(new InitializedHandler());
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\AbstractHandlerProvider.cs (2)
23/// Gets the <see cref="IMethodHandler"/>s for a particular request. 34public 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> 36public abstract Task<TRequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<TRequestContext> queueItem, IMethodHandler methodHandler, TRequestParam requestParam, CancellationToken cancellationToken);
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\HandlerProvider.cs (12)
21private FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>>? _requestHandlers; 23public IMethodHandler GetMethodHandler(string method, TypeRef? requestTypeRef, TypeRef? responseTypeRef) 26public override IMethodHandler GetMethodHandler(string method, TypeRef? requestTypeRef, TypeRef? responseTypeRef, string language) 45private FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>> GetRequestHandlers() 48private static FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>> CreateMethodToHandlerMap(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver) 50var builder = new Dictionary<RequestHandlerMetadata, Lazy<IMethodHandler>>(); 76var handlers = lspServices.GetRequiredServices<IMethodHandler>(); 78foreach (var handler in handlers) 98static Lazy<IMethodHandler> GetLazyHandlerFromInstance(IMethodHandler instance) 103static Lazy<IMethodHandler> GetLazyHandlerFromTypeRef(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver, TypeRef handlerTypeRef) 115return (IMethodHandler)lspService;
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\IMethodHandlerProvider.cs (2)
14/// to provide faster access to <see cref="IMethodHandler"/>s. 18ImmutableArray<(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> 28Task 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)"/> 38Task<(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> 94throw new InvalidOperationException($"Provided handler type {handlerType.FullName} does not implement {nameof(IMethodHandler)}");
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\QueueItem.cs (3)
86public async Task<(TRequestContext, TRequest)?> CreateRequestContextAsync<TRequest>(IMethodHandler handler, RequestHandlerMetadata requestHandlerMetadata, AbstractLanguageServer<TRequestContext> languageServer, CancellationToken cancellationToken) 161public async Task StartRequestAsync<TRequest, TResponse>(TRequest request, TRequestContext? context, IMethodHandler handler, string language, CancellationToken cancellationToken) 217throw new NotImplementedException($"Unrecognized {nameof(IMethodHandler)} implementation {handler.GetType()}.");
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\RequestExecutionQueue.cs (9)
76private readonly FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata Metadata, IMethodHandler Handler, MethodInfo MethodInfo)>>> _handlerInfoMap; 94private static FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>> BuildHandlerMap(AbstractHandlerProvider handlerProvider, AbstractTypeRefResolver typeRefResolver) 96var genericMethodMap = new Dictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>>(); 103var languages = new Dictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>(); 116var 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)"/> 309IMethodHandler handler, 331IMethodHandler handler, 413private (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)
19public override Task<ExampleRequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<ExampleRequestContext> queueItem, IMethodHandler methodHandler, TRequestParam requestParam, CancellationToken cancellationToken)
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (29)
HandlerProviderTests.cs (10)
19var methodHandler = handlerProvider.GetMethodHandler(TestMethodHandler.Name, TestMethodHandler.RequestType, TestMethodHandler.ResponseType, LanguageServerConstants.DefaultLanguageName); 28var methodHandler = handlerProvider.GetMethodHandler(TestParameterlessMethodHandler.Name, requestTypeRef: null, TestParameterlessMethodHandler.ResponseTypeRef, LanguageServerConstants.DefaultLanguageName); 37var methodHandler = handlerProvider.GetMethodHandler(TestNotificationHandler.Name, TestNotificationHandler.RequestTypeRef, responseTypeRef: null, LanguageServerConstants.DefaultLanguageName); 46var methodHandler = handlerProvider.GetMethodHandler(TestParameterlessNotificationHandler.Name, requestTypeRef: null, responseTypeRef: null, LanguageServerConstants.DefaultLanguageName); 88var defaultMethodHandler = handlerProvider.GetMethodHandler(TestDefaultLanguageHandler.Name, TestDefaultLanguageHandler.RequestType, TestDefaultLanguageHandler.ResponseType, LanguageServerConstants.DefaultLanguageName); 91var 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)
13private readonly IEnumerable<(RequestHandlerMetadata metadata, IMethodHandler provider)> _providers; 15public TestHandlerProvider(IEnumerable<(RequestHandlerMetadata metadata, IMethodHandler provider)> providers) 18public override IMethodHandler GetMethodHandler(string method, TypeRef? requestType, TypeRef? responseType, string language)
Mocks\TestLspServices.cs (3)
50public 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)
19public static readonly IMethodHandler Instance = new TestMethodHandler(); 34public static readonly IMethodHandler Instance = new TestParameterlessMethodHandler(); 49public static readonly IMethodHandler Instance = new TestNotificationHandler(); 63public static readonly IMethodHandler Instance = new TestParameterlessNotificationHandler(); 86public static readonly IMethodHandler Instance = new MutatingHandler(); 106public static readonly IMethodHandler Instance = new CompletingHandler(); 128public static readonly IMethodHandler Instance = new CancellingHandler(); 147public static readonly IMethodHandler Instance = new ThrowingHandler(); 162public static readonly IMethodHandler Instance = new TestDefaultLanguageHandler(); 178public static readonly IMethodHandler Instance = new TestXamlLanguageHandler();
Mocks\TestRequestContext.cs (1)
16public override Task<TestRequestContext> CreateRequestContextAsync<TRequestParam>(IQueueItem<TestRequestContext> queueItem, IMethodHandler methodHandler, TRequestParam requestParam, CancellationToken cancellationToken)
RequestExecutionQueueTests.cs (1)
33params (RequestHandlerMetadata metadata, IMethodHandler handler)[] handlers)
TestExampleLanguageServer.cs (1)
120serviceCollection.AddSingleton<IMethodHandler, ExtraDidOpenHandler>();