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

Commit 4c6820f

Browse files
committed
add legacy graphql config information
For IntelliJ users and otherwise We can't enable this by default in the language server because some of the features were intentionally deprecated because of their resource intensiveness. For example, nested config files. `graphqlConfig.loadSchema()` is invoked on most editor operations, so the config is re-fetched frequently.
1 parent 578997a commit 4c6820f

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ the file needs to be placed at the project root by default, but you can configur
6868

6969
Previous versions of this extension support `graphql-config@2` format, which follows [legacy configuration patterns](https://github.com/kamilkisiela/graphql-config/tree/legacy#usage)
7070

71-
To support language features like "go-to definition" across multiple files, please include `documents` key in the graphql-config default or /per project (this was `include` in 2.0).
71+
If you need legacy support for `.graphqlconfig` files or older graphql-config formats, see [this FAQ answer](#legacy). If you are missing legacy `graphql-config` features, please consult [the `graphql-config` repository](https://github.com/kamilkisiela/graphql-config).
72+
73+
To support language features like "go-to definition" across multiple files, please include `documents` key in the `graphql-config` file default or per-project (this was `include` in 2.0).
7274

7375
## Configuration Examples
7476

@@ -127,6 +129,16 @@ Notice that `documents` key supports glob pattern and hence `["**/*.graphql"]` i
127129

128130
## Frequently Asked Questions
129131

132+
<span id="legacy" />
133+
134+
### I can't load `.graphqlconfig` files anymore
135+
136+
If you need to use a legacy config file, then you just need to enable legacy mode for `graphql-config`:
137+
138+
```
139+
"graphql-config.load.legacy": true
140+
```
141+
130142
### Go to definition is not working for my URL
131143

132144
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()`
@@ -245,9 +257,9 @@ which would search for `./config/.acmerc`, `.config/.acmerc.js`, `.config/acme.c
245257

246258
If you have multiple projects, you need to define one top-level config that defines all project configs using `projects`
247259

248-
### How do I highlight an embedded graphql string
260+
### How do I highlight an embedded graphql string?
249261

250-
If you aren't using a template tag function, and just want to use a plain string, you can use an inline `#graphql` comment:
262+
If you aren't using a template tag function such as `gql` or `graphql`, and just want to use a plain string, you can use an inline `#graphql` comment:
251263

252264
```ts
253265
const myQuery = `#graphql
@@ -259,19 +271,27 @@ const myQuery = `#graphql
259271

260272
or
261273

274+
262275
```ts
263-
const myQuery = `
264-
#graphql
276+
const myQuery =
277+
/* GraphiQL /
278+
`
265279
query {
266280
something
267281
}
268282
`
269283
```
284+
285+
### Template literal expressions dont work with `Execute Query`
286+
287+
Experimental support for template literal expressions ala `${}` has been added for language support, which just add an empty newline behind the scenes. It does not yet work for `Execute Query` codelans.
288+
289+
290+
270291

271292
## Known Issues
272293

273-
- template replacement inside a graphql string [will break graphql parsing](https://github.com/graphql/vscode-graphql/issues/137). If you want to help improve partial parsing support, you can contribute to the parser efforts in [`graphql`](https://github.com/graphql/graphql-js) reference implementation. You can now re-use fragments across your project source, if you include the files in `documents`.
274-
- the output channel occasionally shows "definition not found" when you first start the language service, but once the definition cache is built for each project, definition lookup will work. so if a "peek definition" fails when you first start, just try clicking it again.
294+
- the output channel occasionally shows "definition not found" when you first start the language service, but once the definition cache is built for each project, definition lookup will work. so if a "peek definition" fails when you first start the editor or when you first install the extension, just try the definition lookup again.
275295

276296
## Development
277297

0 commit comments

Comments
 (0)