Skip to content

Commit

Permalink
refactor: match case in returned suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Apr 6, 2023
1 parent ee1d480 commit ec58046
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/spell/gospell.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,15 @@ func (s *goSpell) suggest(word string) []wordMatch {
return matches[i].score > matches[j].score
})

return matches[:5]
hits := matches[:5]
if word == strings.Title(word) {
// Capitalized word, so capitalize the suggestions
for i := range hits {
hits[i].word = strings.Title(hits[i].word)
}
}

return hits
}

// spell checks to see if a given word is in the internal dictionaries
Expand Down

0 comments on commit ec58046

Please sign in to comment.