Skip to content

Commit 2e5583e

Browse files
author
pmosk
committed
Create first version
1 parent bfab785 commit 2e5583e

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/setup-dotnet@v4
2424
with:
2525
dotnet-version: |
26-
8.0.x
26+
9.0.x
2727
2828
# Create Local NuGet Source
2929

src/CodeAnalysis.Extensions/CodeAnalysis.Extensions.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<RepositoryUrl>https://github.com/pfpack/early-codeanalysis</RepositoryUrl>
1717
<Company>pfpack</Company>
1818
<Authors>Andrei Sergeev, Pavel Moskovoy</Authors>
19-
<Copyright>Copyright © 2024 Andrei Sergeev, Pavel Moskovoy</Copyright>
19+
<Copyright>Copyright © 2025 Andrei Sergeev, Pavel Moskovoy</Copyright>
2020
<Description>EarlyFuncPack CodeAnalysis is a library for .NET for use in building source generators.</Description>
2121
<RootNamespace>PrimeFuncPack</RootNamespace>
2222
<AssemblyName>EarlyFuncPack.CodeAnalysis.Extensions</AssemblyName>
23-
<Version>0.0.1-build.1</Version>
23+
<Version>0.0.1</Version>
2424
</PropertyGroup>
2525

2626
<ItemGroup>
@@ -39,7 +39,7 @@
3939
</ItemGroup>
4040

4141
<ItemGroup>
42-
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.10.0" />
42+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
4343
</ItemGroup>
4444

4545
</Project>

src/CodeAnalysis.Extensions/TypeData/DisplayedTypeData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PrimeFuncPack;
44

5-
public sealed record class DisplayedTypeData
5+
public sealed class DisplayedTypeData
66
{
77
public DisplayedTypeData(IReadOnlyCollection<string> allNamespaces, string displayedTypeName)
88
{

src/CodeAnalysis.SourceBuilder/CodeAnalysis.SourceBuilder.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<RepositoryUrl>https://github.com/pfpack/early-codeanalysis</RepositoryUrl>
1717
<Company>pfpack</Company>
1818
<Authors>Andrei Sergeev, Pavel Moskovoy</Authors>
19-
<Copyright>Copyright © 2024 Andrei Sergeev, Pavel Moskovoy</Copyright>
19+
<Copyright>Copyright © 2025 Andrei Sergeev, Pavel Moskovoy</Copyright>
2020
<Description>EarlyFuncPack CodeAnalysis is a library for .NET for use in building source generators.</Description>
2121
<RootNamespace>PrimeFuncPack</RootNamespace>
2222
<AssemblyName>EarlyFuncPack.CodeAnalysis.SourceBuilder</AssemblyName>
23-
<Version>0.0.1-build.1</Version>
23+
<Version>0.0.1</Version>
2424
</PropertyGroup>
2525

2626
<ItemGroup>

src/CodeAnalysis.SourceBuilder/SourceBuilder/Builder.Build.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ partial class SourceBuilder
88
{
99
public string Build()
1010
{
11-
var builder = new StringBuilder("// Auto-generated code");
12-
builder = builder.AppendLine().Append("#nullable enable");
11+
var builder = new StringBuilder("// Auto-generated code by PrimeFuncPack").AppendLine().Append("#nullable enable");
1312

14-
if (usings.Count is not > 0)
13+
if (usings.Count > 0)
1514
{
1615
builder = builder.AppendLine();
1716
}
@@ -23,7 +22,7 @@ public string Build()
2322

2423
builder = builder.AppendLine().AppendLine().Append("namespace").Append(' ').Append(@namespace).Append(';');
2524

26-
if (aliases.Count is not > 0)
25+
if (aliases.Count > 0)
2726
{
2827
builder = builder.AppendLine();
2928
}

src/CodeAnalysis.SourceBuilder/SourceBuilder/SourceBuilder.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ public SourceBuilder(string? @namespace)
2323

2424
private SourceBuilder InnerAppendLineWithTabulation(string codeLine)
2525
{
26-
if (tabulationSize is not > 0)
26+
if (codeBuilder.Length > 0)
2727
{
28-
return this;
28+
_ = codeBuilder.AppendLine();
2929
}
3030

31-
var tabulation = new string(' ', TabulationLength * tabulationSize);
32-
_ = codeBuilder.AppendLine().Append(tabulation).Append(codeLine);
31+
if (tabulationSize > 0)
32+
{
33+
var tabulation = new string(' ', TabulationLength * tabulationSize);
34+
_ = codeBuilder.Append(tabulation);
35+
}
3336

37+
_ = codeBuilder.Append(codeLine);
3438
return this;
3539
}
3640
}

0 commit comments

Comments
 (0)