1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts
index edcb59529869ed0bbdcf4f559a5fb160300f3e71..8dd6ad93cad17673a1eebac6de4e6ccea88a19d2 100644
--- a/packages/tailwindcss-language-service/src/util/find.ts
+++ b/packages/tailwindcss-language-service/src/util/find.ts
@@ -5,12 +5,10 @@ import { isCssContext, isCssDoc } from './css'
import { isHtmlContext } from './html'
import { isWithinRange } from './isWithinRange'
import { isJsxContext } from './js'
-import { flatten } from './array'
+import { dedupeByRange, flatten } from './array'
import { getClassAttributeLexer, getComputedClassAttributeLexer } from './lexers'
import { getLanguageBoundaries } from './getLanguageBoundaries'
import { resolveRange } from './resolveRange'
-import dlv from 'dlv'
-import { rangesEqual } from './rangesEqual'
import Regex from 'becke-ch--regex--s0-0-v1--base--pl--lib'
import { getTextWithoutComments } from './doc'
@@ -282,13 +280,6 @@
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,
@@ -302,7 +293,7 @@ classLists = findClassListsInCssRange(doc, range)
} else {
classLists = await findClassListsInHtmlRange(state, doc, mode, range)
}
- return dedupeClassLists([
+ return dedupeByRange([
...classLists,
...(includeCustom ? await findCustomClassLists(state, doc, range) : []),
])
@@ -319,7 +310,7 @@
let boundaries = getLanguageBoundaries(state, doc)
if (!boundaries) return []
- return dedupeClassLists(
+ return dedupeByRange(
flatten([
...(await Promise.all(
boundaries
|