Graphiql: Plugin: keyboard shortcut to add all fields

Created on 15 Feb 2018  路  6Comments  路  Source: graphql/graphiql

Related: https://github.com/graphql/graphiql/issues/75

I would love to see a button, or a key combination that will add/autocomplete all direct fields of the current object. Complex fields will be autocompleted to {}, that will need to be manually fileld out.

Example:

Type Person with fields id, name, groups, teams
Type Group with fields id, name, people
Type Teams with fields id, name, people

Typing

query { 
  people { 
    <MAGIC KEY COMBINATRION>
  } 
}

becomes

query { 
  people { 
    id
    name
    groups(page: null , page_size: null) {  
    }
    teams(page: null , page_size: null) {  
    }
  } 
}

Also plus if the complex subtypes are added at the end

enhancement potential plugin version 1

Most helpful comment

@axos88 That would be a cool feature and something I have thought of myself!

All 6 comments

Another possibility is to have an "add all" in the autocomplete dropdown.

@axos88 That would be a cool feature and something I have thought of myself!

this would be cool! Altair is a great tool that uses our codemirror-graphql mode and accomplishes this readily.

FWIW, there is a shortcut for automatically adding all required fields for an object type. just type in the name of the field, and before adding brackets, just hit enter, and youll see it automatically add all the required fields for that object. voila!

@FluorescentHallucinogen has some nice ideas on the UX for this too!

@FluorescentHallucinogen has some nice ideas on the UX for this too!

Yep, see
https://github.com/prisma/graphql-playground/issues/683#issuecomment-464465807 (first iteration)
https://github.com/prisma/graphql-playground/issues/683#issuecomment-464845224 (improved)
https://github.com/prisma/graphql-playground/issues/683#issuecomment-477032683 (final vision)

The only thing that may not clear from my last image (final vision) is the "Insert all fields" and "Insert required fields" items are clickable, aren't just static tips.

Please also take a look at https://github.com/imolorhe/altair/issues/753.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ElijahLynn picture ElijahLynn  路  10Comments

fson picture fson  路  17Comments

asiandrummer picture asiandrummer  路  23Comments

majkrzak picture majkrzak  路  12Comments

okorz001 picture okorz001  路  18Comments