如何让 Tailwind Intellisense 处理 .html.erb 文件?

问题描述 投票:0回答:1

根据我从有类似问题的人那里找到的大多数帖子,我将以下内容放入我的 VScode settings.json 中:

"tailwindCSS.includeLanguages": {
    "javascript": "javascript",
    "html": "html",
    "erb": "html"
  },
  "tailwindCSS.emmetCompletions": true,
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "tailwindCSS.experimental.classRegex": [
    "\\bclass:\\s*'([^']*)'",
    "\\bclass:\\s*\"([^\"]*)\""
  ]

然而,Intellisense 仍然不会按照应有的方式自动完成类名。如果有人能够发现任何冲突,我看不到下面的整个 settings.json 内容。仅供参考,当我将 VScode 语言更改为 html Intellisense 时,它会按预期工作。

{
    "workbench.colorTheme": "Default Dark+",
    "editor.tabSize": 2,
    "git.autofetch": true,
    "workbench.startupEditor": "none",
    "diffEditor.ignoreTrimWhitespace": false,
    "github.copilot.enable": {
        "*": true,
        "plaintext": false,
        "markdown": true,
        "scminput": false
    },
    "emmet.includeLanguages": {
        "html.erb": "html"//,
        // "erb": "html",
        // "*erb": "html"
    },
    "rubyLsp.rubyVersionManager": "rvm",
    "[html.erb]": {},
    "window.zoomLevel": 1,
    "tailwindCSS.includeLanguages": {
        "javascript": "javascript",
        "html": "html",
        "erb": "html"
      },
      "tailwindCSS.emmetCompletions": true,
      "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
      },
      "tailwindCSS.experimental.classRegex": [
        "\\bclass:\\s*'([^']*)'",
        "\\bclass:\\s*\"([^\"]*)\""
      ]
}

蒂亚

visual-studio-code intellisense vscode-extensions
1个回答
0
投票

在 vscode settings.json 中添加此内容

  "files.associations": {
    "*.erb": "html"
  },
© www.soinside.com 2019 - 2024. All rights reserved.