atom / spell-check

Spell check Atom package
MIT License
205 stars 133 forks source link

Search $DICPATH and $XDG_DATA_DIRS for dictionaries #316

Open puppe opened 4 years ago

puppe commented 4 years ago

Summary

The automatic discovery of installed dictionaries could be improved if the environment variables $DICPATH and $XDG_DATA_DIRS were evaluated.

Motivation

On NixOS and possibly on other platforms and Linux distributions, non-English users are greeted with the following dialog:

warning

The proposed feature would make Atom Spell Check search for dictionaries in additional directories, thereby improving the out-of-the-box experience for users.

Describe alternatives you've considered

An alternative would be to add the directories in question to the list of locale paths in the settings page for Atom Spell Check. This has the downside of requiring the user to take additional steps in order to enable spell-checking. It may not be obvious to all users which paths have to be added.

Another "solution" would be to uncheck "Use Locales". The obvious downside is that system dictionaries are not used for spell checking. If I understand it correctly, spell checking would then be only available for English.

A third alternative would be to include dictionaries for additional languages in Atom. But most users would probably not need dictionaries for more than two or three languages. Including dictionaries for more languages by default would be a waste of resources.

Additional context

$DICPATH is also supported by hunspell to search for dictionaries [1][2].

$XDG_DATA_DIRS is specified by the Cross-Desktop Group as "a set of preference ordered base directories relative to which data files should be searched" [3]. It typically contains directories such as /usr/share, or—in the case of NixOS—/run/current-system/sw/share and $HOME/.nix-profile/share, where dictionaries can be found in a subdirectory like hunspell or myspell.

I would be willing to provide a pull request if you are interested in this feature.

Edit (2019-09-24): Its $DICPATH, not $DIC_PATH.

lee-dohm commented 4 years ago

@dmoonfire do you have any feedback or thoughts on this?

dmoonfire commented 4 years ago

@lee-dohm: I think this is a good idea and would be very helpful. It's easy enough to explode that list into the array we build in code and it should just do the right thing with a focused change.

@puppe: A patch would be good, otherwise I'll stick it on my queue.

puppe commented 4 years ago

@dmoonfire: I would like to provide a patch. Sadly, I don't have much time at the moment. I will also have to "stick in on my queue". I will report here, when I start working on this, in order to avoid any duplicated effort.

dmoonfire commented 4 years ago

@puppe: Sounds good. I have it also in my queue, but I want to decaffinate the project first (switch to JS from Coffee) before I do it. If you start your effort, I'll hold off on decaffination until you get it in since everything is going to be a merge conflict after that. :)