Skip to content
This repository has been archived by the owner on Jul 31, 2022. It is now read-only.

Commit

Permalink
fix: upgrade language server, fix major issues
Browse files Browse the repository at this point in the history
This LSP server update should fix all issues with `schema` config for both SDL files and urls.
  • Loading branch information
acao committed Nov 26, 2021
1 parent 6e7f102 commit 6312903
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 139 deletions.
10 changes: 4 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"eg2.tslint"
]
}
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": []
}
39 changes: 29 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# VSCode GraphQL

> **Note:** The primary maintainer @acao is on hiatus until December 2020
GraphQL extension VSCode built with the aim to tightly integrate the GraphQL Ecosystem with VSCode for an awesome developer experience.

![](https://camo.githubusercontent.com/97dc1080d5e6883c4eec3eaa6b7d0f29802e6b4b/687474703a2f2f672e7265636f726469742e636f2f497379504655484e5a342e676966)
Expand Down Expand Up @@ -129,33 +127,41 @@ Notice that `documents` key supports glob pattern and hence `["**/*.graphql"]` i

## Frequently Asked Questions

### Go to definition is using `generated_schema.graphql`, not my schema source files
### Go to definition is not working for my URL

You can try the new experimental `cacheSchemaFileForLookup` option. NOTE: this will disable all definition lookup for local SDL graphql schema files, and _only_ perform lookup of the result an SDL result of `graphql-config` `getSchema()`

Ah yes, this is now the default behavior used by most users, who do not have source SDL files.
If you're using an "SDL first" methodology, such as with apollo, you'll want to enable `useSchemaFileDefinitions`.
Add this to your settings:
To enable, add this to your settings:

```json
"vscode-graphql.useSchemaFileDefinitions": true,
"vscode-graphql.cacheSchemaFileForLookup": true,
```

you can also use graphql config if you need to mix and match these settings:

```yml
schema: http://myschema.com/graphql
extensions:
languageService:
cacheSchemaFileForLookup: true
projects:
project1:
schema: project1/schema/schema.graphql
documents: project1/queries/**/*.{graphql,tsx,jsx,ts,js}
extensions:
languageService:
useSchemaFileDefinitions: true
cacheSchemaFileForLookup: false

project2:
schema: https://api.spacex.land/graphql/
documents: project2/queries.graphql
extensions:
endpoints:
default:
url: https://api.spacex.land/graphql/
languageService:
# Do project configs inherit parent config?
cacheSchemaFileForLookup: true
```
### The extension fails with errors about duplicate types
Expand Down Expand Up @@ -189,9 +195,22 @@ So you'll need to add something like this to your global vscode settings:

The best way to make "execute <op type>" codelens work is to add endpoints config to the global graphql config or the project config.

The config example above shows how to configure endpoints.
This would look like:

```ts
export default {
schema: "mschema.graphql",
extension: {
endpoints: {
default: "http://localhost:9000",
},
},
}
```

(see above for per-project examples)

If there is an issue with execution that has to do with your server, the error response should show now in the results panel.
If there is an issue with execution that has to do with your server, the error response should show now in the result panel.

In case the request fails due to self signed certificate, you can bypass that check by adding this to your settings:

Expand Down
Loading

0 comments on commit 6312903

Please sign in to comment.