tailwindlabs / tailwindcss-intellisense

Intelligent Tailwind CSS tooling for Visual Studio Code
2.75k stars 183 forks source link

Intellisense not firing for the first className to be typed, if className="" has been populated by... intellisense #880

Closed GBrachetta closed 7 months ago

GBrachetta commented 7 months ago

What version of VS Code are you using?

v1.84.2

What version of Tailwind CSS IntelliSense are you using?

v0.10.3

What version of Tailwind CSS are you using?

v3.3.0

What package manager are you using?

npm

What operating system are you using?

macOS

Tailwind config

/** @type {import('tailwindcss').Config} */
module.exports = {
  darkMode: ["class"],
  content: [
    "./pages/**/*.{ts,tsx}",
    "./components/**/*.{ts,tsx}",
    "./app/**/*.{ts,tsx}",
    "./src/**/*.{ts,tsx}",
  ],
  theme: {
        ...
    },
    extend: {
        ...
    },
  },
  plugins: [require("tailwindcss-animate")],
};

Describe your issue

When using Intellisense to autocomplete className="", Tailwindcss intellisense only fires after having written the first className (it then works flawlessly) but never fires for the first one. The only way to make it run is by pressing ctrl+spacebar.

This issue doesn't occur if className=" is typed rather than auto-completed.

https://github.com/tailwindlabs/tailwindcss-intellisense/assets/57924268/0332c3a0-ddac-4354-9678-90a4d323a226

thecrypticace commented 7 months ago

Hey, this is a limitation of VSCode. We don't have a way to automatically trigger our completions in this case (the API just doesn't exist unfortunately). You can however instruct VSCode to do so manually by using Ctrl+Space (the Trigger Suggest command).

This is also why in some cases a space has to be inserted to trigger completions — see https://github.com/tailwindlabs/tailwindcss-intellisense/issues/449