Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize TextAlignmentExtensionsGenerator #321

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f64408a
Add Unit Tests
TheCodeTraveler Oct 4, 2024
3d80496
Update TextAlignmentExtensionsGenerator.cs
TheCodeTraveler Oct 4, 2024
2fac95b
Update Tests
TheCodeTraveler Oct 4, 2024
93e985b
Fix Unit Tests
TheCodeTraveler Oct 4, 2024
9f51055
Update TextAlignmentExtensionsTests.cs
TheCodeTraveler Oct 4, 2024
7dd2c3f
Update azure-pipelines.yml
TheCodeTraveler Oct 4, 2024
f751a62
Remove Generated File Name
TheCodeTraveler Oct 4, 2024
f661c5f
Refactor TextAlignmentExtensionsGenerator
TheCodeTraveler Oct 6, 2024
83eb152
Update Source Generator
TheCodeTraveler Oct 6, 2024
064be4b
Update TextAlignmentExtensionsGenerator.cs
TheCodeTraveler Oct 6, 2024
6d8f1ef
Merge branch 'main' into Update-Analyzers
TheCodeTraveler Oct 6, 2024
1744eee
Remove temporary variable
TheCodeTraveler Oct 6, 2024
44be926
Merge branch 'Update-Analyzers' of https://github.com/CommunityToolki…
TheCodeTraveler Oct 6, 2024
1e00aea
Refactor Source Generator
TheCodeTraveler Oct 6, 2024
8b00b91
Update CommunityToolkit.Maui.Markup.SourceGenerators.UnitTests.csproj
TheCodeTraveler Oct 6, 2024
696fbf3
Add Benchmarks
TheCodeTraveler Oct 6, 2024
30d55d8
Update TextAlignmentExtensionsGeneratorBenchmarks.cs
TheCodeTraveler Oct 6, 2024
f8697d0
Remove `PrivateAssets`
TheCodeTraveler Oct 6, 2024
2ed054e
Remove unnecessary NuGet Packages
TheCodeTraveler Oct 6, 2024
efa18ff
Update TextAlignmentExtensionsGenerator.cs
TheCodeTraveler Oct 6, 2024
f93e9d9
Revert Source Generator for Benchmarking
TheCodeTraveler Oct 6, 2024
59c136f
Revert "Revert Source Generator for Benchmarking"
TheCodeTraveler Oct 6, 2024
14743ab
Merge branch 'main' into Update-Analyzers
TheCodeTraveler Nov 12, 2024
7130bb0
Merge branch 'main' into Update-Analyzers
TheCodeTraveler Nov 25, 2024
22ab532
Merge branch 'main' into Update-Analyzers
TheCodeTraveler Nov 26, 2024
9937498
Merge branch 'main' into Update-Analyzers
TheCodeTraveler Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update TextAlignmentExtensionsGenerator.cs
  • Loading branch information
TheCodeTraveler committed Oct 6, 2024
commit 064be4b376bfb4237c9032e52151c791515d78fa
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class TextAlignmentExtensionsGenerator : IIncrementalGenerator

public void Initialize(IncrementalGeneratorInitializationContext context)
{
// Optimize: Use ValueTuple for lightweight data passing
IncrementalValuesProvider<(INamedTypeSymbol ClassSymbol, INamedTypeSymbol ITextAlignmentInterfaceSymbol)> userGeneratedClassesProvider = context.SyntaxProvider
.CreateSyntaxProvider(
static (syntaxNode, _) => syntaxNode is ClassDeclarationSyntax { BaseList: not null },
Expand All @@ -40,7 +39,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)

var compilationProvider = context.CompilationProvider;

// Optimize: Combine providers to reduce the number of operations
// Combine providers to reduce the number of operations
var combined = userGeneratedClassesProvider
.Collect()
.Combine(compilationProvider);
Expand Down Expand Up @@ -408,7 +407,7 @@ static string GetGenericConstraintsString(INamedTypeSymbol namedTypeSymbol)
{
var constraints = namedTypeSymbol.TypeParameters
.Select(GetGenericParameterConstraints)
.Where(c => !string.IsNullOrEmpty(c));
.Where(static c => !string.IsNullOrEmpty(c));

return string.Join(" ", constraints);
}
Expand Down
Loading