CJCombrink / SpellChecker-Plugin

SpellChecker Plugin for Qt Creator
GNU Lesser General Public License v3.0
136 stars 26 forks source link

Unable to load dictionaries from anywhere #153

Open JohannesKauffmann opened 7 months ago

JohannesKauffmann commented 7 months ago

Using Ubuntu 23.10, and Qt Creator 11.0.0 from the online installer (not from the distro). Thus, the plugin is version 3.4.0.

I've installed the hunspell-en-us package, but am unable to load the dictionary (en_US.dic) either from /usr/share/hunspell or from my home directory. Selecting the dictionary file from the GUI works fine, but after Apply, Ok and a restart, the path to the dictionary is cleared, and spell checking clearly doesn't work (flags everything as spelled wrong).

The plugin is installed via "Install Plugin", selecting the tar.gz and choosing for a local installation.

When opening and closing Qt Creator, these 5 warnings are always printed:

QVariant::save: unable to save type 'Utils::FilePath' (type id: 65559).

QVariant::save: unable to save type 'Utils::FilePath' (type id: 65559).

QVariant::save: unable to save type 'Utils::FilePath' (type id: 65559).

QVariant::save: unable to save type 'Utils::FilePath' (type id: 65559).

QVariant::save: unable to save type 'Utils::FilePath' (type id: 65559)

Now I'm not sure if these errors are related, but Tools->Debug Qt Creator->Show Logs didn't give me more info.

Happy to provide more details if needed.

tdyjv commented 6 months ago

I can verify this issue with QtCreator v12.0.1 under Ubuntu 22.04. The plugin version installed is 3.5.0 and I also have hunspell-en-us insalled. When I select /usr/share/hunspell/en_US.dic and click Apply and/or OK, close the configuration and reopen, the dictionary file settings have disappeared. My plugin is installed in $HOME/Qt/Tools/QtCreator/lib/qtcreator/plugins/libSpellChecker.so per the instructions.

These are the messages I get when starting QtCreator from the command line :

$ Qt/Tools/QtCreator/bin/qtcreator.sh 
loadUserAddedWords: User dictionary name empty
Accessing MimeDatabase for text/x-c++src before plugins are initialized
Accessing MimeDatabase for text/x-csrc before plugins are initialized
Accessing MimeDatabase for text/x-c++hdr before plugins are initialized

I tried copying the dictionary files to a local directory which would be writable and that did not help.

Happy to help with debugging if needed.

CJCombrink commented 6 months ago

Thanks for reporting Sorry for the delay, I will see if I can look into this asap.

tdyjv commented 4 months ago

Any movement on this ? Can I assist in some way ?

CJCombrink commented 4 months ago

@tdyjv Sorry I never responded on this.

I did install Ubuntu (not sure what version) in a VM and could not reproduce. I did test with /usr/share/hunspell/en_US.dic as well as dictionaries downloaded to ~/Dictionaries/ and the behaviour was consistent and correct. Have you tried manually downloading the dictionary and aff file from the link provided in the readme? Also ensure that the 'plain' option is downloaded. When opened it should not look like an html file, but plain text

JohannesKauffmann commented 4 months ago

I did install Ubuntu (not sure what version) in a VM and could not reproduce.

Ubuntu's version can be queried using lsb_release -a.

What version of Qt Creator + plugin did you test with?

tdyjv commented 4 months ago

Yesterday I was able to get it working. Tried a few things not sure which really helped. I will do more testing today and report back.

tdyjv commented 4 months ago

Ok here we go : I have two systems - Desktop and Laptop

The Laptop dictionary selection works out of the box without any failures.

The Desktop behaves as follows :

If I select a new dictionary location, either local to my home directory or /usr/share/hunspell it fails to save the new dictionary location.

If I select a new dictionary location, either local to my home directory or /usr/share/hunspell AND change another spellchecker configuration item, for example Uncheck "Only check current editor" it works. I have tested with other configuration items and any changes at the same time as the change in dictionary selection will save the dictionary selection. If I do not change another configuration item it fails every time.

I hope this helps - At least it's a work around

CJCombrink commented 4 months ago

@JohannesKauffmann

> lsb_release -a.
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:   jammy

Qt Creator Version

Qt Creator 12.0.2
Based on Qt 6.6.0 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), x86_64)
Built on Feb 6 2024 10:09:23

@tdyjv Thank you very much for the investigation. I have a Laptop and tested in a Virtual Box with the above ubuntu. I don't have access to a bare metal Ubuntu machine.

I will look a bit at the code, especially now with Qt Creator 13 coming to see if there is not something that can be done from the source side that might help. I have a suspicion what could cause something like this.

tdyjv commented 2 months ago

Just to follow up. This seems to work correctly in QtCreator V13