Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 有一种方法可以在vscode中语法突出显示“`”(严重重音)内的GraphQl TypeDef?_Visual Studio Code_Graphql - Fatal编程技术网

Visual studio code 有一种方法可以在vscode中语法突出显示“`”(严重重音)内的GraphQl TypeDef?

Visual studio code 有一种方法可以在vscode中语法突出显示“`”(严重重音)内的GraphQl TypeDef?,visual-studio-code,graphql,Visual Studio Code,Graphql,我想用语法突出显示typeDef中的代码。有可能吗 这个有分机吗?或者我必须用另一种方式编码typeDef export const typeDef = ` type User { _id: ID! email: String! password: String createdEvents: [Event!] } type AuthData { userId: ID! token: String! tokenExpiration: Int! } inpu

我想用语法突出显示typeDef中的代码。有可能吗

这个有分机吗?或者我必须用另一种方式编码typeDef

export const typeDef = `
 type User {
  _id: ID!
  email: String!
  password: String
  createdEvents: [Event!]
 }

 type AuthData {
  userId: ID!
  token: String!
  tokenExpiration: Int!
 }

 input UserInput {
  email: String!
  password: String!
 }
`;
假设您正在使用,则需要使用
graphql标记中的
gql
标记

const gql = require('graphql-tag')

const typeDefs = gql`
  type User { ... }
`
标记解析提供的字符串并返回一个
DocumentNode
对象,该对象应传递给
makeExecutableSchema
ApolloServer
构造函数。在客户端,ApolloClient使用的查询也应该是
DocumentNode
对象,并且应该以相同的方式包装

扩展能够检测标记的使用情况并相应地应用语法高亮显示。

假设您正在使用,则需要使用
graphql标记中的
gql
标记

const gql = require('graphql-tag')

const typeDefs = gql`
  type User { ... }
`
标记解析提供的字符串并返回一个
DocumentNode
对象,该对象应传递给
makeExecutableSchema
ApolloServer
构造函数。在客户端,ApolloClient使用的查询也应该是
DocumentNode
对象,并且应该以相同的方式包装

扩展能够检测标记的使用情况,并相应地应用语法高亮显示。

用于将VSCode诱使为语法高亮显示GraphQL。它也适用于其他语言

export const gql = String.raw

export const typeDef = gql`
  type User {
    _id: ID!
    email: String!
    password: String
    createdEvents: [Event!]
  }

  type AuthData {
    userId: ID!
    token: String!
    tokenExpiration: Int!
  }

  input UserInput {
    email: String!
    password: String!
  }
`
用于将VSCode诱使为语法高亮显示GraphQL。它也适用于其他语言

export const gql = String.raw

export const typeDef = gql`
  type User {
    _id: ID!
    email: String!
    password: String
    createdEvents: [Event!]
  }

  type AuthData {
    userId: ID!
    token: String!
    tokenExpiration: Int!
  }

  input UserInput {
    email: String!
    password: String!
  }
`

谢谢这正是我需要的。我有这个扩展名,但我没有正确地重新配置。@Daniocnha您也可以使用hack
const gql=String.raw
来获得语法高亮显示,而无需下载
graphql标记
或类似的包件→ 谢谢这正是我需要的。我有这个扩展名,但我没有正确地重新配置。@Daniocnha您也可以使用hack
const gql=String.raw
来获得语法高亮显示,而无需下载
graphql标记
或类似的包件→