for a real "good" correction, we need to know the set of words which are "reasonable". In a program editor, this depends on the word before the cursor. This may be either a class or variable name, or the name of the function to be called (some syntax awareness required here). In a general text editor, this would be a list of words from a dictionary.
In the following code, I assume that the list of "good" words is found in "candidates", in Smalltalk this would be one of:
Smalltalk allClasses collect:[:cls | cls name]
for class names, or
Smalltalk allClasses collectAll:[:cls | cls methodDictionary keys] as:Set
for the names of all methods.
Of course, in a real world corrector, this would take into account the current scope to restrict the set of possible candidates.
The code then selects the best candidate by its editing distance,
which is the distance between two strings based on the weighted number of insert, delete and replace operations required to change one string onto another. All Smalltalks provide a "spellAgainst:" method in their String class, which is based on levenshtein or a similar algorithm.
"the following is of course very Smalltalk dialect specific,
as the GUI frameworks are slightly different.
It assumes there is an editor object, which represents the code edit
candidates := <one of the above>.
wordToFix := editor wordBeforeCursor.
best := candidates detectMax:[:each | each spellAgainst: wordToFix].
PS: one of the coolest features of Smalltalk is that the IDE is part of your program and vice versa (they are the same), so you can actually add the above code fragment to your editor's keyPress method and have it work immediately!