-
-
There should be a blank line before this import. Imports are in three groups, each separated by a blank line: 1) Python-provided modules, 2) Third-party modules, 3) Project modules.
-
-
-
-
-
Spaces after each "," Also, functions should always be lowercase, with '_' between words. So, check_line.
-
-
-
-
-
-
We should probably define a new token type: SpellingError. Then we can highlight that separately. I think you can do this with: from pygments import token ... SpellingError = Token.SpellingError token.STANDARD_TYPES[SpellingError] = 'spellerr' I haven't tried that, but it might work. We'd need a CSS rule for it, though, but that's easy.
-
-
-
-
-
Highlight Spell Errors for Spell Checking
Review Request #2122 — Created Feb. 12, 2011 and discarded
Check lines with token type as "String" or "Comment" for spell errors, using pyaspell. Highlight words with spell errors, using pygments.
-
This looks awesome :) I'm so excited about this. A few things to fix up. Only one of them is a tough problem, the rest are easy changes. I'll give the localization thing below some thought... This must be a solved problem.
-
-
-
First line, immediately following the """, should contain a one-line summary, followed by a blank line, followed by a description.
-
So this is an interesting thing I didn't consider. We're defaulting to "en", which probably isn't sufficient for all cases. Imagine a Japanese or French developer putting up code and seeing spelling errors everywhere. We'll need to figure out a solution for this. Tricky.
-
-
-
-
Oh, also, you'll need to add pyaspell to the dependency list in setup.py. Figure out what the latest version is and do: pyaspell>=the_version (assuming 'pyaspell' is what you easy_install).
DO
- Change Summary:
-
I used "apt-get install aspell" to install aspell while easy_install doesn't seem to have that. pyaspell.py is like the python wrapper of the library. I'm not sure if it is appropriate to put it here.
-
-
This doesn't really fit in the block, with regards to the try/except and comment. Since you're providing spellerror yourself, I'd just pull this line out of the block: lexer.add_filter('spellerror') try: # This is only available in 0.7 and higher lexer.add_filter('codetagify') except AttributeError: pass
-
Remove this line (enchant and pygments are both "3rd party" modules and go in the same block of imports).
-
-
Python lets you do this in one line via a "list comprehension" spell_errors = [err.word for err in spell_checker]
-
Since this is both fetching a tuple and returning that same tuple, you can just iterate over a single value without unpacking it: for val in self.check_line(ttype, value): yield val