graphql / graphql/graphiql

vscode-graphql autocomplete not working

Open
#2,390 5 comments 4 reactions 0 assignees View on GitHub
bug lsp-server vscode-graphql
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

Hi everyone,

i have a hard time figuring out how to config this extension so autocomplete works for my graphql types and fields.
Of course i went through the readme but neither config did the trick.

My confilg looks like this:

```
module.exports = {
schema: "http://localhost:4667/graphql",
documents: "src/**/*.{graphql,js,ts,jsx,tsx}",
extensions: {
languageService: {
cacheSchemaFileForLookup: true,
enableValidation: false,
},
},
};
```

I have a `src`-folder and the config file is in the root level.

Most of the time the server crashes with:

```
5/6/2022, 4:02:18 PM [1] (pid: 22159) graphql-language-service-usage-logs: invalid/unknown file in graphql config documents entry:
'src/**/*.{graphql,js,ts,jsx,tsx}'
```

When i start the graphql server, the following errors are thrown too:

```
Type "root" already exists in the schema. It cannot also be defined in this type definition.

Field "root.query" already exists in the schema. It cannot also be defined in this type extension.

Field "root.mutation" already exists in the schema. It cannot also be defined in this type extension.
```

**If i remove the `documents`-property** the server starts. But autocomplete does not work at all.

If i hit ctrl-space, this is what I get:
Bildschirmfoto 2022-05-06 um 16 10 09

If i type a `S`it looks like this
Bildschirmfoto 2022-05-06 um 16 10 20

And my own types are also not recognized at all:
Bildschirmfoto 2022-05-06 um 16 10 35

I struggle with this extension since at least a year… I even switched to PHPStorm once (their extension works perfectly but the IDE is missing features)

I guess it shouId not be this hard to get this working.
I really would appreciate it if someone could help me with this.
Thanks in advance and best regards

Daniel

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.