VScode Tailwind CSS Intellisense插件只有在类名前加空格时才起作用

inn6fuwd  于 2023-02-06  发布在  Vscode
关注(0)|答案(1)|浏览(393)

我按照tailwind installation guide进行下一步
下面是我的tailwind.config.js文件

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./app/**/*.{js,ts,jsx,tsx}",
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

但是智能感知只有在类名以空格开头时才起作用。

下面是我的vscode settings.json文件。我认为可能是某些东西导致了这个bug,但是注解掉整个文件对解决这个问题没有任何作用。

{
  "color-highlight.markerType": "dot-before",
  "explorer.confirmDelete": false,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "autoprefixer.formatOnSave": true,
  "autoprefixer.browsers": [
    "last 4 versions",
    "ie >= 9",
    "> 5%"
  ],
  "liveServer.settings.donotShowInfoMsg": true,
  "editor.detectIndentation": false,
  "editor.tabSize": 2,
  "liveServer.settings.donotVerifyTags": true,
  "emmet.includeLanguages": {
    "javascript": "javascriptreact"
  },
  "scss.format.newlineBetweenRules": false,
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "dbaeumer.vscode-eslint",
  "vetur.format.defaultFormatter.js": "prettier-eslint",
  "workbench.settings.openDefaultKeybindings": true,
  "[typescriptreact]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "window.zoomLevel": 1,
}
5us2dqdw

5us2dqdw1#

不久前我确实遇到过这个问题(tailwindcss-intellisense #495)。这是由于VS代码处理字符串上下文的方式。到目前为止,这对我来说仍然是一个偶然的问题,但我可以忍受它。尽管如此,在.vscode/settings.json中添加以下内容应该可以解决这个问题。

{
  "editor.quickSuggestions": {
    "strings": true
  }
}

相关问题