Closed tianyingchun closed 1 month ago
i found the cause of this issue
"plugins": [
{
"name": "next"
},
{
"name": "@0no-co/graphqlsp",
"schemas": [
{
// if i setup `name` to `shop-api` it can not works, the `name` setup to "@0no-co/graphqlsp", it works
"name": "shop-api",
"schema": "http://localhost:7001/shop-api",
"tadaOutputLocation": "./src/common/graphql-env.d.ts"
}
]
}
// if i setup name
to shop-api
it can not works, the name
setup to "@0no-co/graphqlsp", it works
Just to point this out, did you run gql.tada doctor
by any chance? It should catch these kinds of issues, but we haven't really made the warnings on running it when you change these files more obvious
yes i have tried gql.tada doctor
it works fine, i found sometimes
sometimes it works, it caused by "typescript.enablePromptUseWorkspaceTsdk": true,
?
Is it possible that vscode configuration does not work sometimes?
i think i found the root cause, please see my tsconfig.json
{
"name": "admin-api",
"schema": "http://localhost:7001/shop-api",
"tadaOutputLocation": "./src/graphql-env1.d.ts"
}
i have configd "schema" to online http http://localhost:7001/shop-api
, if i have generated ./src/graphql-env1.d.ts
and stop graphql server http://localhost:7001/shop-api
for now reload vscode IDE the auto intelligent
can not works correct, the intelligent feature disappeared
and when i restart graphql
server to make sure http://localhost:7001/shop-api
can be access ok, then relunch vscode
IDE, it works
but i think because i have generated a correct graphql-env1.d.ts
file, it should works correct even if i have closed graphql
server http://localhost:7001/shop-api
?
because in the most time we may don't need to keep our graphql server
online, because of we have generated an latest correct version graphql-env1.d.ts
, the graphql(....)
should works correctly for auto intelligent
feature what do you think?
That's working as intended.
If you shut down your API the type inference will still work as long as that typings file is generated but the GraphQLSP plugin (i.e. the editor support) will stop being able to retrieve the schema.
There's more details about this in the docs. Specifically, you may want to look into either saving an SDL schema file or making your server output an SDL schema file if you don't want to keep the server running
If you don't have an easy way to let your API output a local .graphql
file, you can use the CLI to generate one: https://gql-tada.0no.co/get-started/workflows
Thank you so much for clarifying the confusion
Describe the bug
in vscode it can not auto intelligent give us tips for fields
Reproduction
No response
gql.tada version
Validations