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

Commit 6312903

Browse files
committed
fix: upgrade language server, fix major issues
This LSP server update should fix all issues with `schema` config for both SDL files and urls.
1 parent 6e7f102 commit 6312903

File tree

4 files changed

+200
-139
lines changed

4 files changed

+200
-139
lines changed

.vscode/extensions.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
// See http://go.microsoft.com/fwlink/?LinkId=827846
3-
// for the documentation about the extensions.json format
4-
"recommendations": [
5-
"eg2.tslint"
6-
]
7-
}
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": []
5+
}

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# VSCode GraphQL
22

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

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

130128
## Frequently Asked Questions
131129

132-
### Go to definition is using `generated_schema.graphql`, not my schema source files
130+
### Go to definition is not working for my URL
131+
132+
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()`
133133

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

138136
```json
139-
"vscode-graphql.useSchemaFileDefinitions": true,
137+
"vscode-graphql.cacheSchemaFileForLookup": true,
140138
```
141139

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

144142
```yml
143+
schema: http://myschema.com/graphql
144+
extensions:
145+
languageService:
146+
cacheSchemaFileForLookup: true
145147
projects:
146148
project1:
147149
schema: project1/schema/schema.graphql
148150
documents: project1/queries/**/*.{graphql,tsx,jsx,ts,js}
149151
extensions:
150152
languageService:
151-
useSchemaFileDefinitions: true
153+
cacheSchemaFileForLookup: false
154+
152155
project2:
153156
schema: https://api.spacex.land/graphql/
154157
documents: project2/queries.graphql
155158
extensions:
156159
endpoints:
157160
default:
158161
url: https://api.spacex.land/graphql/
162+
languageService:
163+
# Do project configs inherit parent config?
164+
cacheSchemaFileForLookup: true
159165
```
160166
161167
### The extension fails with errors about duplicate types
@@ -189,9 +195,22 @@ So you'll need to add something like this to your global vscode settings:
189195

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

192-
The config example above shows how to configure endpoints.
198+
This would look like:
199+
200+
```ts
201+
export default {
202+
schema: "mschema.graphql",
203+
extension: {
204+
endpoints: {
205+
default: "http://localhost:9000",
206+
},
207+
},
208+
}
209+
```
210+
211+
(see above for per-project examples)
193212

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

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

0 commit comments

Comments
 (0)