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

Put comments behind an option in formatter #271

Merged
merged 2 commits into from
Jul 17, 2023

Commits on Jul 16, 2023

  1. Put comments behind an option in formatter

    In vektah#263, we introduced parsing of comments, as well as support for them
    in the formatter. In some cases this is surely useful, but in others
    it's just bloat. (And as I describe in Khan/genqlient#282, it may even
    be a problem in some cases which depended on the fact that formatting
    the query didn't include comments.)
    
    In this commit I introduce an option to control whether comments are
    formatted. I set the default to false (i.e. restoring the previous
    behavior if no options are set), because adding this felt to me
    like a breaking change, and because it seems to me like the more common
    usage. `WithComments()` restores the behavior added in vektah#263. If others
    disagree I'm happy to keep the changed default, and instead provide
    `WithoutComments()`. I also added tests both ways (and for the existing
    `WithIndent()` option), and checked that the `comments` tests match the
    existing ones, and the `default` tests match those from `v2.6.3` (except
    for the addition of a few descriptions whose omission seem to have been
    a bug).
    
    Comments are still parsed in any case, as adding new struct fields is no
    problem; and they are still included in `Dump` since that seems
    obviously parallel to struct fields and is more of a debugging thing.
    benjaminjkraft committed Jul 16, 2023
    Configuration menu
    Copy the full SHA
    4b21abf View commit details
    Browse the repository at this point in the history
  2. docs

    benjaminjkraft committed Jul 16, 2023
    Configuration menu
    Copy the full SHA
    0cea54f View commit details
    Browse the repository at this point in the history