suggest

package
v1.0.76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package suggest provides the shared "did you mean" primitives: a rune-aware Levenshtein edit distance and a prefix-weighted Closest ranker. It is the single home for these so cmd, cmd/event, and internal/cmdpolicy stop each carrying their own copy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Closest

func Closest(typed string, candidates []string, maxN int) []string

Closest returns up to maxN of candidates that plausibly match typed, ranked by shared-prefix length (desc) then edit distance (asc), keeping only reasonably-close ones.

Shared prefix is weighted first on purpose: hallucinated names are often semantically close but lexically far (e.g. "+cells-find" vs "+cells-search", "--with-styles" vs nothing close), where the common prefix is the strongest signal of intent that raw edit distance misses.

func Levenshtein

func Levenshtein(a, b string) int

Levenshtein computes the classic edit distance between two strings. It is rune-aware, so it is correct for multi-byte input.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL