tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Signature
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJixaztCRBK7hj4Ov3rIwAADLwIAFzpNG7hB/qmH9qBDZ7fnd4N
XiPOd/sqGW/iD3htqaKH0Bz1XilUmcnuVAl2YeAplo2I+OzLgK8KB4SRUYPPd1u8
wQ73U6XWjMJ0JZg8zS1pjiRptbVEZt1ykkqneW7bAx5ay9blhDyJ/O3di16JuWy4
RD1ZBTDU4mqomzejSxMZIWYRnsXE9eF2DmcpIcbHnsUXWLa3Ji8Y7EZy7/u2W2b3
3TSE3sKn65LNLxLNTQx16rffe8UgVWICnIa7K4txFAntsL7h53P5SJrB5KR9LV9a
RZSNr6ZZNrHFuHGxgTOIQQpWs2bCcoV13TbKerE/6MrA0mEzlrk+rRKG7F2b8/g=
=k5Aj
-----END PGP SIGNATURE-----
diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts
index 299f777cd3952b8bbe3e3d0b4c239e354101d340..b0a4196195b9ffc81ec093c325319bb1933704e1 100644
--- a/packages/tailwindcss-language-service/src/util/find.ts
+++ b/packages/tailwindcss-language-service/src/util/find.ts
@@ -11,6 +11,7 @@ import { getLanguageBoundaries } from './getLanguageBoundaries'
import { resolveRange } from './resolveRange'
import dlv from 'dlv'
import { createMultiRegexp } from './createMultiRegexp'
+import { rangesEqual } from './rangesEqual'
export function findAll(re: RegExp, str: string): RegExpMatchArray[] {
let match: RegExpMatchArray
@@ -277,6 +278,13 @@
return result
}
+function dedupeClassLists(classLists: DocumentClassList[]): DocumentClassList[] {
+ return classLists.filter(
+ (classList, classListIndex) =>
+ classListIndex === classLists.findIndex((c) => rangesEqual(c.range, classList.range))
+ )
+}
+
export async function findClassListsInRange(
state: State,
doc: TextDocument,
@@ -291,7 +299,10 @@ } else {
classLists = await findClassListsInHtmlRange(state, doc, range)
}
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
-import { isHtmlContext } from './html'
+export async function findClassNamesInDocument(
+ ...classLists,
+ ...(includeCustom ? await findCustomClassLists(state, doc, range) : []),
+ ])
}
export async function findClassListsInDocument(
@@ -306,30 +317,32 @@ let boundaries = getLanguageBoundaries(state, doc)
if (!boundaries) return []
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
-import { resolveRange } from './resolveRange'
+export function findClassListsInCssRange(doc: TextDocument, range?: Range): DocumentClassList[] {
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
-import type { TextDocument, Range, Position } from 'vscode-languageserver'
+ const text = doc.getText(range)
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
+ const matches = findAll(
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
-import { createMultiRegexp } from './createMultiRegexp'
+ /(@apply\s+)(?<classList>[^;}]+?)(?<important>\s*!important)?\s*[;}]/g,
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
-
+ text
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
-export function findAll(re: RegExp, str: string): RegExpMatchArray[] {
+ )
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
- let match: RegExpMatchArray
+ const globalStart: Position = range ? range.start : { line: 0, character: 0 }
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
+import { flatten } from './array'
import type { TextDocument, Range, Position } from 'vscode-languageserver'
-import { isJsxContext } from './js'
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
-import type { TextDocument, Range, Position } from 'vscode-languageserver'
import { flatten } from './array'
+import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
- matches.push({ ...match })
+ const end = indexToPosition(text, match.index + match[1].length + match.groups.classList.length)
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
- }
+ return {
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
- return matches
+ classList: match.groups.classList,
+ )
}
export function findHelperFunctionsInDocument(