suggest

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package suggest finds the closest known name to a mistyped one, for the "did you mean" hints in config and theme errors.

Index

Constants

View Source
const MaxDistance = 2

MaxDistance is the largest edit distance that still counts as a typo.

Variables

This section is empty.

Functions

func Closest

func Closest(unknown string, candidates []string) string

Closest returns the candidate nearest to unknown by edit distance, or "" when none is within MaxDistance. The comparison ignores case. Ties go to the candidate that sorts first, so the hint is the same on every run whatever order the candidates come in.

func Distance

func Distance(a, b string) int

Distance is the Levenshtein edit distance between a and b, by byte.

Types

This section is empty.

Jump to

Keyboard shortcuts

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