-
Notifications
You must be signed in to change notification settings - Fork 203
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
TailwindCSS IntelliSense shows suggestions for any string after using the experimental classRegex #1086
Comments
Might be the issue is outside of classRegex. If you type issue-demo.webm |
Yeah and it also happens for whenever you try to enter a string value by |
😱 wow. Issue seems to disappear once you have a function in the file but this is still bizarre. Gonna look into this tomorrow. @onyedikachi23 I cannot reproduce this. Can you provide an example of a file you see this in? I took the settings you gave and put them in a project and I am not seeing any issues here: Screen.Recording.2025-02-11.at.20.12.45.mov |
Thank you. I'm sure I had this more than in just plain files (without a function). But I don't recall where. When I hit such a case I can give an example. |
Ah right, it's for emmet support 🤦♂ Probably shouldn't suggest them tho if emmet is disabled in JS/TS/JSX/TSX files. Will look at doing that. |
Does the plugin not work on AST-Basis? Then the context should be clear where its appropriate or not to provide the suggest. Emmet does not seem to work in the context. I can not expand what is proposed by the suggestion. It does not seem to depend on functions in my case: tw-plugin-bug.webm |
No, it does not. The language server protocol is entirely driven by text documents. It doesn't have the concept of an AST at all. So its up to each language server to parse text however it sees fit. Working on a purely AST basis would mean that we'd have to implement and/or bundle separate parsers for every language we support. We technically do a very limited form of lexing to look for interesting tokens turn that into "language boundaries" that identify what language is active at a given point in the document but that's about it. I do have plans to improve this somewhat but the general idea won't change.
This was the point of my second sentence. You can actually enable emmet in that context in your VSCode settings (its not by default) but if it's not enabled (assuming we can detect this) we should disable these suggestions. |
What version of VS Code are you using?
Version: 1.95.2
OS: Linux x64 6.8.0-48-generic
What version of Tailwind CSS IntelliSense are you using?
v0.12.12
What version of Tailwind CSS are you using?
[email protected]
│ └── [email protected] deduped
└── [email protected]
What package manager are you using?
npm
What operating system are you using?
Ubuntu 24.04 LTS
Tailwind config
VS Code settings
Reproduction URL
Can't provide at the moment, but I'm working on a Vite + React + TypeScript project with TailwindCSS for styling. See below for more info 👇
Describe your issue
I was trying to make the IntelliSense show suggestions for variable names outside the
className
prop. So, I got a solution from this answer on StackOverflow: How can I enable tailwind intelliSense outside of "className"?.However, typing any string specifiers (double and single quotes and template literals) -
""
,''
,` `
, starts poping tailwind class names. This is a headache because it blocks suggestions I actually need to see at the moment, and it could slow down suggestions popup on larger codebase.The text was updated successfully, but these errors were encountered: