Skip to content

[Bug]: VS Code Autocompletion for Tailwind's Generated CSS Variables Doesn't Account for Prefixes #1595

Description

@ITenthusiasm

What version of VS Code are you using?

1.96.2 (Universal)

What version of Tailwind CSS IntelliSense are you using?

0.14.29

What version of Tailwind CSS are you using?

4.3.0

What package manager are you using?

npm

What operating system are you using?

MacOS

Tailwind CSS Stylesheet (v4) or config file (v3)

tailwind.css
@layer theme, base, components, utilities;
@import "tailwindcss/theme.css" layer(theme) prefix(tw);
@import "tailwindcss/utilities.css" layer(utilities) prefix(tw);

@theme {
  --color-mine: rebeccapurple;
}

@layer components {
  div.invalid-intellisense {
    color: var(--color-red-500);
  }

  div.missing-intellisense {
    color: var(--tw-color-red-500);
  }

  div.invalid-intellisense-custom-var {
    color: var(--color-mine);
  }

  div.missing-intellisense-custom-var {
    color: var(--tw-color-mine);
  }
}

VS Code settings

N/A

Reproduction URL

https://github.com/ITenthusiasm/tailwind-vscode-issue-prefixed-css-vars

Describe your issue

According to the documentation, using a Tailwind Prefix in tailwindcss@4 causes all CSS variables configured by Tailwind to become prefixed as well. So, if tw is the prefix, then all CSS variables configured in Tailwind will start with --tw-*.

Unfortunately, the Tailwind VS Code IntelliSense does not take this into account. Instead, it provides IntelliSense for the unprefixed CSS Variables (which don't actually exist). In the example CSS provided above, the --color-* vars receive IntelliSense even though they don't exist, and the --tw-color-* vars don't receive IntelliSense even though they do exist.

The expectation would be that the extension suggests --tw-spacing, --tw-color-red-500, etc. instead of --spacing, --color-red-500 and the like.

Relates to #1209. (Thanks for fulfilling that one, btw! Still incredible to see IntelliSense for CSS Vars even with the bug! Standalone VS Code doesn't really have a nice way to support this yet for pure CSS, making Tailwind very attractive here when this is working rightly.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions