最近のSource Generator開発 - Qiita

はじめに 最近,万物をSource Generatorで書いていてどハマりしています。 変な仕組みを作り出して快適な開発を実現しているので,その一部を簡単に紹介したいと思います。 IDisposableの自動実装で紹介したSG Dirge を例として紹介します。 SGの...

Qiita

My kingdom for the ability to exclude source generated code from usage definition searches.

“Oh god this class I’m about to refactor has 268 usages”
“oh god it’s all in source generated files”

I could probably set a search filter to exclude them but it’d be nice to be able to just pragma them away. This might be an IDE issue than dotnet though, but I know I’m not alone in this pain.

#dotnet #csharp #sourcegenerator

A workaround could be to use my source generator to also generate a test helper class with the syntax tree as a string. Feels a bit icky but it seems workable. #dotnet #sourcegenerator #unitest
So am I the only one struggling with using `IncrementalValueProvider<string?>` with `ForAttributeWithMetadataName` in a #dotnet #sourcegenerator? I would have loved to alter the namespace of my attribute using an MSBuild prop, but it seems like that is not possible?

So made a source generator - ended up rather complex.
But I find unit testing it very tedious when verifying the generated output via Verify.

Is it not possible to load a class/instance as source in the testing, and use it as foundation for the generator. Instead of having to manually writing (and maintaining) the source as a string to then parse into a syntax tree to verify output? I mean it can generate on compile time, so why not at test? :D

#dotnet #sourcegenerator #unittest

Just published static view locator source generator for Avalonia so you don't have to use reflection anymore #Avalonia #dotnet #charp #xaml #sourcegenerator https://www.nuget.org/packages/StaticViewLocator/0.0.1
StaticViewLocator 0.0.1

A C# source generator that automatically implements static view locator for Avalonia without using reflection.

This library is a C# source generator designed to automatically generate string length constants from Entity Framework configurations and data annotations.

#sourcegenerator #entityframework #stringlength #dotnet

https://github.com/TarasKovalenko/EntityLengths.Generator

GitHub - TarasKovalenko/EntityLengths.Generator: Source generator for EF Core entity length constants

Source generator for EF Core entity length constants - TarasKovalenko/EntityLengths.Generator

GitHub
SourceGenerators/examples/dependency-injection at master · RikudouSage/SourceGenerators

Contribute to RikudouSage/SourceGenerators development by creating an account on GitHub.

GitHub

I've just created a PHP source generators package. It's still work-in-progress.

What do you think, yay or nay?

https://github.com/RikudouSage/SourceGenerators

#OpenSource #PHP #SourceGenerator #Programming

GitHub - RikudouSage/SourceGenerators

Contribute to RikudouSage/SourceGenerators development by creating an account on GitHub.

GitHub

Creating a #SourceGenerator is not worth it (I think).

Manually converting #JavaScript modules to #CSharp.

https://gist.github.com/AliveDevil/264cc53132d064c4561f5fbf84bfabc4

1-Original.js

GitHub Gist: instantly share code, notes, and snippets.

Gist