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

Source Generator for Bindable Property #1321

Merged
merged 16 commits into from
Aug 2, 2024
Merged

Conversation

pictos
Copy link
Member

@pictos pictos commented Aug 7, 2023

This will be used by the lib only, it shouldn't be part of our public nuget, because of that I deleted the template...

I'll point out the code areas that, I believe, can cause questions. In the future should be easier to port the code to the public SG project and delete this one

Fixes #542

{
var data = attribute.ConstructorArguments[0];

return data.Value is null ? throw new NullReferenceException() : data.Value.ToString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add a message for NRE describing what is null?

@brminnick
Copy link
Collaborator

brminnick commented Aug 12, 2023

Thanks Pedro! Just FYI - I renamed the new class and its namespace to CommunityToolkit.Maui.SourceGenerators.Internal.

This opens up the opportunity for us to use this csproj for additional internal source generators in the future.

And let's convert all of our BindablePropertys in this PR before we merge. I'm happy to help convert them all.

@brminnick
Copy link
Collaborator

brminnick commented Aug 12, 2023

Hey Pedro! This is looking really really cool!

Could you add the ability to include XML comments in the attribute? Right now <inheritdoc /> is hardcoded, but many of our already-implemented properties have customized XML docs. I tried to convert a couple existing BindablePropertys, but ran into this as a blocker.

👇 Maybe it'd look something like this?

[BindableProperty<bool>("IsExpanded", PropertyChangedMethodName = nameof(OnIsExpandedPropertyChanged), XMLComment="<inheritdoc />")]

@pictos
Copy link
Member Author

pictos commented Aug 12, 2023

@brminnick I didn't have a good approach for XML docs, because they can be small or big, and not sure how that will fit with SG... Maybe let this be solved when C# has partial properties?

OF course, you may have a bunch of const string to reference, but I don't feel it very idiomatic

@ghost ghost added stale The author has not responded in over 30 days help wanted This proposal has been approved and is ready to be implemented labels Sep 27, 2023
@VladislavAntonyuk
Copy link
Collaborator

@pictos do we need any unresolved issues or open questions? Can we merge this PR as it is?

@listepo
Copy link

listepo commented Apr 14, 2024

any news?

@brminnick brminnick removed help wanted This proposal has been approved and is ready to be implemented stale The author has not responded in over 30 days labels Aug 2, 2024
Copy link
Collaborator

@brminnick brminnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Pedro! Thanks Vlad!

@brminnick brminnick disabled auto-merge August 2, 2024 16:58
@brminnick brminnick merged commit 2baab31 into main Aug 2, 2024
8 checks passed
@brminnick brminnick deleted the pj/bindable-property-SG branch August 2, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] BindableProperty generator
4 participants