errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.44k stars 152 forks source link

Add suggestions to spellcheck #127

Closed jessetan closed 5 years ago

jessetan commented 5 years ago

The spellchecking functionality in Vale can only log that a word isn't known, but it would be helpful if it could suggest possible alternatives.

ChrisChinchilla commented 5 years ago

I have been thinking about this myself actually, especially when using Vale inside an editor. But I think it would be quite hard to implement, unless aspell/hunspell returns a suggestion natively 🤔

jessetan commented 5 years ago

Some Googling showed me that aspell and hunspell can do suggestions (hence the question), but the curent spelling engine in Vale is "Hunspell-like" and does not seem to do suggestion. This would mean adding that to the spelling engine, switching to a different spelling engine or switching to Enchant (which wraps different spelling engines)

jdkato commented 5 years ago

I'm open to switching to another library, assuming it's appropriately licensed, has similar performance, and is pure Go. You could also submit a PR to Vale's current library: https://github.com/client9/gospell.

Either way, I think this should only be exposed as an option in spelling rules, as looking up suggestions is certain to be slower than the current implementation.

ChrisChinchilla commented 5 years ago

OK, I am happy to look at this as I find it interesting, but I am no Go developer 😆

jdkato commented 5 years ago

I've decided to implement this as a Rule Action, and it will be available in the next release of Vale Server.

ChrisChinchilla commented 5 years ago

Ah, OK! Sorry, as always you are way quicker than me. I guess the extensions need to be updated to support this too? Might be good to figure out how to maintain extensions that support both versions instead of split users between multiple versions? I think I saw you had produced your own, but I may be wrong.

jdkato commented 5 years ago

I maintain clients for Vale Server (Sublime Text, Atom, VS Code, Google Docs, and Chrome) but they make use of features (such as Rule Actions) that aren't available through Vale and thus can't support Vale by itself.

Typically, I wouldn't close a Vale issue for a feature implemented in Vale Server, but this is functionally very similar to the requests for Vale to be able to fix the errors it finds and I don't think this is a good fit for the command line (I've discussed this more in the related issues).

Mause commented 1 year ago

Did this feature live on anywhere after Vale Server was killed?

ChrisChinchilla commented 1 year ago

@Mause It's implemented in editor plugins, so VS Code has it, i think Sublime too. The others I am not sure.

jdkato commented 1 year ago

Yep, VS Code + any plugin using vale-ls will have this feature.

Mause commented 1 year ago

Cheers!