Skip to content

Commit 7b158ad

Browse files
committed
.editor config + fix line endings
1 parent 8eb0733 commit 7b158ad

21 files changed

+528
-523
lines changed

.editorconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[*]
2+
indent_style = space
3+
indent_size = 4
4+
end_of_line = crlf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
+56-55
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,56 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.31515.178
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED3DA9DD-1E07-444B-A2D7-2DBA280F96D4}"
7-
EndProject
8-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2CE637DC-E8F5-4603-8B57-E51A32F631F1}"
9-
ProjectSection(SolutionItems) = preProject
10-
GitHubReleaseNotes.txt = GitHubReleaseNotes.txt
11-
README.md = README.md
12-
ReleaseNotes.md = ReleaseNotes.md
13-
EndProjectSection
14-
EndProject
15-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{19009F5B-3267-45E2-A8B6-89F2AB47D72C}"
16-
EndProject
17-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src-examples", "src-examples", "{38BA087F-EDA1-4F8A-A140-85B84791B815}"
18-
EndProject
19-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceSourceGenerator", "src\ProxyInterfaceSourceGenerator\ProxyInterfaceSourceGenerator.csproj", "{12344228-91F4-4502-9595-39584E5ABB34}"
20-
EndProject
21-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceConsumer", "src-examples\ProxyInterfaceConsumer\ProxyInterfaceConsumer.csproj", "{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}"
22-
EndProject
23-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxyInterfaceConsumerViaNuGet", "src-examples\ProxyInterfaceConsumerViaNuGet\ProxyInterfaceConsumerViaNuGet.csproj", "{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}"
24-
EndProject
25-
Global
26-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
27-
Debug|Any CPU = Debug|Any CPU
28-
Release|Any CPU = Release|Any CPU
29-
EndGlobalSection
30-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
31-
{12344228-91F4-4502-9595-39584E5ABB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32-
{12344228-91F4-4502-9595-39584E5ABB34}.Debug|Any CPU.Build.0 = Debug|Any CPU
33-
{12344228-91F4-4502-9595-39584E5ABB34}.Release|Any CPU.ActiveCfg = Release|Any CPU
34-
{12344228-91F4-4502-9595-39584E5ABB34}.Release|Any CPU.Build.0 = Release|Any CPU
35-
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36-
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
37-
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
38-
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Release|Any CPU.Build.0 = Release|Any CPU
39-
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40-
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Debug|Any CPU.Build.0 = Debug|Any CPU
41-
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Release|Any CPU.ActiveCfg = Release|Any CPU
42-
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Release|Any CPU.Build.0 = Release|Any CPU
43-
EndGlobalSection
44-
GlobalSection(SolutionProperties) = preSolution
45-
HideSolutionNode = FALSE
46-
EndGlobalSection
47-
GlobalSection(NestedProjects) = preSolution
48-
{12344228-91F4-4502-9595-39584E5ABB34} = {ED3DA9DD-1E07-444B-A2D7-2DBA280F96D4}
49-
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9} = {38BA087F-EDA1-4F8A-A140-85B84791B815}
50-
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740} = {38BA087F-EDA1-4F8A-A140-85B84791B815}
51-
EndGlobalSection
52-
GlobalSection(ExtensibilityGlobals) = postSolution
53-
SolutionGuid = {585F071D-051D-441C-9C6B-226D9E15A1F5}
54-
EndGlobalSection
55-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31521.260
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED3DA9DD-1E07-444B-A2D7-2DBA280F96D4}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2CE637DC-E8F5-4603-8B57-E51A32F631F1}"
9+
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
11+
GitHubReleaseNotes.txt = GitHubReleaseNotes.txt
12+
README.md = README.md
13+
ReleaseNotes.md = ReleaseNotes.md
14+
EndProjectSection
15+
EndProject
16+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{19009F5B-3267-45E2-A8B6-89F2AB47D72C}"
17+
EndProject
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src-examples", "src-examples", "{38BA087F-EDA1-4F8A-A140-85B84791B815}"
19+
EndProject
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceSourceGenerator", "src\ProxyInterfaceSourceGenerator\ProxyInterfaceSourceGenerator.csproj", "{12344228-91F4-4502-9595-39584E5ABB34}"
21+
EndProject
22+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceConsumer", "src-examples\ProxyInterfaceConsumer\ProxyInterfaceConsumer.csproj", "{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}"
23+
EndProject
24+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceConsumerViaNuGet", "src-examples\ProxyInterfaceConsumerViaNuGet\ProxyInterfaceConsumerViaNuGet.csproj", "{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}"
25+
EndProject
26+
Global
27+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
28+
Debug|Any CPU = Debug|Any CPU
29+
Release|Any CPU = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
32+
{12344228-91F4-4502-9595-39584E5ABB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{12344228-91F4-4502-9595-39584E5ABB34}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{12344228-91F4-4502-9595-39584E5ABB34}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{12344228-91F4-4502-9595-39584E5ABB34}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740}.Release|Any CPU.Build.0 = Release|Any CPU
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
GlobalSection(NestedProjects) = preSolution
49+
{12344228-91F4-4502-9595-39584E5ABB34} = {ED3DA9DD-1E07-444B-A2D7-2DBA280F96D4}
50+
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9} = {38BA087F-EDA1-4F8A-A140-85B84791B815}
51+
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740} = {38BA087F-EDA1-4F8A-A140-85B84791B815}
52+
EndGlobalSection
53+
GlobalSection(ExtensibilityGlobals) = postSolution
54+
SolutionGuid = {585F071D-051D-441C-9C6B-226D9E15A1F5}
55+
EndGlobalSection
56+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// https://bartwullems.blogspot.com/2021/01/c-9use-record-types-in-net-standard-20.html
2-
#if NETSTANDARD2_0
3-
namespace System.Runtime.CompilerServices
4-
{
5-
public class IsExternalInit { }
6-
}
1+
// https://bartwullems.blogspot.com/2021/01/c-9use-record-types-in-net-standard-20.html
2+
#if NETSTANDARD2_0
3+
namespace System.Runtime.CompilerServices
4+
{
5+
public class IsExternalInit { }
6+
}
77
#endif
+17-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
using System.Collections.Generic;
2-
using Microsoft.CodeAnalysis;
3-
using Microsoft.CodeAnalysis.CSharp.Syntax;
4-
using ProxyInterfaceSourceGenerator.SyntaxReceiver;
5-
6-
namespace ProxyInterfaceSourceGenerator
7-
{
8-
internal record Context
9-
{
10-
public GeneratorExecutionContext GeneratorExecutionContext { get; init; }
11-
12-
// public List<ContextData> GeneratedData { get; } = new List<ContextData>();
13-
14-
public IDictionary<InterfaceDeclarationSyntax, ProxyData> CandidateInterfaces { get; init; }
15-
16-
public Dictionary<string, string> ReplacedTypes { get; } = new Dictionary<string, string>();
17-
}
1+
using System.Collections.Generic;
2+
using Microsoft.CodeAnalysis;
3+
using Microsoft.CodeAnalysis.CSharp.Syntax;
4+
using ProxyInterfaceSourceGenerator.SyntaxReceiver;
5+
6+
namespace ProxyInterfaceSourceGenerator
7+
{
8+
internal record Context
9+
{
10+
public GeneratorExecutionContext GeneratorExecutionContext { get; init; }
11+
12+
// public List<ContextData> GeneratedData { get; } = new List<ContextData>();
13+
14+
public IDictionary<InterfaceDeclarationSyntax, ProxyData> CandidateInterfaces { get; init; }
15+
16+
public Dictionary<string, string> ReplacedTypes { get; } = new Dictionary<string, string>();
17+
}
1818
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
using ProxyInterfaceSourceGenerator.FileGenerators;
2-
3-
namespace ProxyInterfaceSourceGenerator
4-
{
5-
internal record ContextData
6-
{
7-
public string? InterfaceName { get; init; }
8-
9-
public string? ClassName { get; init; }
10-
11-
public FileData FileData { get; init; }
12-
}
1+
using ProxyInterfaceSourceGenerator.FileGenerators;
2+
3+
namespace ProxyInterfaceSourceGenerator
4+
{
5+
internal record ContextData
6+
{
7+
public string? InterfaceName { get; init; }
8+
9+
public string? ClassName { get; init; }
10+
11+
public FileData FileData { get; init; }
12+
}
1313
}
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
using System.Linq;
2-
using Microsoft.CodeAnalysis;
3-
4-
namespace ProxyInterfaceSourceGenerator.Extensions
5-
{
6-
internal static class MethodSymbolExtensions
7-
{
8-
public static string GetMethodNameWithOptionalTypeParameters(this IMethodSymbol method) =>
9-
!method.IsGenericMethod ? method.Name : $"{method.Name}<{string.Join(", ", method.TypeParameters.Select(tp => tp.Name))}>";
10-
11-
public static string GetWhereStatement(this IMethodSymbol method) =>
12-
!method.IsGenericMethod ? string.Empty : string.Join("", method.TypeParameters.Select(tp => tp.GetWhereStatement()));
13-
}
1+
using System.Linq;
2+
using Microsoft.CodeAnalysis;
3+
4+
namespace ProxyInterfaceSourceGenerator.Extensions
5+
{
6+
internal static class MethodSymbolExtensions
7+
{
8+
public static string GetMethodNameWithOptionalTypeParameters(this IMethodSymbol method) =>
9+
!method.IsGenericMethod ? method.Name : $"{method.Name}<{string.Join(", ", method.TypeParameters.Select(tp => tp.Name))}>";
10+
11+
public static string GetWhereStatement(this IMethodSymbol method) =>
12+
!method.IsGenericMethod ? string.Empty : string.Join("", method.TypeParameters.Select(tp => tp.GetWhereStatement()));
13+
}
1414
}
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
1-
using System;
2-
using System.Linq;
3-
using System.Text;
4-
using Microsoft.CodeAnalysis;
5-
6-
namespace ProxyInterfaceSourceGenerator.Extensions
7-
{
8-
internal static class NamedTypeSymbolExtensions
9-
{
10-
/// <summary>
11-
/// See https://www.codeproject.com/Articles/861548/Roslyn-Code-Analysis-in-Easy-Samples-Part
12-
/// </summary>
13-
public static string GetFullTypeString(this INamedTypeSymbol namedTypeSymbol)
14-
{
15-
var str = new StringBuilder(namedTypeSymbol.Name);
16-
17-
if (namedTypeSymbol.TypeArguments.Count() > 0)
18-
{
19-
str.AppendFormat("<{0}>", string.Join(", ", namedTypeSymbol.TypeArguments.OfType<INamedTypeSymbol>().Select(typeArg => typeArg.GetFullTypeString())));
20-
}
21-
22-
return str.ToString();
23-
}
24-
25-
public static string ResolveInterfaceNameWithOptionalTypeConstraints(this INamedTypeSymbol namedTypeSymbol, string interfaceName)
26-
{
27-
if (!namedTypeSymbol.IsGenericType)
28-
{
29-
return interfaceName;
30-
}
31-
32-
var str = new StringBuilder($"{interfaceName}<{string.Join(", ", namedTypeSymbol.TypeArguments.Select(ta => ta.Name))}>");
33-
34-
foreach (var typeParameterSymbol in namedTypeSymbol.TypeArguments.OfType<ITypeParameterSymbol>())
35-
{
36-
str.Append(typeParameterSymbol.GetWhereStatement());
37-
}
38-
39-
return str.ToString();
40-
}
41-
42-
/// <summary>
43-
/// See https://stackoverflow.com/questions/24157101/roslyns-gettypebymetadataname-and-generic-types
44-
/// </summary>
45-
public static string ResolveProxyClassName(this INamedTypeSymbol namedTypeSymbol)
46-
{
47-
return !namedTypeSymbol.IsGenericType ?
48-
$"{namedTypeSymbol.Name}Proxy" :
49-
$"{namedTypeSymbol.Name}Proxy<{string.Join(", ", namedTypeSymbol.TypeArguments.Select(ta => ta.Name))}>";
50-
}
51-
}
1+
using Microsoft.CodeAnalysis;
2+
using System.Linq;
3+
using System.Text;
4+
5+
namespace ProxyInterfaceSourceGenerator.Extensions
6+
{
7+
internal static class NamedTypeSymbolExtensions
8+
{
9+
/// <summary>
10+
/// See https://www.codeproject.com/Articles/861548/Roslyn-Code-Analysis-in-Easy-Samples-Part
11+
/// </summary>
12+
public static string GetFullTypeString(this INamedTypeSymbol namedTypeSymbol)
13+
{
14+
var str = new StringBuilder(namedTypeSymbol.Name);
15+
16+
if (namedTypeSymbol.TypeArguments.Count() > 0)
17+
{
18+
str.AppendFormat("<{0}>", string.Join(", ", namedTypeSymbol.TypeArguments.OfType<INamedTypeSymbol>().Select(typeArg => typeArg.GetFullTypeString())));
19+
}
20+
21+
return str.ToString();
22+
}
23+
24+
public static string ResolveInterfaceNameWithOptionalTypeConstraints(this INamedTypeSymbol namedTypeSymbol, string interfaceName)
25+
{
26+
if (!namedTypeSymbol.IsGenericType)
27+
{
28+
return interfaceName;
29+
}
30+
31+
var str = new StringBuilder($"{interfaceName}<{string.Join(", ", namedTypeSymbol.TypeArguments.Select(ta => ta.Name))}>");
32+
33+
foreach (var typeParameterSymbol in namedTypeSymbol.TypeArguments.OfType<ITypeParameterSymbol>())
34+
{
35+
str.Append(typeParameterSymbol.GetWhereStatement());
36+
}
37+
38+
return str.ToString();
39+
}
40+
41+
/// <summary>
42+
/// See https://stackoverflow.com/questions/24157101/roslyns-gettypebymetadataname-and-generic-types
43+
/// </summary>
44+
public static string ResolveProxyClassName(this INamedTypeSymbol namedTypeSymbol)
45+
{
46+
return !namedTypeSymbol.IsGenericType ?
47+
$"{namedTypeSymbol.Name}Proxy" :
48+
$"{namedTypeSymbol.Name}Proxy<{string.Join(", ", namedTypeSymbol.TypeArguments.Select(ta => ta.Name))}>";
49+
}
50+
}
5251
}

0 commit comments

Comments
 (0)