Skip to content

Remove leven dependency - #1325

Merged
Benjamin Christopher Simmonds (benibenj) merged 5 commits into
microsoft:mainfrom
jakebailey:remove-leven
Sep 4, 2026
Merged

Remove leven dependency#1325
Benjamin Christopher Simmonds (benibenj) merged 5 commits into
microsoft:mainfrom
jakebailey:remove-leven

Conversation

@jakebailey

Copy link
Copy Markdown
Member

@chrmarti Christof Marti (chrmarti) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the advantage of having a copy of the helper instead of the maintained package?

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>
log.error writes to stdout with an ::error:: prefix when GITHUB_ACTIONS is
set and to console.error otherwise, so the create-publisher test passed
locally but failed on CI. Capture both streams so the tests are
environment independent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@benibenj

Copy link
Copy Markdown
Contributor

We are working on reducing the number of packages we depend on. For most packages we only need a small subset of it's features but get dependabot alerts for every CVE the package and it's transitive dependencies have. This PR is rather a small change and not as impactful as the others we've merged, but I still think it's fine to have our own method as long as they are small, simple and easy to test.

@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit 75cae44 into microsoft:main Sep 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants