Programmer's Language-Aware Spell Checker?
Jerry Asher writes "Not all of my coworkers are careful about spelling errors. Sometimes this causes real embarrassment as spelling errors creep into software interfaces. Does anyone know of spell checkers for programming languages? I don't want a text spell checker, I want a programming-language-aware spell checker. A spell checker that I can pass all of my code through and will flag spelling errors in function names, variable names, and comments, but will ignore language keywords, language constructs and expressions, and various programming styles (camel code, or underscores, or...). I want a spell checker that knows that void *functionSigniture(char *myRoutine) contains one spelling error. Does anyone have such a thing for Java or C++? Are there any Eclipse plugins that do this?"
The version of Eclipse I run, Eclipse WTP 3.3, does spell checking on comments as standard. Not for variable, function names and the like though. It's a decent first attempt though. In truth, I turned it off within the first few hours. It underlines any mistakes in red which I find really annoying when scanning code as I keep thinking I've seen syntax errors. More often than not my eyes are drawn to a spelling mistake, which in many cases isn't even really a mistake, which distracts me from what I'm actually trying to look at.
Visual Assist for Visual Studio does this.
Next silly question, please.
This isn't quite what you want because you have to select the text to be checked but its better than nothing !
Hope this helps
Art Makers Just an excuse to show photos of naked women !!
Okay, so it's only for Managed Assemblies (C#, VB.NET, J#, etc), but it does spell-checking, acronym-checking, and case-checking, which is nifty. Along with the other slew of introspection rules (some of which are a PITA to implement, even if it does increase the quality of the finished product).
The $$$ version of Visual Studio (the Team Suite version) comes with an introspection engine for VC++ though, it's not as flexible as FxCop but does the basics.
Then there's the countless "Spellchecker" plugins available for IDEs everywhere, VS, Eclipse, NetBeans, etc...
If you maintain a library that is used by customers, that would be a *very* big issue. You just broke backwards compatibility for a spelling fix.
Overall, the answers to the submitters question are absolutely horrible so far. If the tool he's searching for doesn't exist, it damn well should.
As a non-native English speaker, working in a non-native english speaking team (mainly french speaking people) it is a real problem. The biggest problem happens when you search something and don't find it because you wrote it right and your coworker wrote it wrong. (Or the inverse, I don't claim to be perfect in English)
Sure, you might say, "Write your code in French", but that's not a solution. My mother tongue is Dutch, we have a German coworker, and you never know if the next guy will be Italian. There is also this team that has to maintain code written by Spanish people.... in Spanish.... and they don't know Spanish. Fun times, if you like to hear them curse....
In multilingual environments this problem increases drastically.
For the record, 'I' is a word. Also plenty of spellcheckers will ignore one or two letter words.
The idea isn't anywhere near as nuts as you think it is, provided you make a habit of using meaningful variable/class names.
++ Say to Elrond "Hello.".
Elrond says "No.". Elrond gives you some lunch.
More like WTF are you on man?? If a compiler is able to work out what a variable is, what piece of code does what, which bit's of text are going to be displayed, then another spell checking program can be written to recognise this too!! It would be tricky, and there are many circumstances where it could be circumvented but why not still use it to prevent a possible spelling error, and the circumstances where it cannot tell what the word is, so what. Those circumstances you learn to spell but there's nothing wrong with another program to help prevent it!
This is a good idea, and one that can be implemented. Just because it's hard to do it right, and would need to be done seperately for different languages doesn't change the fact it would still be useful and help prevent errors.
Who need's speling and grammar?
For .net languages, FxCop does some of this checking, even understanding camel casing and underscores in tokens. And a bunch more, since it is a static code analysis tool.
http://www.gotdotnet.com/Team/FxCop/
No, you do. Fowler's asserts "no agreement" and advises your approach in cases of ambiguity. To be specific: the comma would have been obligatory had there been a possibility of reading "spelling and pretty much any other ability..." as two items that make up "programming". This misinterpretation is impossible by virtue of the implied "etc." in the final item.
It is quite possible that your remark applies to the simplified version of English spoken across the pond
And they might carry on being misunderstood when the spellchecker ignores context or is not available. Every man has his own set of priorities, but only the most arrogant offloads the responsibility of making his language easily decipherable.
For the record, 'I' is a word.
Not exactly. I is a word. Lower case I should get a red line still.
Yeah, not to nitpick but, you see; 'i', being a variable-name, would be a properly camel-cased 'I' from the point of view of the spellchecker.
Religion is what happens when nature strikes and groupthink goes wrong.
I should add that if you do use underscores to separate words, just put 'tr/_/ /' in the perl code instead of that [a-z][A-Z] stuff.
-- Ed Avis ed@membled.com
Sure, it's the halting problem. We all know that. But there are several common cases where you can deduce that there is an infinite loop in the code. It won't catch all infinite loops, but that doesn't make it useless.
(Suns Java seems to be good at detecting some of those by default when it complains about unreachable return statement)
Opera does have a spell check in it. You right click on the text box and select "Check spelling". http://www.opera.com/support/tutorials/opera/spell check/index.dml
how about hacking the linker map file to generate a list of function/variable names? ie, "ld -M". then run the resulting word list through a standard spell checker. the thing is, all you really need is a way ti generate a list of names...
Credit where credit is due -- this is an excerpt from Stevey's Tech News, Issue #1.
And it wasn't that funny or topical when he first posted it, earlier this week.
Still a great IDE after all these years...
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Ripped off from http://steve-yegge.blogspot.com/2007/09/steveys-te ch-news-issue-1.html.
1. The stop-problem is undecidable only on a device with infinite RAM, if you put an upper bound on the RAM, you get a decidable problem (in theory only).
2. There are some practical ways to construct proofs that a loop ends (remember the CS lectures). Sure, it's not a perfect solution, but if you can't construct a proof that the loop ends, you'd better rethink the loop, and possibly rewrite it.
Its impossible for a computer program to be constructed which can do so for all cases (hence, the halting problem), but that doesn't mean that its impossible to detect some infinite loops, or to detect constructs which are particularly likely to be infinite loops, either of which could, in theory, be useful features in an IDE.
Spelling/grammar checkers for human language aren't flawless, either, but they still have utility. The fact that perfection in a task is impractical or even provably impossible doesn't rule out useful applications.
hate replying to myself, but it missed what they key part...
;; mostly copied from flyspell-small-region
;; (flyspell-word)
(require 'flyspell)
(require 'cc-subword)
(defvar ps-flyspell-check-subwords nil
"*Non-nil if Flyspell should check subwords separately.
If this variable is set to non-nil, an identifier such
MyLongFunctionName will be treated as four separate words (My,
Long, Function, Name) for the purposes of Flyspell.")
(defadvice flyspell-region (around subword-checking (beg end))
"Check individual subwords if ps-flyspell-check-subwords is set."
(if ps-flyspell-check-subwords
(save-excursion
(if (> beg end)
(let ((old beg))
(setq beg end)
(setq end old)))
(goto-char beg)
(let ((count 0))
(while (< (point) end)
(if (and flyspell-issue-message-flag (= count 100))
(progn
(message "Spell Checking...%d%%"
(* 100 (/ (float (- (point) beg)) (- end beg))))
(setq count 0))
(setq count (+ 1 count)))
(if (>= (length (car (save-excursion (flyspell-get-word nil)))) 5)
(flyspell-word))
(sit-for 0)
(let ((cur (point)))
(c-forward-subword 1)
(if (and (< (point) end) (> (point) (+ cur 1)))
(backward-char 1)))))
(backward-char 1)
(if flyspell-issue-message-flag (message "Spell Checking completed."))
(if (>= (length (car (save-excursion (flyspell-get-word nil)))) 5)
(flyspell-word) 'nil))
ad-do-it))
(ad-activate 'flyspell-region)
(defun flyspell-get-word (following &optional extra-otherchars)
"Return the word for spell-checking according to Ispell syntax.
If optional argument FOLLOWING is non-nil or if `flyspell-following-word'
is non-nil when called interactively, then the following word
\(rather than preceding\) is checked when the cursor is not over a word.
Optional second argument contains otherchars that can be included in word
many times.
Word syntax described by `flyspell-dictionary-alist' (which see)."
(let* ((flyspell-casechars (flyspell-get-casechars))
(flyspell-casechars-non-initial (if ps-flyspell-check-subwords
(downcase flyspell-casechars)
flyspell-casechars))
(flyspell-not-casechars (flyspell-get-not-casechars))
(ispell-otherchars (ispell-get-otherchars))
(ispell-many-otherchars-p (ispell-get-many-otherchars-p))
(word-regexp (concat flyspell-casechars
flyspell-casechars-non-initial
"*\\("
(if (not (string= "" ispell-otherchars))
(concat ispell-otherchars "?"))
(if extra-otherchars
(concat extra-otherchars "?"))
BSD is for people who love UNIX. Linux is for those who hate Microsoft.