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

Support for Schema autocomplete in codemirror-graphql #1619

Open
sebas5384 opened this issue Jul 20, 2020 · 4 comments
Open

Support for Schema autocomplete in codemirror-graphql #1619

sebas5384 opened this issue Jul 20, 2020 · 4 comments

Comments

@sebas5384
Copy link

I'm working on top of what it's already supported on codemirror-graphql and adding some new stuff to support autocomplete, here's some videos of what I have so far: https://twitter.com/sebas5384/status/1284981079636574208?s=20

For now the graphql mode is doing an excellent job, though things like multiline comments are not supported so I'll have to add that later so users can document their schema.

Hope to upload the code by the end of this week, maybe as a PR, don't know yet.

I know this project is moving towards Monaco editor, but I guess the autocompletion could be reused.

@acao
Copy link
Member

acao commented Sep 16, 2020

yes please do! codemirror-graphql is still the default for 90% of graphql tooling and it will stay that way until we can improve on the monaco mode. any improvements will benefit the graphql community foe years to come!

@acao acao changed the title Support for Schema autocomplete Support for Schema autocomplete in codemirror-graphql Sep 18, 2020
@acao
Copy link
Member

acao commented Sep 18, 2020

@sebas5384 also, please note that monaco-graphql already has schema autocompletion support

@acao
Copy link
Member

acao commented Sep 21, 2020

most of this behavior is implemented at the LSP level, which monaco-graphql has implemented already directly. pretty soon we will have peek definition and symbols support with monaco-graphql, as well, which is simpler because it implements the LSP protocol. currently, monaco-graphql supports autocompletion, validation, and other schema features when editing an SDL file by default because the LSP does.

with codemirror-graphql, because codemirror does not use LSP protocol, we have to manually implement another layer of business logic to transform codemirror event input to interoperate with the LSP (graphql-language-service-interface methods, etc)

this is part of the reason we are moving to monaco-graphql, because it more naturally consumes the LSP interface.

@acao
Copy link
Member

acao commented Sep 21, 2020

you can also see that the LSP server in this repo ( used by vscode-graphql, vim coc graphql, other IDE plugins) are already using the full SDL completion, using the same interfaces that the monaco-graphql mode is using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants