如何在 vscode 片段中使用 $ 作为文本?

How can I use $ as text in vscode snippets?

当我尝试为 openapi3 创建代码段时出现问题。

{
  "openApi3-MultipleExamples": {
    "prefix": "openApi3-MultipleExamples",
    "body": [
      "MultipleExamples:",
      "  description: A user object.",
      "  content:",
      "    application/json:",
      "      schema:",
      "        $ref: '#/components/schemas/User'   # Reference to an object",
      "      examples:",
      "        Jessica:",
      "          value:",
      "            id: 10",
      "            name: Jessica Smith",
      "        Ron:",
      "          value:",
      "            id: 20",
      "            name: Ron Stewart"
    ],
    "description": "Multiple examples in response bodies"
  }
}

在此示例中,$ref 将被创建为仅 ref,因为它看起来像一个变量。如何在 vscode 片段中使用 $ 作为文本?

你必须逃离$

"\$ref: '#/components/schemas/User'   # Reference to an object"