Programmer's Language-Aware Spell Checker? 452
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?"
Eclipse WTP 3.3 Europa seems to do this.. almost. (Score:5, Informative)
Visual Assist (Score:3, Informative)
Next silly question, please.
Editors with a spell checker (Score:1, Informative)
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
FxCop (Score:2, Informative)
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...
Re:Keep text in dedicated files (Score:3, Informative)
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.
Re:It's a good question ... (Score:5, Informative)
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.
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:3, Informative)
The idea isn't anywhere near as nuts as you think it is, provided you make a habit of using meaningful variable/class names.
Re:Visual Assist (Score:1, Informative)
No, it doesn't. See listed spelling features. [wholetomato.com] It will spell check normal language (looks like only comments) and highlight *mistyped* symbols, not mispelled symbols.
Next wrong answer, please.
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:2, Informative)
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.
FxCop (Score:5, Informative)
http://www.gotdotnet.com/Team/FxCop/ [gotdotnet.com]
Re:What is wrong with people? (Score:1, Informative)
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.
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:1, Informative)
Not exactly. I is a word. Lower case I should get a red line still.
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:3, Informative)
Re:How about this (Score:2, Informative)
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:2, Informative)
(Suns Java seems to be good at detecting some of those by default when it complains about unreachable return statement)
Re:How about eyeball Mk 1? (Score:2, Informative)
linkers/loaders used to generate lists of names (Score:2, Informative)
Re:Man Dies Waiting for Eclipse to Launch (Score:5, Informative)
Re:Visual Assist (Score:3, Informative)
Re:Visual Assist (Score:3, Informative)
Just FWIW, it checks typing in both comments and (perhaps more importantly) string literals. It's also "intelligent" enough to know (for example) that '%d' should not be treated as a problem in a string literal. It is true, however, that symbols that are misspelled don't get highlighted, provided the misspelling is consistent.
Re:Man Dies Waiting for Eclipse to Launch (Score:1, Informative)
And it wasn't that funny or topical when he first posted it, earlier this week.
Emacs - ispell-check-comments (Score:3, Informative)
Re:Man Dies Waiting for Eclipse to Launch (Score:0, Informative)
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:3, Informative)
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.
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:3, Informative)
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.
Re:Flyspell (Score:3, Informative)
(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 "?"))