Unibeautify / unibeautify

One Beautifier to rule them all, One Beautifier to clean them, One Beautifier to bring them all and in the darkness sheen them
https://unibeautify.com/
MIT License
544 stars 41 forks source link

Autocorrect language name typos (like Git does for commands) #208

Closed muuvmuuv closed 5 years ago

muuvmuuv commented 6 years ago

Describe the feature

I have started working more with the Unibeautify CLI and had noticed that it is really hard to understand how it is working. I started with unibeautify index.js -l javascript, then I saw that I need to flag the file with -f and after a talk with @stevenzeck (See: unibeautify-cli/issues/103) I had to letter javascript correctly. So the correct way was unibeautify -f index.js -l JavaScript.

This is IMHO, a little bit to difficult for the most users because not every developer knows the correct lettering of every language. I think we need to make this case intensitive. The corresponding lines are LanguageManager.ts#L18 and LanguageManager.ts#L25

lassik commented 6 years ago

I agree. We haven't done a lot of work on the CLI yet. Hopefully the pace is picking up soon :)

Glavin001 commented 6 years ago

I think your reasoning makes sense.

I would prefer to keep the name to be correct and exact. However, I also want the user experience to be better. How about for the time being we make autocorrect / recommendations to the user like git does? See https://stacktoheap.com/blog/2015/11/01/git-autocorrect-feature/ for example.

$ git psuh
git: 'psuh' is not a git command. See 'git --help'.

Did you mean this?
  push

My proposal:

muuvmuuv commented 6 years ago

@Glavin001 love that idea! 🎉

Glavin001 commented 5 years ago

🎉 Awesome! I'm open to receiving a Pull Request to Unibeautify CLI which reports an error to the user for incorrectly spelt language names and then recommends similarly spelt languages for the user to fix.

I'm open to suggests on the message format. We can discuss in the PR. For example:

$ unibeautify -f index.js -l javascript
Language 'javascript' is not found. Did you mean "JavaScript"?
stevenzeck commented 5 years ago

This issue was moved to Unibeautify/unibeautify-cli#115