Skip to content

Commit 649bedf

Browse files
authored
fix: cspell-tools - compounds (#6506)
1 parent 59899a7 commit 649bedf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/cspell-tools/src/compiler/wordListCompiler.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ describe('', () => {
214214
${'HELLO|*hello*|*HELLO*'} | ${['*hello*']}
215215
${'HELLO|*HELLO*'} | ${['*HELLO*']}
216216
${'Hello|*Hello*'} | ${['*Hello*']}
217-
${'hello|+hello+'} | ${['hello', '+hello+']}
217+
${'hello|+hello+'} | ${['*hello*' /* this is on purpose */]}
218218
${'hello|hello+'} | ${['hello*']}
219219
${'hello|+hello'} | ${['*hello']}
220220
${'hello|hello+|+hello|+hello+'} | ${['*hello*']}

packages/cspell-tools/src/compiler/wordListCompiler.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ function applyFlags(word: string, flags: Flags): string[] {
124124
if (flags === (Flags.none | Flags.sfx)) return ['*' + word];
125125
if (flags === (Flags.none | Flags.pfx)) return [word + '*'];
126126
if (flags === (Flags.none | Flags.pfx | Flags.sfx)) return [word + '*', '*' + word];
127-
if (flags === (Flags.none | Flags.both)) return [word, '+' + word + '+'];
127+
if (flags === (Flags.none | Flags.both)) {
128+
// the "correct" answer is [word, '+' + word + '+']
129+
// but practically it makes sense to allow all combinations.
130+
return ['*' + word + '*'];
131+
}
128132
if (flags === (Flags.none | Flags.both | Flags.sfx)) return [word, '+' + word + '*'];
129133
if (flags === (Flags.none | Flags.both | Flags.pfx)) return [word, '*' + word + '+'];
130134
if (flags === (Flags.both | Flags.pfx)) return ['*' + word + '+'];

0 commit comments

Comments
 (0)