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

Typeahead in VariableEditor #70

Closed
wants to merge 1 commit into from
Closed

Conversation

asiandrummer
Copy link
Contributor

Powered by CodeMirror. Simply search for all Variable (http://facebook.github.io/graphql/#Variable), de-duplicate/sort, and serve them up to the typeahead. Typeahead is trigger on typing letters/backspace/quotes (")/and underscore character.

Still have some UI improvements/testing to finish - just opening a PR for early reviews.


// Match all variableDefinitions, even if they're not declared on the top.
// De-duplicate before filtering/sorting the list
let hintList = options.query.match(/\$\s*[_A-Za-z][_0-9A-Za-z]*/g);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is probably not what we want - this will cause false-positive matches for something like "I'm a string with a $thing in it" and it also lacks the information we want to do a good type-ahead: the relevant input schema. Just having a list of variables only lets us typeahead names, but doesn't let us typeahead or lint values like allowed enum values or input objects with deeper fields.

@leebyron
Copy link
Contributor

I think this ultimately belongs in codemirror-graphql. That would allow us to share the lexicalDistance function, for example. The full typeahead we want will also leverage a lot of what we've already built for hinting and linting graphql.

@asiandrummer
Copy link
Contributor Author

I agree - closing and moving this over to codemirror-graphql.

@asiandrummer asiandrummer deleted the variables-typeahead branch March 9, 2016 23:51
acao pushed a commit to acao/graphiql that referenced this pull request Jun 1, 2019
…ransform-flow-strip-types-6.21.0

Update babel-plugin-transform-flow-strip-types to the latest version 🚀
acao pushed a commit to acao/graphiql that referenced this pull request Jun 5, 2019
…ransform-es2015-block-scoped-functions-6.22.0

Update babel-plugin-transform-es2015-block-scoped-functions to version 6.22.0 🚀
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants