Ruby Screnshot of the Weeek #17: Spelll Checkinng


One of my favorite plugins for NetBeans 5.5 was Jan Lahoda's spell checker.
It turns out Jan has updated it to work with NetBeans 6.0, so I wrote some bindings for it to work with Ruby as well.
Briefly, it highlights spelling errors in comments and documentation (=begin/=end) sections. This also works in
embedded Ruby code in RHTML files, and in RHTML files it also spell checks the text content. Ok, screenshots:





The above is the documentation for Rails' url_for method. As you can see there are a couple of typos.
If you place the caret on one of the words a lightbulb will appear in the left side gutter; press Alt-Enter
to see the possible fixes:





As you can see, you can very easily add known words that aren't in the default dictionary to your own private list.



Here's an RHTML/ERB file:






Since this is a file in one of my own projects, NetBeans offers to add this word to a project-specific dictionary. This wasn't available for the above Rails source file since it's in a library outside of my projects.







The Ruby spell checker currently skips words in comments that look like Ruby identifiers, such as
CamelCase words, method_name words, and :symbols. Single-character words are also skipped. Finally, it skips
rdoc preformatted text (indented comment content) since that typically contains code fragments which contain
lots of unrecognized words. It might be an interesting improvement to try to help with typos in actual
class and method names, such as a "Controler", but I've gotta figure out a way to avoid generating tons of false positives here (what's a Scanf? :-)


I've uploaded a version which should work with NetBeans 6.0 here. Unzip it, then go to the Tools | Plugin Manager, open the "Downloaded" tab and install the individual nbm files. (You may have to restart the IDE.) The zip includes an English dictionary. This is the dictionary from ispell (unzip the dictionary.nbm file and you'll see it). You can add other languages in the Options dialog; these should be ispell dictionaries. You can also change the text locale in the Options dialog; when I opened some files in the RSpec distribution it immediately complained about the British spelling "behaviour" instead of the American spelling, "behavior". I presume this would be fixed by switching from en_US to en_GB (both are included).



P.S. Somebody asked me for 6.0-compatible versions of the strip-whitespace and highlight-tabs modules; here
they
are.



P.S.2. The spell checker modules obviously work for Java too; if you've been looking for NetBeans 6.0 spell checking, grab the same .zip but skip installing the ruby-bindings .nbm file.

Comments:

Missspelled word? :)

Posted by Alexis MP on August 26, 2007 at 06:47 PM PDT #

Yes, there are 4 spelling errors in the title; I thought that would be funny :)

Posted by Tor Norbye on August 27, 2007 at 12:34 AM PDT #

Doh! I only noticed the tooltip spelling error!

Posted by Alexis MP on August 27, 2007 at 12:43 AM PDT #

Doh! -I- didn't spot what you were talking about, the actual screenshot, not my blog text! I'll check in a fix (but won't rev the bits for this).

Posted by Tor Norbye on August 27, 2007 at 01:12 AM PDT #

<p>
Hi! I have a question regarding the performance of the ide.
</p>
<p>
I'm using netbeans rubyide 070810 on a Pentium 4 Prescott 2.8Ghz with 1.5 GB of ram. The thing is, i think my PC is powerfull enough to handle the ide, but <b>i keep suffering repeated short delays every time i do simple things like saving a file or browsing my project tree</b>.
</p>
<p>
For example, i press Ctrl+S, the ide saves the file, freezes for 5-10 seconds, then i can go on editing my project.
</p>
<p>
At first i thought that the problem was triggered by Java Garbage Collection because of a lack of memory on my machine, thus i convinced my boss to get me more ram on my machine.... only to see the same behavior keep happening. I wonder if is there any tweaks i could make to <b>nbrubyide.conf </b> or elsewhere to make use of the extra ram in my pc or improve the performance in other way???
</p>
Thank you!

Posted by EmmanuelOga on August 27, 2007 at 03:16 AM PDT #

Hi Emmanuel,

try adding a flag in your nbrubyide.conf to increase the heap size:

-J-Xmx512m

Let me know if that works, if not we should get some thread dumps to see what the IDE is busy doing.

Posted by Tor Norbye on August 27, 2007 at 03:29 AM PDT #

I have just added the flag (before was setted to 256). I'll restart the ide and will tell you what happened.

Thanks!

Posted by EmmanuelOga on August 27, 2007 at 04:09 AM PDT #

Mmmm here i'am again. I have been using the ide for a while and the issue keep annoying me. Sometimes i don't even have to save the file to get a lag, only by copying/pasting i get it.

How can i enable that log of threads you talked about before?

Posted by EmmanuelOga on August 27, 2007 at 04:50 AM PDT #

Hi Emmanuel,
here's how you generate a thread dump:
http://wiki.netbeans.org/wiki/view/GenerateThreadDump

Generate a few successive ones when the IDE is not responding so I can see what it's busy doing.

Then please submit the threaddumps attached to a bug report or via e-mail to me or the dev alias - see http://wiki.netbeans.org/wiki/view/RubyFeedback

Posted by Tor Norbye on August 27, 2007 at 05:27 AM PDT #

Note - you may need build #3499 or later to use the spellchecker. I had forgot to check in a tweak which gives the spell checker access to some Ruby APIs.

Posted by Tor Norbye on August 27, 2007 at 08:02 AM PDT #

Tor - BTW what is happening with the Mac Ruby Package build?(i.e. at http://deadlock.netbeans.org/hudson/job/macpkg/). There doesn't seem to have been a successful build since August 14th? Are there new Ruby updates we need to be getting via another approach?
Cheers
Greg

Posted by GregH on August 29, 2007 at 06:05 AM PDT #

Hi Greg,
the continuous build machine (deadlock.netbeans.org) is a Linux box, and it isn't possible to build OSX images on anything other than an OSX machine. Thus, the mac build is relying on ssh-ing into an OSX box for that part of the build. The OSX box in question is the home machine for Trung Duc Tran, and he's currently on vacation so I suspect the machine went down. It should hopefully be back up soon. In the meantime, if you want the latest stuff you can always get the regular rubyide.zip file and launch it from a Terminal or finder; run the "bin/nbrubyide" script.

Posted by Tor Norbye on August 29, 2007 at 06:41 AM PDT #

Hey Tor, that's really nice to see.

Got a question. The current light/white themes for the editor are driving several of us nuts. I mean to the point that folks crinkle their nose at it when they see NB for the first time. I would really like to help whomever works on the themes to create a nice dark theme that would give folks, particularly those use to nice dark themes on Mac OS X who use the likes of TextMate, a very nice alternative. What do I need to do?

Posted by ylon on September 01, 2007 at 11:16 AM PDT #

Ylon, the "Norway today" theme is pretty decent for Ruby code. Not so much for js/(r)html/css though. So yeah tweaking that one would be nice... not sure how you export and share theme's though.

Posted by Jaap on September 03, 2007 at 04:55 AM PDT #

Hi Ylon and Jaap,
I checked in Ruby-fixes for that theme last night (just in time for the beta1
freeze) so it should look roughly like this:

http://blogs.sun.com/tor/resource/bluetheme1.png

But as Jaap pointed out, it needs work for RHTML. If you do create a custom
configuration it should be easy for me to incorporate those changes by getting
some XML files from your user directory. Btw, see another dark theme here:

http://www.lifeonrails.org/2007/8/30/netbeans-not-just-a-nice-personality

It would be nice if we could join forces and come up with a great theme.
Unfortunately, while the editor can easily handle theming, it will be much
tougher to get the rest of the IDE (completion popups etc., side views like the
navigator and so on) also pick up color themes. We'll need a Swing Look and
Feel which matches the editor.

Posted by Tor Norbye on September 03, 2007 at 05:08 AM PDT #

P.S. Due to bugs, restart the IDE after switching themes such that it takes effect everywhere.

Posted by Tor Norbye on September 03, 2007 at 05:09 AM PDT #

Tor, could you contact me privatly? I see no way to contact you on this blog.

Posted by Jaap on September 07, 2007 at 12:47 AM PDT #

Hi Jaap, I don't see a way to contact you either since your comment doesn't look like it had an e-mail address, website or real name associated with it. However, see this wiki page:

http://wiki.netbeans.org/wiki/view/RubyFeedback

It contains the various feedback channels - including my direct e-mail address (but let me apologize in advance; our perimiter spam filter seems to eat a fair bit of legitimate e-mail.)

Posted by Tor Norbye on September 07, 2007 at 01:32 AM PDT #

Count me in. I would certainly like to work together to get a knockout theme in place. That would really be the icing that NB needs right now. Please give me a holler and keep me in the loop.

Posted by ylon on September 10, 2007 at 10:57 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

Tor Norbye

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today