RDoc, ri and code completion in jEdit


(Robert McKinnon) #1

I’m implementing naïve Ruby code completion for the jEdit editor, using
ri to find classes and methods. I would like to use the ri Tagged
output format, so I have installed the latest ri from sourceforge,
v1.8b.

What version of RDoc is compatible with an ri version that can create
Tagged output?

The RDoc v1.0pr1 that is installed with Ruby 1.8.1 doesn’t seem to
generate output understood by ri v1.8b. (For example, the rdoc output
doesn’t contain an index file expected by ri v1.8b). I’m running the
command:
rdoc --ri -o /usr/local/lib/ruby/site-ruby/ri

Thanks,
Rob

···

Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools


(Dave Mail Archive) #2

The RDoc that comes with the 1.8.1 and 1.,9 branches includes its own
ri. The one on SourceForge in obsolete, and will be going away once 1.2
becomes dominate.

However, that’s good news for you, as you should be able to use the
RiCache stuff to get direct access to the documentation extracted by
RDoc. Have a look at how the new ‘ri’ works (lib/rdoc/ri/… – I think
you’ll find it’s pretty convenient for code completion and so on. The
only one caveat: right now RiCache has a fairly decent start-up time (a
second or so), so you’ll want to create one and keep it lying around.

Cheers

Dave

···

On Feb 27, 2004, at 8:56, Robert McKinnon wrote:

I’m implementing naïve Ruby code completion for the jEdit editor, using
ri to find classes and methods. I would like to use the ri Tagged
output format, so I have installed the latest ri from sourceforge,
v1.8b.

What version of RDoc is compatible with an ri version that can create
Tagged output?

The RDoc v1.0pr1 that is installed with Ruby 1.8.1 doesn’t seem to
generate output understood by ri v1.8b. (For example, the rdoc output
doesn’t contain an index file expected by ri v1.8b). I’m running the
command:


(Robert McKinnon) #3

Dave, thanks for the prompt reply. To clarify my understanding of your
comments:

  1. RDoc and ri in Ruby 1.8/1.9 are recent stable versions
  2. RDoc and ri in sourceforge are obsolete
  3. ri in Ruby 1.8.1 doesn’t support generating Tagged format output?
  4. You recommend using RI module classes directly in a Ruby script to
    lookup classes and methods.

jEdit runs on the JVM and I’ve implemented the code completion as a
BeanShell macro script. I call out to Ruby/ri by executing a system
command and taking in the resulting output stream.

Given this implementation it doesn’t seem possible to create a RiCache
and keep it lying around. Any ideas?

Cheers,
Rob

···

— Dave Thomas dave@pragprog.com wrote:

On Feb 27, 2004, at 8:56, Robert McKinnon wrote:

I’m implementing naïve Ruby code completion for the jEdit editor,
using
ri to find classes and methods. I would like to use the ri Tagged
output format, so I have installed the latest ri from sourceforge,
v1.8b.

What version of RDoc is compatible with an ri version that can
create
Tagged output?

The RDoc v1.0pr1 that is installed with Ruby 1.8.1 doesn’t seem to
generate output understood by ri v1.8b. (For example, the rdoc
output
doesn’t contain an index file expected by ri v1.8b). I’m running
the
command:

The RDoc that comes with the 1.8.1 and 1.,9 branches includes its own

ri. The one on SourceForge in obsolete, and will be going away once
1.2
becomes dominate.

However, that’s good news for you, as you should be able to use the
RiCache stuff to get direct access to the documentation extracted by
RDoc. Have a look at how the new ‘ri’ works (lib/rdoc/ri/… – I
think
you’ll find it’s pretty convenient for code completion and so on. The

only one caveat: right now RiCache has a fairly decent start-up time
(a
second or so), so you’ll want to create one and keep it lying around.

Cheers

Dave


Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools


(Dave Mail Archive) #4

Have a look at rdoc/ri/ri_display.rb: the comment at the top tells you
how to write your own plugin to format ri output any way you’d like.

Cheers

Dave

···

On Feb 27, 2004, at 12:18, Robert McKinnon wrote:

Dave, thanks for the prompt reply. To clarify my understanding of your
comments:

  1. RDoc and ri in Ruby 1.8/1.9 are recent stable versions
  2. RDoc and ri in sourceforge are obsolete
  3. ri in Ruby 1.8.1 doesn’t support generating Tagged format output?
  4. You recommend using RI module classes directly in a Ruby script to
    lookup classes and methods.

jEdit runs on the JVM and I’ve implemented the code completion as a
BeanShell macro script. I call out to Ruby/ri by executing a system
command and taking in the resulting output stream.

Given this implementation it doesn’t seem possible to create a RiCache
and keep it lying around. Any ideas?