Add support to generate code for interface without a namespace (#46)

This commit is contained in:
Stef Heyenrath
2022-12-13 18:51:06 +01:00
committed by GitHub
parent 3eb9d8ce5f
commit 72a40e6f6a
13 changed files with 163 additions and 14 deletions
@@ -59,6 +59,7 @@ internal class PartialInterfacesGenerator : BaseGenerator, IFilesGenerator
{
var extendsProxyClasses = GetExtendsProxyData(proxyData, classSymbol);
var @new = extendsProxyClasses.Any() ? "new " : string.Empty;
var (namespaceStart, namespaceEnd) = NamespaceBuilder.Build(ns);
return $@"//----------------------------------------------------------------------------------------
// <auto-generated>
@@ -72,8 +73,7 @@ internal class PartialInterfacesGenerator : BaseGenerator, IFilesGenerator
{(SupportsNullable ? "#nullable enable" : string.Empty)}
using System;
namespace {ns}
{{
{namespaceStart}
public partial interface {interfaceName}
{{
{@new}{classSymbol.Symbol} _Instance {{ get; }}
@@ -84,7 +84,7 @@ namespace {ns}
{GenerateEvents(classSymbol, proxyData.ProxyBaseClasses)}
}}
}}
{namespaceEnd}
{(SupportsNullable ? "#nullable disable" : string.Empty)}";
}