swyphcosmo / vscode-spellchecker

Spell check extension for Visual Studio Code
MIT License
16 stars 10 forks source link

Add support for French language (contribution offer) #31

Closed adrienjoly closed 7 years ago

adrienjoly commented 7 years ago

Hi!

I love vscode, but keep using SublimeText just because it has an offline spellcheck extension for the French language: https://github.com/superbob/SublimeTextLanguageFrench

Being a developer myself, I would be happy to contribute to your project (or start a new one, if you think that it makes more sense), so that I can run offline spellchecking for my French documents from vscode.

Do you have any suggestions to provide, on how I/we could do that?

swyphcosmo commented 7 years ago

Adding more languages is something that I've had on my list for a while, but I haven't made the time for it.

All it takes to add a new language is to add a Hunspell compatible dictionary (.dic and .aff files) to the /languages directory in this repo.

One drawback of this is that the language files are pretty big (relative to the rest of the files in the extension). A person will have every language installed independent of which ones they use. I've been thinking about adding the ability to download the language selectively based on what is used. There's a great repository of dictionary files maintained by wooorm https://github.com/wooorm/dictionaries. He also has a lot of packages that I've been looking to integrate to increase the functionality of this extension.

It might be a while before I get around to adding this functionality, so feel free to submit a PR in the mean time

adrienjoly commented 7 years ago

Hi @swyphcosmo!

Thanks for your reply!

I tried that (you can watch me do it), but ended up having a blocking error after adding FR dictionary files...

Here's a journal of what I did:

Add a French spellchecker to Visual Studio Code

Steps:

Journal:

//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:127 [Extension Host] Activating extension `swyphcosmo.spellchecker` failed: {1}.A.logExtensionHostMessage @ //Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:127
//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:127 [Extension Host] Activating extension `swyphcosmo.spellchecker` failed:  undefinedA.logExtensionHostMessage @ //Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:127
//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:127 [Extension Host] Here is the error stack:  undefined
//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:109 Activating extension `swyphcosmo.spellchecker` failed: {1}.t.$localShowMessage @ //Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:109
swyphcosmo commented 7 years ago

You don't want to add the local repo to the vscode's extension directory. Because you're testing new functionality, you want to debug the extension from within VSCode.

At this point, a new editor window will open with the local spellchecker extension enabled.

I'm not sure what those errors are. They could have something to do with how the extension was installed. Here's how you can get more detailed information.

If you send me the log from the Developer Tools console, I can try to help out more.

adrienjoly commented 7 years ago

@swyphcosmo I did not know about all that, thank for having taken the time to explain!

I will probably plan another live coding session to do this, next week! I'll let you know!

adrienjoly commented 7 years ago

Add a French spellchecker to Visual Studio Code (2nd try)

Live coding simultaneously from:

Steps:

adrienjoly commented 7 years ago

@swyphcosmo Some progress and a PR, thanks to your advice!

Unfortunately, the French spell-checker is failing on some words:

screen shot 2017-01-25 at 14 53 27

Also, I wasted a lot of time figuring out that I needed to install a git submodule for hunspell-spellcheck, so I took the liberty to add a preinstall hook to do that automatically in package.json.

Video of me doing this: Make a FR spellchecker for Visual Studio Code (Youtube)

adrienjoly commented 7 years ago

@swyphcosmo Switching from the Hunspell submodule to Atom's node-spellcheck npm module solved my French spelling problems, and runs much faster.

One drawback is that the extension needs to be compiled separately for each platform, because Atom's node-spellcheck npm module is a native module. And I had to use electron-rebuild in order to compile accordingly to VSCode's Electron version.

adrienjoly commented 7 years ago

@swyphcosmo I took the liberty to publish my fork of your extension on the marketplace: under the name French spell checker. (the corresponding forked repo is there)

I only tested it on Mac OS, and I doubt that it works on other platforms. I'm happy to collaborate if anybody wants to try it on another platform.

swyphcosmo commented 7 years ago

Just added dictionaries. Will be pushing a new release soon.

adrienjoly commented 7 years ago

awesome!

make sure that "j'aime" is not spotted as a spelling error. this is the reason why I had forked this extension.

swyphcosmo commented 7 years ago

Thanks for the suggestion. I was looking at the samples you provided, but wasn't sure which word should be spelled correctly. I know that one still caused an error, so I'll look into it.

ghost commented 6 years ago

I did try on Debian GNU/Linux. @adrienjoly mentioned he has only tested on MacosX so far.

and guess what? not working... as expected.

I would like to help. anybody may suggest clues to try out...

swyphcosmo commented 6 years ago

@pvincent. I haven't used @adrienjoly's fork of this extension as I'm not a French speaker. He's using a third party npm package called spellchecker which supports native spell checker software. It should work on Linux, but you might need to install the native spellchecker through apt. I would suggest looking into that npm package or opening an issue on @adrienjoly's fork for help debugging your problem.

ghost commented 6 years ago

Thank you Michael. I didn't notice there were other extensions on the same topic. one of them works actually.

have a nice day

On 9 March 2018 at 02:18, Michael Vernier notifications@github.com wrote:

@pvincent https://github.com/pvincent. I haven't used @adrienjoly https://github.com/adrienjoly's fork of this extension as I'm not a French speaker. He's using a third party npm package called spellchecker https://www.npmjs.com/package/spellchecker which supports native spell checker software. It should work on Linux, but you might need to install the native spellchecker through apt. I would suggest looking into that npm package or opening an issue on @adrienjoly's fork https://github.com/adrienjoly/vscode-spellchecker/tree/master/src for help debugging your problem.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/swyphcosmo/vscode-spellchecker/issues/31#issuecomment-371644021, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHXXS4GjPsH-iwbkZXZO9WYAX79BXDUks5tca49gaJpZM4LgegU .

adrienjoly commented 6 years ago

Hi @pvincent! I'd be interested to know what extension you've ended up using, and how well it's working for you, if you don't mind :-)

ghost commented 6 years ago
adrienjoly commented 6 years ago

I will check them out! Thanks!