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

Indenting for aliases looks wrong #133

Closed
joshstrange opened this issue Mar 12, 2018 · 4 comments
Closed

Indenting for aliases looks wrong #133

joshstrange opened this issue Mar 12, 2018 · 4 comments

Comments

@joshstrange
Copy link

When I use an alias in my graphql query it auto-formats to this:

let myQuery = gql`
    {
        myAlias: MyObject {
        id
        name
    }
    }
`;

when I expect it to look like this:

let myQuery = gql`
    {
        myAlias: MyObject {
            id
            name
        }
    }
`;

Am I missing a setting or something that would allow for my expected formatting?

@jimkyndemeyer
Copy link
Collaborator

Hi Josh.

Thanks for reporting this.

This appears to be related to shorthand queries. If you use the query keyword the indentation works as expected, e.g.

let myQuery = gql`
    query {
        myAlias: MyObject {
            id
            name
        }
    }
`;

I'll include a fix in an upcoming release.

@joshstrange
Copy link
Author

@jimkyndemeyer Thank you! I'll use query {} to fix this for now. Thank you for your fast response!

@jimkyndemeyer
Copy link
Collaborator

The 2.0 alpha follows the latest GraphQL language draft spec as of June 2018.

It should indent aliased fields correctly.

See 2.0.0-alpha-2 if you'd like to try it and help test it.

@jimkyndemeyer
Copy link
Collaborator

Confirmed this indents correctly with v2 alpha-7.

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

No branches or pull requests

2 participants