Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

support custom scalars

+11 -3
+2 -1
src/index.ts
··· 34 34 ); 35 35 36 36 const tagTemplate = info.config.template || 'gql'; 37 + const scalars = info.config.scalars || {}; 37 38 38 39 const proxy = createBasicDecorator(info); 39 40 ··· 144 145 ] 145 146 } 146 147 147 - generateTypedDocumentNodes(schema.current, parts.join('/'), texts.join('\n')).then(() => { 148 + generateTypedDocumentNodes(schema.current, parts.join('/'), texts.join('\n'), scalars).then(() => { 148 149 nodes.forEach((node, i) => { 149 150 const queryText = texts[i] || ''; 150 151 const parsed = parse(queryText);
+9 -2
src/types/generate.ts
··· 6 6 import * as typescriptOperationsPlugin from '@graphql-codegen/typescript-operations' 7 7 import * as typedDocumentNodePlugin from '@graphql-codegen/typed-document-node' 8 8 9 - export const generateTypedDocumentNodes = async (schema: GraphQLSchema | null, outputFile: string, doc: string) => { 9 + export const generateTypedDocumentNodes = async (schema: GraphQLSchema | null, outputFile: string, doc: string, scalars: Record<string, unknown>) => { 10 10 if (!schema) return; 11 11 12 12 const config = { ··· 16 16 document: parse(doc), 17 17 }, 18 18 ], 19 - config: {}, 19 + config: { 20 + scalars, 21 + // nonOptionalTypename: true, 22 + // avoidOptionals, worth looking into 23 + enumsAsTypes: true, 24 + dedupeOperationSuffix: true, 25 + dedupeFragments: true, 26 + }, 20 27 // used by a plugin internally, although the 'typescript' plugin currently 21 28 // returns the string output, rather than writing to a file 22 29 filename: outputFile,