google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.34k stars 212 forks source link

improve spelling heuristic #175

Open alandonovan opened 5 years ago

alandonovan commented 5 years ago
% starlark
Welcome to Starlark (go.starlark.net)
>>> 
>>> 
>>> def f(js_library, AsLibrary): 
...   _ = as_library
... 
<stdin>:2:7: undefined: as_library (did you mean AsLibrary?)

The spell checker ignores case and underscores, but perhaps it shouldn't, or perhaps it should ignore them only if it go no matches when considering them. (Perhaps that can be implemented cleanly by treating the distance from 'a' to 'A' as less then 1.0.)