relay-compiler-language-typescript icon indicating copy to clipboard operation
relay-compiler-language-typescript copied to clipboard

Generate GraphQL fragment files for VSCode GraphQL Extension fragment autocompletion

Open jasonkuhrt opened this issue 3 years ago • 2 comments

Currently there is no autocomplete when spreading a fragment reference because there are no graphql fragment files to configure GraphQL VSCode extension with.

How about this relay language plugin emit them?

More context:

  • https://github.com/Quramy/ts-graphql-plugin/issues/360
  • https://rikki.dev/vscode-graphql-lsp-0-3-0/#completion-for-implicit-fragments

jasonkuhrt avatar Feb 14 '21 00:02 jasonkuhrt

It looks like there are quite a few of these issues open:

https://github.com/relay-tools/relay-compiler-language-typescript/issues/157 https://github.com/relay-tools/relay-compiler-language-typescript/issues/205

What I did was not use the generated typescript types from relay, but instead used the types from @graphql-codegen/typescript and @graphql-codegen/typescript-operations which does generate fragment data properly.

angel-discover avatar May 10 '21 21:05 angel-discover

The GraphQL VSCode extension supports inline fragments. I created a .graphqlrc in the root of my app with the following content, and autocompleting fragment references works.

{
  "schema": ["../backend/schema.graphql", "./src/schemaExtensions.graphql"],
  "documents": "./src/**/*.tsx"
}

jakobvase avatar Dec 08 '21 07:12 jakobvase