There is a way to syntax highlight GraphQl TypeDef inside ` ` (grave accent) in vscode?

后端 未结 1 1255
北荒
北荒 2021-01-28 10:41

I Want to syntax highlight the code inside typeDef. It is possible?

There is a extension for this? Or I have to code the typeDef other way?

export const          


        
1条回答
  •  鱼传尺愫
    2021-01-28 11:21

    Assuming you're using the right extension, you need to use the gql tag from graphql-tag.

    const gql = require('graphql-tag')
    
    const typeDefs = gql`
      type User { ... }
    `
    

    The tag parses the provided string and returns a DocumentNode object, which is what should be passed to makeExecutableSchema or the ApolloServer constructor. On the client side, the queries used by ApolloClient are also expected to be DocumentNode objects and should be wrapped the same way.

    The extension is able to detect usage of the tag and apply syntax highlighting accordingly.

    0 讨论(0)
提交回复
热议问题