Sublime Forum

ST2 & 3, OSX: CheckBounce, a spell-check plugin

#1

I was starting to get a little frustrated by both the thing I was working on and the way Sublime was checking its spelling; out of the frustration came a VERY sketchy (release early, release often, I guess) interface to OS X’s spell-check system. Benefits include a better-populated dictionary, stronger replacement suggestions, and detection of multiple languages. You can check it out at github.com/phyllisstein/CheckBounce.

As of 23 March, it’s been backwards-ported to Sublime Text 2 and largely functions as a (surprisingly fast) background thread while you’re working. Contextual menu items now allow you to learn, ignore, and get suggestions for words (by right-clicking on them). Aside from waiting for new region drawing methods to be implemented, it seems largely stable. Please do let me know if anything breaks, however.

0 Likes

Problem about ignore misspelled word
#2

I’ve updated the Github repo; the package now runs the check in a background process, eliminating the need to do it manually, and allows words to be ignored and learned. Once the new region-drawing keys are implemented, it should prove itself to be a totally viable replacement for Sublime’s built-in spell-checker.

0 Likes

#3

Nice project. I think exposing Ignore/ Learn is the biggest win.

0 Likes

#4

Thanks! I think so, too, especially since it irritatingly picks up on LaTeX keywords as errors. However, there’s also a handy dandy language-sensitive word count included now, which might rival the ignore/learn thing for usefulness.

In other news, it now has been tested under ST2 and ST3 and runs smoothly with both (after some backwards-porting).

0 Likes

#5

Hi,
I’m very interested by this plugin but I can not find it in the “package control : install packages” list … so, stupid question : how can I install it ?

0 Likes

#6

[quote=“GerardLambert”]Hi,
I’m very interested by this plugin but I can not find it in the “package control : install packages” list … so, stupid question : how can I install it ?[/quote]

You can either clone it from the Github repository into your Sublime packages directory or use the “↓ZIP” link to download it as a zip file. If you download the zip, be sure to rename the folder that’s extracted from “CheckBounce-master” to “CheckBounce” before dropping it in with your packages.

0 Likes

#7

thanks for your answer ! I installed it and now I have probably other stupid questions :smile:
I have an unknown word and when I right click on it, I still have the suggestions for the default SpellCheking plus the classic “ignore XXXX” but I know also have three more options
“Ignore Word”
“Add Word to dictionnary”
“suggest corrections”

I click on “Add Word to dictionnay” (that is the main reason I want to try your package) but nothing happens : the word stay underlined … Did I do something wrong ?
thanks

0 Likes

#8

up ?

0 Likes

#9

[quote=“GerardLambert”]thanks for your answer ! I installed it and now I have probably other stupid questions :smile:
I have an unknown word and when I right click on it, I still have the suggestions for the default SpellCheking plus the classic “ignore XXXX” but I know also have three more options
“Ignore Word”
“Add Word to dictionnary”
“suggest corrections”

I click on “Add Word to dictionnay” (that is the main reason I want to try your package) but nothing happens : the word stay underlined … Did I do something wrong ?
thanks[/quote]

Hi there,
Sorry it took me a while to see this. In the last version, the underline stays there until you edit the document again. Just keep typing after you add a word to the dictionary and it should disappear from all over the file. (And everywhere else in OS X: “Learn” uses the global spelling dictionary, whereas “Ignore” is document- and session-specific.) I’m almost done with a new version that’s much less of a resource hog and includes some nifty new features; hopefully I’ll be able to fix that kludge as well.

0 Likes

#10

[quote=“GerardLambert”]thanks for your answer ! I installed it and now I have probably other stupid questions :smile:
I have an unknown word and when I right click on it, I still have the suggestions for the default SpellCheking plus the classic “ignore XXXX” but I know also have three more options
“Ignore Word”
“Add Word to dictionnary”
“suggest corrections”

I click on “Add Word to dictionnay” (that is the main reason I want to try your package) but nothing happens : the word stay underlined … Did I do something wrong ?
thanks[/quote]

Just pushed to Github a new version that’s faster, less of a resource hog, and able to refresh itself after a word is added or ignored so that the error disappears immediately. It’s fully compatible with ST2 and ST3 as of the evening of April 5th.

0 Likes

#11

Hi! I have a question. When I place the renamed CheckBounce folder in Packages, nothing really happens. I have the settings under Preferences added, and to be sure I copied the CheckBounce.sublime-settings content into the user specific settings file. I’m on Sublime Text 2. If I have the ST2 spell-check disabled, absolutely nothing happens (I have tried writing the weirdest words…) and with ST2 spell check on no other options are available when I right-click the words. Any idea what’s wrong? Thanks in advance!

0 Likes

#12

“When I place the renamed CheckBounce folder in Packages” implies that there is already another CheckBounce folder with a different name. Hopefully, you just have one (1) CheckBounce folder. Obviously, you would not want more than one version of the same plugin running simultaneously. As long as the CheckBounce folder is in the Packages directory, you can call the folder “holene” instead of CheckBounce if you want to. When the Sublime Text application opens, check the python panel shell console to see if there are any errors loading any plugins – if everything is okay, you should see the python plugins from CheckBounce loading on startup without any issues reported. Do that, and then report back.

0 Likes

#13

The reference to the renamed CheckBounce folder was that you instruction to remove the “-master” part of the name in “README.mdown” :wink:

Anyhow; the output from the console on start-up seems legit to me:

theme loaded app ready pre session restore time: 0.562632 using gamma: 2 (err: 6.9282) Loading dictionary Packages/Language - English/en_GB.dic wrote startup cache, added files: 58 orphaned files: 0 total files: 167 cache hits: 109 startup time: 1.286 (package setup was not run) loaded 860 snippets Package Control: No updated packages

But I still lack spell check unless I turn on (F6) the internal ST2 spell check (which of course is what we don’t want) …

0 Likes

#14

There are a couple of things you may want to try. First off, I’d recommend updating to the latest commit, which I pushed about an hour ago; it adds (optional) grammar checking and makes it easier to turn the package on and off in individual views (see the updated README for more info). Next, make sure you’re trying to use either one of the built-in whitelisted syntaxes—LaTeX, Markdown, and Plain Text—or one that you’ve added to the settings yourself. If you’ve added a new syntax on your own, be aware that you want it to match the scope selector, not the name of the .tmLanguage file.

The most likely cause is that I published a revision-in-progress to Github too early and you happened to get a buggy edition—a terrible habit of mine. I’ve tested the version that’s now on Github in both ST2 and ST3 for at least a solid hour or two each, and haven’t encountered any problems. So you may want to see if you have better luck with this commit. Sorry for the inconvenience, though, and please let me know if you continue to encounter trouble.

0 Likes

#15

Hey again!

I’m testing in LaTeX, Markdown, Text and tried to add “MATLAB” (“matlab” and “source.matlab”, what does define scope selector for the different languages?) as well, without much success. I downloaded the new latest commit, and added to Packages. The python console output is reporting some errors:

Reloading plugin /Users/holene/Library/Application Support/Sublime Text 2/Packages/CheckBounce/act_on_word.py Traceback (most recent call last): File "./sublime_plugin.py", line 62, in reload_plugin File "./act_on_word.py", line 8, in <module> from spellchecker import SpellChecker File "./spellchecker.py", line 179 sublime.status_message('Learned "{0}."'.format(word)) ^ IndentationError: unexpected indent Reloading plugin /Users/holene/Library/Application Support/Sublime Text 2/Packages/CheckBounce/autocorrect_listener.py Traceback (most recent call last): File "./sublime_plugin.py", line 62, in reload_plugin File "./autocorrect_listener.py", line 10, in <module> from spellchecker import SpellChecker File "./spellchecker.py", line 179 sublime.status_message('Learned "{0}."'.format(word)) ^ IndentationError: unexpected indent Reloading plugin /Users/holene/Library/Application Support/Sublime Text 2/Packages/CheckBounce/background.py Traceback (most recent call last): File "./sublime_plugin.py", line 62, in reload_plugin File "./background.py", line 14, in <module> from spellchecker import SpellChecker File "./spellchecker.py", line 179 sublime.status_message('Learned "{0}."'.format(word)) ^ IndentationError: unexpected indent Reloading plugin /Users/holene/Library/Application Support/Sublime Text 2/Packages/CheckBounce/check_contextual.py Reloading plugin /Users/holene/Library/Application Support/Sublime Text 2/Packages/CheckBounce/const.py Reloading plugin /Users/holene/Library/Application Support/Sublime Text 2/Packages/CheckBounce/spellchecker.py Traceback (most recent call last): File "./sublime_plugin.py", line 62, in reload_plugin File "./spellchecker.py", line 179 sublime.status_message('Learned "{0}."'.format(word)) ^ IndentationError: unexpected indent found 10 files for base name Default.sublime-keymap found 33 files for base name Main.sublime-menu

0 Likes

#16

Strange thing about that is, that’s not what’s on line 179. I’d recommend, just to be certain, that you quit Sublime, delete the whole “Packages/CheckBounce” folder, copy in the Github version, the restart Sublime, just to be certain none of the compiled Python files ST2 generates are lingering behind and confusing it. I just did this with my copy of ST2, after double-checking that the code on Github was up-to-date and uncorrupted (as of the commit from 7 hours ago), and it seemed to run okay. Let me know if that works any better!

0 Likes

#17

thanks for the answer I updated to the new version … I still have questions …

  • Do I need to switch off the default spell tools ? I’m using ST2 and when a word is unknown I have a red underline under it AND a red box around it … when I do “add word to dictionary” only the red box disappears (not the red underline).

  • can I change the dictionary (for the default spell I have 3 : en_GB, en_US and french) ? when I do so I’m not sure to really understand what happens with your package but it does not seem to work we;;

  • I do not manage to toggle of the spell cheking by CheckBounce (I did it through the palette but the red boxes are staying … even when I edit the document etc…)

[quote]Traceback (most recent call last):
File “./spelling_background.py”, line 103, in
File “./spelling_background.py”, line 93, in reassign
File “./spellchecker.py”, line 71, in remove
AttributeError: ‘NoneType’ object has no attribute ‘clear’
Traceback (most recent call last):
File “./spelling_background.py”, line 103, in
File “./spelling_background.py”, line 93, in reassign
File “./spellchecker.py”, line 71, in remove
AttributeError: ‘NoneType’ object has no attribute ‘clear’[/quote]

  • If I did “add word to dictionary” by mistake, can I reverse it and suppress the word from the dictionary ? related: where are the added words saved ?

  • small remark: when I right click on a bad word , If the cursor is not on the word your package does not work (but the default spell does 0 : I can to ignore word but not add word to dictionary … I first have to click on it then I can right click …

0 Likes

#18

To take your questions in order:

  • This package does not integrate with Sublime’s built-in spell-checker, so you’ll get the best results if you only use one at a time. I don’t have any plans to do anything as elaborate as modify Sublime’s dictionary files based on the spelling results from CheckBounce.

  • Again, no integration with the built-in checker, so changing the dictionary files Sublime looks at won’t do anything for this package. OS X’s built-in spelling system is designed to automatically identify a document’s dominant language, however, and it seemed to work reasonably well in the limited testing I did, picking up on—and suggesting corrections for—German and French.

  • I’ll look into this later today and post an update to Github tonight.

  • OS X stores its learned words in ~/Library/Spelling, I believe, and I think you can edit the file that’s there if you really want to. Though I’ve never tried.

  • Since I don’t think there’s a way to capture mouse-down events, I think this is just how Sublime has to work.

0 Likes

#19

[quote=“GerardLambert”]thanks for the answer I updated to the new version … I still have questions …
[/quote]

I’ve just pushed an updated version that should address your problem with toggling the checker on and off. Give it a shot and let me know how it works.

0 Likes

#20

I downloaded the new update, and it now works! Thanks =)
Is there an exception-file for language syntax, or may I make one? For instance when you write LaTeX you wouldn’t want the spellcheck to react to \textsc etc.

0 Likes