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

Plugin: keyboard shortcut to add all fields #661

Open
axos88 opened this issue Feb 15, 2018 · 6 comments
Open

Plugin: keyboard shortcut to add all fields #661

axos88 opened this issue Feb 15, 2018 · 6 comments
Labels
enhancement graphiql monaco-graphql potential plugin A potential plugin idea for later versions of GraphiQL

Comments

@axos88
Copy link

axos88 commented Feb 15, 2018

Related: #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

@axos88
Copy link
Author

axos88 commented Feb 15, 2018

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

@kevinsimper
Copy link
Contributor

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

@imolorhe
Copy link
Contributor

https://github.com/imolorhe/altair

@acao
Copy link
Member

acao commented Jun 25, 2019

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!

@acao acao added enhancement potential plugin A potential plugin idea for later versions of GraphiQL version 1 labels Jun 25, 2019
@imolorhe
Copy link
Contributor

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

@FluorescentHallucinogen

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

Yep, see
graphql/graphql-playground#683 (comment) (first iteration)
graphql/graphql-playground#683 (comment) (improved)
graphql/graphql-playground#683 (comment) (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 altair-graphql/altair#753.

@benjie benjie changed the title Keyboard shortcut to add all fields Plugin: keyboard shortcut to add all fields Dec 10, 2019
@acao acao added this to GraphiQL Core Extensions in ! Feature Roundup Dec 17, 2019
@acao acao added this to the GraphiQL-1.0.0-beta milestone Mar 13, 2020
@acao acao added the graphiql label Nov 13, 2022
@acao acao removed this from the graphiql@2.0.0-beta milestone Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement graphiql monaco-graphql potential plugin A potential plugin idea for later versions of GraphiQL
Projects
! Feature Roundup
GraphiQL Core Plugins
Status: Todo
Development

No branches or pull requests

6 participants