Repository navigation
Commit bee68cf
Extract command suggestion helper and test it
Move the inlined helper out of main.ts into util.ts, split into a
`levenshtein` distance function and a `findSimilar` selection function so
both can be unit tested.
Adds src/test/similarity.test.ts covering three layers: the distance
function against a textbook full matrix reference, the selection rule
against a reference implementation, and the actual `vsce <typo>` output so
the wiring in main.ts is covered too. Includes a guard that fails if the
registered command list drifts from what the tests assume.
Selection behaviour is unchanged from the inlined version, verified by a
differential run over 189k inputs covering mutated commands, unicode,
surrogate pairs, ties and degenerate candidate sets.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent f3174c5 commit bee68cf
3 files changed
Lines changed: 688 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 14 | | |
37 | 15 | | |
38 | 16 | | |
| |||
0 commit comments