bartosz-antosik / vscode-spellright

Multilingual, Offline and Lightweight Spellchecker for Visual Studio Code
Other
360 stars 37 forks source link

On Linux, all words are marked as misspelled #325

Closed alexbarten closed 5 years ago

alexbarten commented 5 years ago

Dear Bartosz,

Thanks for providing this library to the VSCode users. I use it a lot. On Windows 10, I have it installed on multiple machines and it works flawlessly.

On Linux though, I cannot get it configured correctly. I use Ubuntu 19.10 on my Dell laptop (native installation). I actually encounter two problems, although I can circumvent the first one in an ugly way.

What did I do after installing the extension?

  1. Created the .config/Code/Dictionaries folder. (later with 777-permissions to check if there was a permission problem).
  2. Installed Hunspell using apt.
  3. Checked for the hunspell folder. It was there, containing English and Dutch dictionaries. Good.
  4. Created the link from .config/Code/Dictionaries to hunspell using the ln -s /usr/share/hunspell ~/.config/Code/Dictionaries command as suggested by you.
  5. Started VSCode again.

When I open the 'eye' symbol I can choose no dictionary. The listbox is empty. The link obviously does not work, but I have no clue why. This is problem 1.

So I added another step, downloaded EN-US and NL dictionaries from the first link you provided to do so. Copied these into the .config/Code/Dictionaries folder. Checked if they are UTF8. Which they are, just like the original hunspell dictionaries.

Restarted VSCode.

Now the 'eye' pops up with both dictionaries, when I click it. I choose both languages (also tested with one selected language of course). Load a text. All words are now underlined but SpellRight does not offer me any suggestions to change the word to a word from the dictionaries, unlike Windows 10. This is problem 2, and of course, is a deal breaker.

Do you (or someone else) have a suggestion to get SpellRight working? It is frustrating to see that it works flawlessly on Windows 10, but not on Ubuntu 19.10.

bartosz-antosik commented 5 years ago

Hi! Thanks for kind words about SpellChecker anyway. It looks like you have done a lot of checks and the thing I was most afraid of taht the dictionaries are not UTF-8. But you did ensured about it...

  1. SpellRight does not require hunspell to be installed by apt! Hunspell does bring it's own hunspell binaries, because this is the way that Electron components do! I really have no idea what could be wrong with creating the link the truth is, SpellRight do not interpret in any way the content of the folder it just lists the files in the dictionary (or lists their appropriate language names if file names follow LN-RG naming convention (LN - two characters language symbol, RG - two region symbol).

  2. It looks to me like somehow the dictionaries are read improperly by hunspell. If they are properly saved as UTF8 files then I see no reason fo it to be like this. Could you please check #264 (parentheses)?

alexbarten commented 5 years ago

Hi! Thanks for your quick reaction and your suggestion.

I tried the solution from #264 (change "English (United States)" to "English", but that made no difference. Is there a way to debug Spell Right from my end?

bartosz-antosik commented 5 years ago

You have both files .dic and .aff of course? Also, could you try en-us.ext naming convention?

alexbarten commented 5 years ago

Found it! At first I did what you suggested, changing the names to en_US.aff / en_US.dic (yes, I have both installed ;-) and later even to en.aff and en.dic, and every time I would start VSCode again and test by deselecting and selecting the language. But the effect remained unchanged.

Then something occurred to me.

I wanted to tell you that the link to the folder command was not correct. But then I thought of what I had done when using ln -s /usr/share/hunspell ~/.config/Code/Dictionaries. Actually, I had followed the manual too literally. In the readme you point out that the 'Dictionaries' folder does not yet exist and that you need to create it. Which I did. Then I ran the ln command as suggested, after I had made sure that the hunspell folder was there and that the dictionaries had the UTF8 format. When I created the link, an error occurred. Then I did not think (!) and reran the command using sudo and then it worked. I thought. But then it creates a hunspell link in the Dictionaries folder instead. Duh!

But I had not understood what you actually explained in the manual: I should have created the link with ln -s /usr/share/hunspell ~/.config/Code/Dictionaries INSTEAD of creating the folder manually and not execute both. By applying sudo I managed to create a hunspell folder inside the Dictionaries folder.

When your latest suggestions did not work, I ran through my actions again, wanted to tell you that your ln suggestion was wrong, then found out that I was wrong but that you meant something different.

Long story short: I removed the Dictionaries folder and the included dictionaries, ran the ln command again. And everything works fine now.

This leads me to an insight: the downloaded dictionaries from your first link did not work for me, although they are UTF8. You might want to reconsider this advice. The official hunspell dictionaries as installed in Ubuntu work flawlessly however. You might want to point to those instead.

Then one last request: you might want to change the sentence in the manual to help s****d people like me from making mistakes. The sentence:

On most Linux distributions system-wide dictionaries can be reused (for now only UTF-8 encoded dictionaries are supported, verify SET line in *.aff file) by soft linking the system folder e.g.:

...could be followed by a small remark which says that the ln command should be executed instead of creating the Dictionaries folder by hand (which you suggest a few lines above).

Thanks, and keep up the good work!

bartosz-antosik commented 5 years ago

Thank you for the investigation! I am more or less aware that there is quite an inconsistency in dictionaries delivered natively with various Linux distributions (e.g. olcer vs. never, Linux Mint vs. Kubuntu etc.) So it is always a matter of recognition by the user. It is simply Linux world...

I will try to make a remark about linking INSTEAD of creating the folder.