apollo-tooling: [apollo-vscode] Autocomplete does not work with remote endpoint or local schema
I am trying since some hours to configure Apollo GraphQL VSCode plugin without any success. The only thing I get out of it is validation against the schema, and that only for the very first time after the editor reload.
Configuration examples:
Remote endpoint
module.exports = {
client: {
service: {
name: 'my-project',
url: 'http://localhost:4000/graphql',
},
includes: ['./project/**/*.graphql'],
},
};
Local schema
module.exports = {
client: {
service: {
name: 'my-project',
localSchemaFile: 'path/to/schema.json'
},
includes: ['./project/**/*.graphql'],
},
};
I tried to look at the debug output with verbose option and one thing that I noticed is that result is always empty (like []). I am running whole Apollo stack on the latest versions.
If it helps I can as well post the whole verbose output.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (7 by maintainers)
@warmbowski I tried without
./but still had the same issues 😕@vadistic That actually worked! If that is intended this for sure needs to land in documentation. What is weird is that even remote schema starts to work now for me, which I cannot wrap my mind around at the moment.
I changed the
includesand addedexcludesfor node_modules:Hi @JakeDawkins,
client:codegenworks fine for me as well, that’s not the problem. The problem is thatapollo-vscodeplugin didn’t give us any autosuggestions in GraphQL queries.On your repo I had the same problem but it was fixed by removing
./from the paths, which you mentioned will be fixed when #1007 is merged.My conclusion is that in fact
./was the root of the problem. For me changing the path to**/*.tsworked simply because it had no./as well.From my point of view this issue can be closed.
@klemenoslaj and others following along -
localSchemaFileis intended to be just one option for referencing aservice, as is the remote endpoint configuration. These options shouldn’t really be used in tandem (I’d have to dig into the code to know what behavior to expect when both are provided).The docs do illustrate this, but I would love feedback if anyone would like to offer suggestions to improve our explanations here: https://www.apollographql.com/docs/references/apollo-config.html#client-service
As a side note,
excludeswill leave out allnode_modulesby default 😄 https://www.apollographql.com/docs/references/apollo-config.html#client-excludesi have the same issue 😢