Skip to content

Commit

Permalink
docs(react-vue): add mention of graphqlsp to the docs (#9773)
Browse files Browse the repository at this point in the history
Co-authored-by: Laurin Quast <[email protected]>
  • Loading branch information
JoviDeCroock and n1ru4l authored Dec 1, 2023
1 parent 71c92d5 commit 967a34d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Binary file added website/public/assets/docs/graphqlsp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 33 additions & 3 deletions website/src/pages/docs/guides/react-vue.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,43 @@ From simple Queries to more advanced Fragments-based ones, GraphQL Code Generato

**What's next?**

To get the best GraphQL development experience, we recommend installing the [GraphQL VSCode extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql) to get:
To get the best GraphQL development experience, we recommend installing the [GraphQLSP](https://github.com/0no-co/GraphQLSP) package to get:

- syntax highlighting
- autocomplete suggestions
- validation against schema
- snippets
- go to definition for fragments and input types
- quick-info on hover

![GraphQLSP](/assets/docs/graphqlsp.png)

`GraphQLSP`s a TypeScript LSP plugin for GraphQL, to get it working, we need to add the following to your `tsconfig.json`
after installing the package (`npm i -D @0no-co/graphqlsp`):

```json filename="tsconfig.json"
{
"compilerOptions": {
"plugins": [
{
"name": "@0no-co/graphqlsp",
"schema": "./schema.graphql",
"disableTypegen": true,
"templateIsCallExpression": true,
"template": "graphql"
}
]
}
}
```

Last but not least you need to ensure that when you're using `VSCode` that the workspace version of TS is used, the following
config will make a prompt appear to switch it when visiting a TS file

```json filename=".vscode/settings.json"
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
```

Also, make sure to follow GraphQL best practices by using [`graphql-eslint`](https://github.com/B2o5T/graphql-eslint) and the [ESLint VSCode extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) to visualize errors and warnings inlined in your code correctly.

Expand Down

0 comments on commit 967a34d

Please sign in to comment.