You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Great Syntax Highlighting**: Now, your gql files will look as beautiful as your other code with an awesome syntax highlighter which works not just with your schema files, but also within your Javascript/Typescript files.
19
21
***Linting**: This plugin uses a similar method as used by the [Codemirror graphql](https://github.com/graphql/codemirror-graphql) project for linting.
20
22
***Snippets**: Some commonly used snippets are provided which help while writing mutations and queries, such as definiting types, interfaces and input types.
21
-
* Autocomplete: Uses the [@playlyfe/gql](npmjs.org/package/@playlyfe/gql) library to read your whole graphql schema definitions and provide you with autocomplete support while writing & editing your `.gql` files.
23
+
***Autocomplete**: Uses the [@playlyfe/gql](npmjs.org/package/@playlyfe/gql) library to read your whole graphql schema definitions and provide you with autocomplete support while writing & editing your `.gql` files.
22
24
23
25
## Setting it Up
24
26
1. Ensure that you have the [@playlyfe/gql](npmjs.org/package/@playlyfe/gql) library installed and available to this plugin. If you've installed the library in a folder other than the workspace root, then add the path to the node_modules directory as a setting:
25
-
```json
26
-
{
27
-
"graphqlForVSCode.nodePath": "ui/node_modules"
28
-
}
29
-
```
27
+
```json
28
+
{
29
+
"graphqlForVSCode.nodePath": "ui/node_modules"
30
+
}
31
+
```
30
32
31
33
2. Ensure you have [watchman](https://facebook.github.io/watchman/docs/install.html) installed and available in your path. Watchman watches your gql files and provides up-to-date suggestions. For users on Windows, get the latest build mentioned in [this issue](https://github.com/facebook/watchman/issues/19) and add the location of `watchman.exe` to your environment path.
32
34
35
+
3. Create a .gqlconfig file (required by the `@playlyfe/gql` package). Example:
36
+
The .gqlconfig is a JSON file with only one required key: schema.files which is the path to your *.gql files relative to your workspace root.
37
+
```json
38
+
/* .gqlconfig */
39
+
{
40
+
"schema": {
41
+
"files": "schemas/**/*.gql"
42
+
}
43
+
}
44
+
```
45
+
You can use the string `files: "**/*.gql"` instead if you want to find any `.gql` file recursively in the workspace dir.
46
+
47
+
33
48
## Future Plans
34
49
* Improved Linting: Since graphql schemas can be written in multiple .gql files, so cross-file linting should be available. I'm not sure of the implementation as of now though.
0 commit comments