public TypeHandlerData() { var handlerTypeDescriptorProvider = new LspHandlerTypeDescriptorProvider( new[] { typeof(AssemblyScanningHandlerTypeDescriptorProvider).Assembly, typeof(LspHandlerTypeDescriptorProvider).Assembly, typeof(LanguageServer).Assembly, typeof(LanguageClient).Assembly, typeof(ISupports).Assembly, typeof(HandlerResolverTests).Assembly } ); foreach (var type in typeof(CompletionParams).Assembly.ExportedTypes.Where(z => z.IsInterface && typeof(IJsonRpcHandler).IsAssignableFrom(z)) .Where(z => !z.Name.EndsWith("Manager")) .Except(new[] { typeof(ITextDocumentSyncHandler), typeof(IExecuteCommandHandler <>) }) ) { if (type.IsGenericTypeDefinition && !MethodAttribute.AllFrom(type).Any()) { continue; } Add(handlerTypeDescriptorProvider.GetHandlerTypeDescriptor(type) !); } }
public TypeHandlerExtensionData() { var handlerTypeDescriptorProvider = new LspHandlerTypeDescriptorProvider( new[] { typeof(AssemblyScanningHandlerTypeDescriptorProvider).Assembly, typeof(LspHandlerTypeDescriptorProvider).Assembly, typeof(LanguageServer).Assembly, typeof(LanguageClient).Assembly, typeof(ISupports).Assembly, typeof(HandlerResolverTests).Assembly } ); foreach (var type in typeof(CompletionParams).Assembly.ExportedTypes .Where(z => z.IsInterface && typeof(IJsonRpcHandler).IsAssignableFrom(z)) .Where(z => !z.Name.EndsWith("Manager")) .Except(new[] { typeof(ITextDocumentSyncHandler) }) ) { if (type.IsGenericTypeDefinition && !MethodAttribute.AllFrom(type).Any()) { continue; } if (type.Name.EndsWith("Manager")) { continue; } if (type == typeof(IExecuteCommandHandler <>)) { continue; } if (type == typeof(ICompletionResolveHandler) || type == typeof(ICodeLensResolveHandler) || type == typeof(IDocumentLinkResolveHandler) || type == typeof(ICodeActionResolveHandler)) { continue; } if (type == typeof(ISemanticTokensFullHandler) || type == typeof(ISemanticTokensDeltaHandler) || type == typeof(ISemanticTokensRangeHandler)) { continue; } var descriptor = handlerTypeDescriptorProvider.GetHandlerTypeDescriptor(type); if (descriptor == null) { throw new Exception(""); } Add( descriptor, GetOnMethodName(descriptor), GetSendMethodName(descriptor), GetExtensionClass(descriptor), GetExtensionClassName(descriptor).Substring(GetExtensionClassName(descriptor).LastIndexOf('.') + 1) ); } }