Skip to content

Match custom class regex in Vue templates #1194

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

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/tailwindcss-language-service/src/util/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,11 @@ export async function findClassListsInRange(
range?: Range,
mode?: 'html' | 'css' | 'jsx',
includeCustom: boolean = true,
lang?: string,
): Promise<DocumentClassList[]> {
let classLists: DocumentClassList[] = []
if (mode === 'css') {
classLists = findClassListsInCssRange(state, doc, range)
classLists = findClassListsInCssRange(state, doc, range, lang)
} else if (mode === 'html' || mode === 'jsx') {
classLists = await findClassListsInHtmlRange(state, doc, mode, range)
}
Expand Down Expand Up @@ -448,11 +449,11 @@ export async function findClassNameAtPosition(
let groups = await Promise.all(
boundaries.map(async ({ type, range, lang }) => {
if (type === 'css') {
return findClassListsInCssRange(state, doc, range, lang)
return await findClassListsInRange(state, doc, range, 'css', true, lang)
}

if (type === 'html') {
return await findClassListsInHtmlRange(state, doc, 'html', range)
return await findClassListsInRange(state, doc, range, 'html')
}

if (type === 'js' || type === 'jsx') {
Expand Down
1 change: 1 addition & 0 deletions packages/vscode-tailwindcss/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Show warning when loading a config in v3 fails ([#1191](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1191))
- Better handle really long class lists in attributes and custom regexes ([#1192](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1192))
- Add support for Astro’s template literal attributes ([#1193](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1193))
- Match custom class regex in Vue templates ([#1194](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1194))

## 0.14.3

Expand Down