@@ -5,12 +5,10 @@ import { isCssContext, isCssDoc } from './css'
55import { isHtmlContext } from './html'
66import { isWithinRange } from './isWithinRange'
77import { isJsxContext } from './js'
8- import { flatten } from './array'
8+ import { dedupeByRange , flatten } from './array'
99import { getClassAttributeLexer , getComputedClassAttributeLexer } from './lexers'
1010import { getLanguageBoundaries } from './getLanguageBoundaries'
1111import { resolveRange } from './resolveRange'
12- import dlv from 'dlv'
13- import { rangesEqual } from './rangesEqual'
1412import Regex from 'becke-ch--regex--s0-0-v1--base--pl--lib'
1513import { getTextWithoutComments } from './doc'
1614
@@ -282,13 +280,6 @@ export async function findClassListsInHtmlRange(
282280 return result
283281}
284282
285- function dedupeClassLists ( classLists : DocumentClassList [ ] ) : DocumentClassList [ ] {
286- return classLists . filter (
287- ( classList , classListIndex ) =>
288- classListIndex === classLists . findIndex ( ( c ) => rangesEqual ( c . range , classList . range ) )
289- )
290- }
291-
292283export async function findClassListsInRange (
293284 state : State ,
294285 doc : TextDocument ,
@@ -302,7 +293,7 @@ export async function findClassListsInRange(
302293 } else {
303294 classLists = await findClassListsInHtmlRange ( state , doc , mode , range )
304295 }
305- return dedupeClassLists ( [
296+ return dedupeByRange ( [
306297 ...classLists ,
307298 ...( includeCustom ? await findCustomClassLists ( state , doc , range ) : [ ] ) ,
308299 ] )
@@ -319,7 +310,7 @@ export async function findClassListsInDocument(
319310 let boundaries = getLanguageBoundaries ( state , doc )
320311 if ( ! boundaries ) return [ ]
321312
322- return dedupeClassLists (
313+ return dedupeByRange (
323314 flatten ( [
324315 ...( await Promise . all (
325316 boundaries
0 commit comments