graphql / vscode-graphql

MIGRATED: VSCode GraphQL extension (autocompletion, go-to definition, syntax highlighting)
https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql
MIT License
557 stars 71 forks source link

Is this working with server side schema splitted in multiple ts files with gql tags ? #236

Closed olup closed 3 years ago

olup commented 3 years ago

Actual Behavior

Nothing works, plus syntax error on closing bracket for type definition ("expecting name, saw }")

Expected Behavior

I am not even sure server side is in this plugin's scope... but nice behaviour would be autocomplete from scalar types plus types defined in different schema's pieces. Maybe I have a misconfigured graphql-config. Have been trying globs on schema but I guess it's not supported yet. Should I use the server's url ?

Steps to Reproduce the Problem Or Description

Set Up an apollo based graphql server with multiple typedefs files in ts format exporting gql tagged graphql pieces of schema

acao commented 3 years ago

yes it has autocomplete for all those things, you just need different configurations, and there is a known bug with this approach

olup commented 3 years ago

Is there configuration examples that I could use ?

Le mer. 7 oct. 2020 à 20:06, Rikki Schulte notifications@github.com a écrit :

yes it has autocomplete for all those things, you just need different configurations, and there is a known bug with this approach

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/graphql/vscode-graphql/issues/236#issuecomment-705104114, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJFT5CVTITLRQ2OPLDH4D3SJSUYZANCNFSM4SECITYQ .

acao commented 3 years ago

it currently only works when schema files are identified individually because of a bug, so you'll have to use:

schema: 
  - src/schema/file.ts
  - src/schema/anotherFile.ts
extensions:
  languageService:
    useSchemaFileDefinitions: true

and that last option to tell it to use files for schema definitions, rather than the generated SDL by default.

the other bug you might see is that the offset doesn't work for in-TS definitions, so when you jump to an SDL definition in a TS or JS file, it might not scroll to the proper line. its a regression caused by jsdoc comments it seems. very hard to test all the different edge cases!

olup commented 3 years ago

I guess. A big thanks for this anyway. I went back to code-first approach with nexus on this one, but will try your setup as soon as I can.

On Wed, Oct 7, 2020 at 8:21 PM Rikki Schulte notifications@github.com wrote:

it currently only works when schema files are identified individually because of a bug, so you'll have to use:

schema:

  • src/schema/file.ts
  • src/schema/anotherFile.tsextensions: languageService: useSchemaFileDefinitions: true

and that last option to tell it to use files for schema definitions, rather than the generated SDL by default.

the other bug you might see is that the offset doesn't work for in-TS definitions, so when you jump to an SDL definition in a TS or JS file, it might not scroll to the proper line. its a regression caused by jsdoc comments it seems. very hard to test all the different edge cases!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/graphql/vscode-graphql/issues/236#issuecomment-705112407, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJFT5G7TEOILWHKAQO2PEDSJSWTBANCNFSM4SECITYQ .