Skip to content

Emmet suggestions show up in JS/TS files when they should not #1358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sleeyax opened this issue May 11, 2025 · 1 comment
Open

Emmet suggestions show up in JS/TS files when they should not #1358

sleeyax opened this issue May 11, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sleeyax
Copy link

sleeyax commented May 11, 2025

What version of VS Code are you using?

v1.100.0

What version of Tailwind CSS IntelliSense are you using?

0.14.16

What version of Tailwind CSS are you using?

3.4.17 currently - but I experience this issue in other projects using v4 as well

What package manager are you using?

npm

What operating system are you using?

Arch Linux

Tailwind config

import { type Config } from "tailwindcss/types/config";
import { fontFamily } from "tailwindcss/defaultTheme";

export default {
  darkMode: ["class"],
  content: ["./src/**/*.tsx"],
  theme: {
    extend: {
      fontFamily: {
        sans: ["var(--font-sans)", ...fontFamily.sans],
      },
      colors: {
         // ...
      },
    },
  },
  plugins: [require("tailwindcss-animate")],
} satisfies Config;

VS Code settings

{
"tailwindCSS.experimental.classRegex": [
    ["cva\\(((?:[^()]|\\([^()]*\\))*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
    ["cn\\(((?:[^()]|\\([^()]*\\))*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
  ],
  "tailwindCSS.emmetCompletions": true,
}

Describe your issue

Install the extension with the settings above and open any typescript project. The completions are provided on typescript object properties:

Image

I've been having this issue for years now. The only thing that works is setting "tailwindCSS.emmetCompletions": false in settings JSON. If this can't be fixed I would suggest at least documenting this limitation.


This is the same issue as #228, which was closed but is still not fixed.

@thecrypticace thecrypticace self-assigned this May 13, 2025
@thecrypticace
Copy link
Contributor

I can reproduce this.

In JS contexts we use document symbols as a hint to stop from offering suggestions. In this case I'm api probably comes from an import — which is not considered a document symbol — so we don't pick it up as a possible prefix that we know to ignore.

Thoughts / ideas:

  • People can write things like MyComponent.flex or x-foo.flex and expect them to be expanded
  • There's no real way to differentiate the string api.order. from a theoretical api element with an order class and member access syntax.
  • Maybe a safelist of HTML elements could work if the text matches /^(?<element>[a-z]+)\./ — e.g. no capitals (so React/Vue components), no dashes (web components)
  • Feels annoying that we'd have to ship that but might be a reasonable solution
  • This solution immediately doesn't work if you write Api.order.getOrder() tho which could be a pattern some people use with globals, static member access, etc…

@thecrypticace thecrypticace added the bug Something isn't working label May 13, 2025
@thecrypticace thecrypticace changed the title Intellisesnse providing suggestions in the wrong place Emmet suggestions show up in JS/TS files when they should not May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants