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 HandlerTypeDescriptorProvider( new[] { typeof(HandlerTypeDescriptorProvider).Assembly, typeof(DebugAdapterRpcOptionsBase <>).Assembly, typeof(DebugAdapterClient).Assembly, typeof(DebugAdapterServer).Assembly, typeof(DapReceiver).Assembly, typeof(DebugAdapterProtocolTestBase).Assembly } ); foreach (var type in typeof(CompletionsArguments).Assembly.ExportedTypes .Where(z => z.IsInterface && typeof(IJsonRpcHandler).IsAssignableFrom(z))) { if (type.IsGenericTypeDefinition && !MethodAttribute.AllFrom(type).Any()) { continue; } if (type == typeof(IProgressStartHandler) || type == typeof(IProgressUpdateHandler) || type == typeof(IProgressEndHandler)) { continue; } var descriptor = handlerTypeDescriptorProvider.GetHandlerTypeDescriptor(type) !; Add( descriptor, GetOnMethodName(descriptor), GetSendMethodName(descriptor), GetExtensionClass(descriptor), GetExtensionClassName(descriptor).Substring(GetExtensionClassName(descriptor).LastIndexOf('.') + 1) ); } }
public TypeHandlerData() { var handlerTypeDescriptorProvider = new HandlerTypeDescriptorProvider( new[] { typeof(HandlerTypeDescriptorProvider).Assembly, typeof(DebugAdapterRpcOptionsBase <>).Assembly, typeof(DebugAdapterClient).Assembly, typeof(DebugAdapterServer).Assembly, typeof(DapReceiver).Assembly, typeof(DebugAdapterProtocolTestBase).Assembly } ); foreach (var type in typeof(CompletionsArguments).Assembly.ExportedTypes.Where( z => z.IsInterface && typeof(IJsonRpcHandler).IsAssignableFrom(z) )) { if (type.IsGenericTypeDefinition && !MethodAttribute.AllFrom(type).Any()) { continue; } if (type == typeof(IProgressStartHandler) || type == typeof(IProgressUpdateHandler) || type == typeof(IProgressEndHandler)) { 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) ); } }
public HandlersShouldAbstractClassData() { foreach (var type in typeof(IDataBreakpointInfoHandler).Assembly.ExportedTypes .Where(z => z.IsInterface && typeof(IJsonRpcHandler).IsAssignableFrom(z))) { if (type.IsGenericTypeDefinition && !MethodAttribute.AllFrom(type).Any()) { continue; } Add(type); } }
public HandlersShouldHaveMethodAttributeData() { 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; } Add(type); } }
public TypeHandlerData() { foreach (var type in typeof(CompletionsArguments).Assembly.ExportedTypes.Where( z => z.IsInterface && typeof(IJsonRpcHandler).IsAssignableFrom(z) )) { if (type.IsGenericTypeDefinition && !MethodAttribute.AllFrom(type).Any()) { continue; } if (type == typeof(IProgressStartHandler) || type == typeof(IProgressUpdateHandler) || type == typeof(IProgressEndHandler)) { continue; } Add(HandlerTypeDescriptorHelper.GetHandlerTypeDescriptor(type)); } }
public TypeHandlerExtensionData() { foreach (var type in typeof(CompletionsArguments).Assembly.ExportedTypes .Where(z => z.IsInterface && typeof(IJsonRpcHandler).IsAssignableFrom(z))) { if (type.IsGenericTypeDefinition && !MethodAttribute.AllFrom(type).Any()) { continue; } if (type == typeof(IProgressStartHandler) || type == typeof(IProgressUpdateHandler) || type == typeof(IProgressEndHandler)) { continue; } var descriptor = HandlerTypeDescriptorHelper.GetHandlerTypeDescriptor(type); Add( descriptor, GetOnMethodName(descriptor), GetSendMethodName(descriptor), GetExtensionClass(descriptor), GetExtensionClassName(descriptor).Substring(GetExtensionClassName(descriptor).LastIndexOf('.') + 1) ); } }
public void HandlersShouldHaveMethodAttribute(Type type) { MethodAttribute.AllFrom(type).Any(z => z.Direction != Direction.Unspecified).Should() .Be(true, $"{type.Name} is missing a method attribute or the direction is not specified"); }