excubo-ag / generators.blazor Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Is it still incompatible if using seperate code-behind files?
Reference: dotnet/runtime#56556
See comment dotnet/runtime#56556 (comment), and dotnet/runtime#56556 (comment)
Feel free to correct me, if my analysis is not correct.
The following source generators implement the "V1" API and use a syntax receiver, which requires reprocessing the entire project after every edit to a source file. This behavior quickly and unavoidably overwhelms the IDE for medium to large projects.
Switching to IIncrementalGenerator
allows for incremental processing of syntax to avoid this overhead.
Hello!
I love the RequiredAttribute and the analysis it provides! But I think this package can be improved when the Attributes are also generated. Because they are now 'real' we need a reference to Excubo.Generators.Blazor which we otherwise do not need. When the attribute is generated we could change this:
<PackageReference Include="Excubo.Generators.Blazor" Version="1.11.3" />
to
<PackageReference Include="Excubo.Generators.Blazor" Version="1.11.3" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
which reduces the extra dll when downloading Blazor for WASM.
I can image it would work like this (and maybe for all the other Attributes/public 'interface' classes):
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
namespace Excubo.Generators.Blazor
{
[Generator]
public partial class AddAttributeAnalyzer : ISourceGenerator
{
private const string AttributeText = @"
using System;
namespace Excubo.Generators.Blazor
{
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
public sealed class RequiredAttribute : Attribute
{
}
}";
public void Initialize(GeneratorInitializationContext context)
{
}
public void Execute(GeneratorExecutionContext context)
{
context.AddSource("RequiredAttribute.generated.cs", SourceText.From(AttributeText, Encoding.UTF8));
}
}
}
Or maybe combine them in the current analyser.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.