Coder Social home page Coder Social logo

flavien / quickconstructor Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 3.0 125 KB

QuickConstructor is a reliable and feature-rich source generator that can automatically emit a constructor from the fields and properties of a class.

License: Apache License 2.0

C# 100.00%

quickconstructor's People

Contributors

flavien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

quickconstructor's Issues

Never use symbols as the result of syntax providers

Symbol references may change on any source code changes. Having symbols in the model will make your source generator rerun on every key press. I mean here, which uses this as the model.
The best practice is to store the fully qualified names and then find them in the output generation step.

Base constructor is disregarded if the base is not also marked with the attribute

If I define a base class with a manual constructor, as you'd normally do:

public abstract class Base
{
    private readonly object _value;
    public Base(object v) => _value = v;
}

And then try and generate one for a derived class:

[QuickConstructor]
public sealed partial class Class : Base
{
}

It will generate invalid code, completely disregarding the base constructor. It works if you mark the base class with that though.

This could be helpful if you don't own the source code of the Base class and can't just go ahead and add the attribute to it.

Suggestion: defaults configuration

E.g. being able to specify the default options for null checks could be useful. I want to get rid of the autogenerated null checks in the constructor by default. I can't do that by default, being forced to pass in NullChecks = NullChecks.Never manually on each invocation.

I suggest adding a Default option to the enum, which would mean that it draws the value based on the ambient configuration, which could be configured via an assembly level attribute or an MSBuild property.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.