Visual studio code 有一种方法可以在vscode中语法突出显示“`”(严重重音)内的GraphQl TypeDef?
我想用语法突出显示typeDef中的代码。有可能吗 这个有分机吗?或者我必须用另一种方式编码typeDefVisual 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
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您也可以使用hackconst gql=String.raw
来获得语法高亮显示,而无需下载graphql标记
或类似的包件→ 谢谢这正是我需要的。我有这个扩展名,但我没有正确地重新配置。@Daniocnha您也可以使用hackconst gql=String.raw
来获得语法高亮显示,而无需下载graphql标记
或类似的包件→