diff --git a/packages/cspell-dictionary/package.json b/packages/cspell-dictionary/package.json index 3c99bc59d7be..41f273284b3f 100644 --- a/packages/cspell-dictionary/package.json +++ b/packages/cspell-dictionary/package.json @@ -53,10 +53,10 @@ "@cspell/cspell-pipe": "workspace:*", "@cspell/cspell-types": "workspace:*", "cspell-trie-lib": "workspace:*", - "fast-equals": "^5.0.1", - "gensequence": "^7.0.0" + "fast-equals": "^5.0.1" }, "devDependencies": { + "gensequence": "^7.0.0", "lorem-ipsum": "^2.0.8" } } diff --git a/packages/cspell-lib/src/lib/util/text.ts b/packages/cspell-lib/src/lib/util/text.ts index e2c3cad48a8e..74ccd9f231d8 100644 --- a/packages/cspell-lib/src/lib/util/text.ts +++ b/packages/cspell-lib/src/lib/util/text.ts @@ -1,6 +1,5 @@ import { opConcatMap, opMap, pipe } from '@cspell/cspell-pipe/sync'; import type { TextDocumentOffset, TextOffset } from '@cspell/cspell-types'; -import { sequenceFromRegExpMatch } from 'gensequence'; import { binarySearch } from './search.js'; import { @@ -47,7 +46,9 @@ export function splitCamelCaseWord(word: string): string[] { * This function lets you iterate over regular expression matches. */ export function match(reg: RegExp, text: string): Iterable { - return sequenceFromRegExpMatch(reg, text); + if (!text) return []; + reg = reg.global ? reg : new RegExp(reg.source, reg.flags + 'g'); + return text.matchAll(reg); } export function matchStringToTextOffset(reg: RegExp, text: string): Iterable { diff --git a/packages/cspell-tools/package.json b/packages/cspell-tools/package.json index 26eb222cc27a..1916eb980b09 100644 --- a/packages/cspell-tools/package.json +++ b/packages/cspell-tools/package.json @@ -54,7 +54,6 @@ "commander": "^12.1.0", "cosmiconfig": "9.0.0", "cspell-trie-lib": "workspace:*", - "gensequence": "^7.0.0", "glob": "^10.4.5", "hunspell-reader": "workspace:*", "yaml": "^2.5.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a22c00a9a9b..5adabb775a95 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -470,10 +470,10 @@ importers: fast-equals: specifier: ^5.0.1 version: 5.0.1 + devDependencies: gensequence: specifier: ^7.0.0 version: 7.0.0 - devDependencies: lorem-ipsum: specifier: ^2.0.8 version: 2.0.8 @@ -777,9 +777,6 @@ importers: cspell-trie-lib: specifier: workspace:* version: link:../cspell-trie-lib - gensequence: - specifier: ^7.0.0 - version: 7.0.0 glob: specifier: ^10.4.5 version: 10.4.5