-
Notifications
You must be signed in to change notification settings - Fork 31
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 field autocompletion by GraphQL introspection #2
Comments
Hey David, |
Hopefully any. I would do a basic integration with the built-in mechanism of Emacs, so hopefully all the fancy packages can work on top of it. |
I am new to completion (ac, company, helm, ...). |
I'm not fully familiar with completion either, but this link https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-in-Buffers.html this the relevant standard way to implement completion in-buffers in Emacs. The packages you mention ac,company,helm are able to read this normally, so every standard completion in emacs work for them. Although they then extend that with more custom functionality. I would like to support first the standard emacs functionality I mentioned, and then optionally and if it is worthy, we can support other extensions. |
I am not familiar with completion either. Are we referring
|
I was thinking mostly about fields, specially useful for queries. But the more the better. We have to start somewhere. |
Yeah, you are right: start with the first standard and then extend later on. I need to read/experiment a bit more about completion to get some idea how to develop this feature. |
would these introspection good enough for fields?
|
I am not sure right now. I looks like it. I guess it's a bit trickier to "parse" the query, so we have a path field1 > field2 > ... and we can infer the type at that point. But it should work :-) |
Yeah, we need a proper parser.
Do you have any recommendation about how to approach the parser?
|
I don't think we actually need a full parser. It's quite easy to go upward in the elisp parser state levels . ({}). For example
going upward in the sexprs would take us to the parent fields, so we only need to find the field name (not alias), by skipping over the parenthesis and reading a word. However, having a full parser would be probably great for other functionality. If you want, we can go in that direction. We can write our own parser, using any of the well known techniques, or we can try to translate the official parser from js to elisp more literally. |
Looks awesome. Is it using introspection then? |
Yeah, the completion use introspection, whatever the __schema response from the server. Here is the 2nd draft, a separated package company-graphql.el. |
I wrote few parsers in the past. It is not hard in C/C++, or python, |
I will try if I have some time. |
This looks awesome. Would love an update on where this stands. |
@timoweave do you have any update of this? or can you share a branch with your changes? perhaps we can merge a initial version and leave the proper parsing for later. 👍 |
Yeah, David! We have new participant! It will be really fully functional like Interested in working on it together? I’ve also like |
Hi, folks! Any update on this? I've tried |
With graphql-language-service and lsp-mode, you can get auto-completion with this snippet:
I'll look in to getting this upstreamed into
|
Using GraphQL introspection we can get the fields, what could be used to autocomplete the fields at point.
The text was updated successfully, but these errors were encountered: