bartosz-antosik / vscode-spellright

Multilingual, Offline and Lightweight Spellchecker for Visual Studio Code
Other
359 stars 36 forks source link

All words mispelled when using hunspell on Linux #283

Open Ben-Voris opened 5 years ago

Ben-Voris commented 5 years ago

In a text file, all words are reported as misspelled. In this example, all words are misspelled, including the one that really is.

"No": no suggestions
"mistakes": no suggestions
"here": no suggestions
"One": no suggestions
"hre": no suggestions

When I try to set the language in VS Code, I get this error: Running the contributed command: 'spellright.selectDictionary' failed.

What have I done wrong?

Extension information:

Name: Spell Right
Id: ban.spellright
Description: Multilingual, Offline and Lightweight Spellchecker
Version: 3.0.38
Publisher: Bartosz Antosik
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ban.spellright

Here are the dictionaries:

: ls  ~/.config/Code/Dictionaries
/home/bvoris/.config/Code/Dictionaries@

: file ~/.config/Code/Dictionaries/en_US*
/home/bvoris/.config/Code/Dictionaries/en_US.aff: UTF-8 Unicode text
/home/bvoris/.config/Code/Dictionaries/en_US.dic: ASCII text

hunspell works from the command line.

First, display its default dictionary:

: hunspell -D
SEARCH PATH:
.::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/home/bvoris/.openoffice.org/3/user/wordbook:/home/bvoris/.openoffice.org2/user/wordbook:/home/bvoris/.openoffice.org2.0/user/wordbook:/home/bvoris/Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
/usr/share/hunspell/en_ZA
/usr/share/hunspell/en_AU
/usr/share/hunspell/en_CA
/usr/share/hunspell/en_GB
/usr/share/hunspell/en_US
LOADED DICTIONARY:
/usr/share/hunspell/en_US.aff
/usr/share/hunspell/en_US.dic
Hunspell 1.6.2

And demonstrate that it works:

: cat test.txt
No mistakes here.
One hre

: hunspell < test.txt
Hunspell 1.6.2
*
+ mistake
*

*
& hre 15 4: her, hr, he, re, here, hire, hare, ere, hrs, hie, ire, are, hoe, ore, hue

As expected, running hunspell -d en_US < test.txt gives the same results.

I installed VS Code using sudo snap install --classic code

VS Code reports this version:

 Version: 1.34.0
Commit: a622c65b2c713c890fcf4fbf07cf34049d5fe758
Date: 2019-05-15T21:55:35.507Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.15.0-50-generic snap

snap reports:

Version: 1.34.0
Commit: a622c65b2c713c890fcf4fbf07cf34049d5fe758
Date: 2019-05-15T21:55:35.507Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.15.0-50-generic snap

Underlying OS:

: uname -s -r -v -m
Linux 4.15.0-50-generic #54-Ubuntu SMP Mon May 6 18:46:08 UTC 2019 x86_64

: lsb_release -d
Description:    Ubuntu 18.04.2 LTS
bartosz-antosik commented 4 years ago

Hi! I am terribly sorry for answering this late! I have very little time recently to deal with SpellRight and just minutes ago I tried to answer similar question. Could you please check with thread #264 whether it does not solve your issue?

WebFreak001 commented 4 years ago

no issues here on linux

ran

ln -s /usr/share/hunspell/ /home/webfreak/.config/Code/Dictionaries

to have it use all my system hunspell dictionaries (on ArchLinux) and then selected the language inside vscode. Works great!

Hillsie commented 3 years ago

It's most likely a permissions issue on Linux and a configuration issue. image

Using the symbolic link looks like you have the permission, however the underlying permission is for root.

The simplest solution is to

cd /usr/share/hunspell
cp en_yourLanguage.aff ~/.config/Code/Dictionaries
cp en_yourLanguage.dic ~/.config/Code/Dictionaries
echo "Need to create the folder below if it doesn't exist"
cd ~/.config/Code/Dictionaries 
echo "Below command to check permissions. If its root, change is to your username with chown. No need to use chmod"
ls -larth

should return

-rw-r--r-- 1 yourname yourname 3.1K Jul 17 21:35 en_AU.aff
-rw-r--r-- 1 yourname yourname 540K Jul 17 21:35 en_AU.dic

I also had to add setting to settings.json

{
    "spellright.suggestionsInHints":true,
    "spellright.language": [
        "en_AU"
    ],
    "spellright.documentTypes": [
        "markdown",
        "latex",
        "plaintext"
    ],
}