gpt4 book ai didi

visual-studio-code - 有一种方法可以在 vscode 中的 ` `(重音符)内语法高亮显示 GraphQl TypeDef 吗?

转载 作者:行者123 更新时间:2023-12-05 08:39:13 27 4
gpt4 key购买 nike

我想语法高亮 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!
}
`;

最佳答案

使用String.raw将 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!
}
`

关于visual-studio-code - 有一种方法可以在 vscode 中的 ` `(重音符)内语法高亮显示 GraphQl TypeDef 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60643685/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com