graphql - 如何设置graphql-config?
问题描述
我正在尝试graphql-config
在 VSCode 中使用扩展,但我无法让它工作。我的语法改变了颜色schema.graphql
,但是当我将鼠标悬停在类型定义上时,我什么也没得到,我不能使用“转到定义”等等。我.graphqlrc.yml
的与schema.graphql
. 这是我的文件夹结构:
gql-config
| .graphqlrc.yml
| package-lock.json
| package.json
| schema.graphql
|____node_modules
| ...
.graphqlrc.yml
:
schema: 'schema.graphql'
documents: 'schema.graphql'
schema.graphql
:
type User {
id: Int!
name: String!
posts: [Post!]!
}
type Post {
id: Int!
content: String!
postedBy: User!
}
package.json
:
"name": "gql-config",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"license": "MIT",
"dependencies": {
"graphql": "^15.7.2",
"graphql-config": "^4.1.0"
}
}
我也试过
.graphqlrc.yml
:
schema: './schema.graphql'
documents: './schema.graphql'
和
.graphqlrc.yml
:
schema: '../schema.graphql'
documents: '../schema.graphql'
我在网上找到的示例要么不显示项目文件夹结构(官方文档站点),要么当我将它们从 Github 克隆到 VSCode 时它们不起作用(比如这个 repo)。我在全球安装了来自 GraphQL Foundation 的 GraphQL 扩展 v0.3.18。
解决方案
推荐阅读
- algorithm - 两个和问题 - 有两个数组和突变
- svelte - 为使用 isActive 路由精确路径?
- vue.js - 带有操作按钮列的 v-data-table 中的重复单击事件
- r - 如何访问R中for循环中的excel文件列?
- java - Cannot resolve method 'parse' in 'DockerImageName' when using Testcontainers and gradle in JUnit5
- c++ - 如何在此 OpenMP 求和示例中删除依赖项
- android - 等待设备时出错:AVD Pixel_2_API_30 的模拟器进程被杀死
- amazon-web-services - 无法在 Ubuntu 上安装 Galera Manger
- r - 编织到pdf时如何阻止rmarkdown生成“附加包”
- c - 为什么在 Linux 上调用 open() 会自动替换为 openat()?