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

Simplify .graphqlconfig somehow #56

Open
j3pic opened this issue Sep 5, 2023 · 1 comment
Open

Simplify .graphqlconfig somehow #56

j3pic opened this issue Sep 5, 2023 · 1 comment

Comments

@j3pic
Copy link

j3pic commented Sep 5, 2023

I find it highly irritating that GraphQL URLs must be written into the poorly-documented structure of .graphqlconfig, and to make it worse, this file must appear in the same directory that the GraphQL-Mode buffer considers itself to be in (I only use this buffer to write queries I mean to submit to the server). Since the only two things I'm interested in configuring are the URL and the headers, it would be nice if these could be set through Emacs Lisp variables. Then I wouldn't have to have guessed the fact that you don't actually have to supply a .graphql schema file, even though this option appears at a lower depth in the structure and is not marked as an "extension".

The very worst part about it is that if you make a mistake in .graphqlconfig, there's no obvious way to fix it because GraphQL-Mode caches the file. I made a typo in the URL, and GraphQL-Mode just kept using the typo-containing version of the URL even after I fixed it in .graphqlconfig.

@davazp
Copy link
Owner

davazp commented Sep 6, 2023

Hi @j3pic , thanks for sharing your impressions with it. I'm not very actively using this package now, but hopefully someone is willing to open a pull request to solve those issues.

In the mean time, you can try the even buffer-local variable as described in the even more poorly documented issue here:
#21 (comment)

Some ideas for the issues you found:

...the poorly-documented structure of .graphqlconfig

It'd be nice to add some examples to the README.md

this file must appear in the same directory that the GraphQL-Mode buffer considers itself to be in

We could check what other editors do. Looking for a config in all the ancestor directories is an easy change, and if it doesn't find any it could ask interactively and save the variable.

The very worst part about it is that if you make a mistake in .graphqlconfig, there's no obvious way to fix it because GraphQL-Mode caches the file.

Yeah that sounds annoying. I guess we could change that so it is parsed for every query. Only if the buffer-local variables aren't defined.

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

No branches or pull requests

2 participants