Forum: Ruby (debian,vim,Qt,ruby) on vim : no completion but everything else works fine

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Olivier L. (Guest)
on 2009-05-29 11:25
(Received via mailing list)
Hello,

I have a little/big problem with vim and ruby.
little because almost all works fine : on debian I installed
vim,vim-ruby,ruby1.8,qt4-qtruby, and Qt.
on vim I have the syntax coloring that's working, and a program like
"print
require 'Qt4' " returns true : Qt4 is recognized.

but I have not the completion for Qt : if I enter "a=Qt:: " +CTRL X+CTRL
O,
I have the messsage "pattern not found" .

on vim I have:
:set ofu?     =>  omnifunc=rubycomplete#Complete
:set ft?       =>  filetype=ruby
:filetype      => all 3 are ON

can you help me to have the completion?
or maybe I have made a mistake, an oversight.

thx,

olivier.







___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son
interface révolutionnaire.
http://fr.mail.yahoo.com
unknown (Guest)
on 2009-05-29 16:30
(Received via mailing list)
On May 29, 8:22 am, lolveley <removed_email_address@domain.invalid> wrote:
>
> on vim I have:
> :set ofu?     =>  omnifunc=rubycomplete#Complete
> :set ft?       =>  filetype=ruby
> :filetype      => all 3 are ON
>
> can you help me to have the completion?
> or maybe I have made a mistake, an oversight.
Code completion with QtRuby will only work if you are interacting with
running code with a tool such as irb. It won't work with static
environments like vim. So I would run irb as well as vim to try things
out, and also use the command line 'rbqtapi' tool to introspect the
QtRuby api.

-- Richard
Olivier L. (Guest)
on 2009-05-29 20:07
(Received via mailing list)
removed_email_address@domain.invalid a écrit :
>> but I have not the completion for Qt : if I enter "a=Qt:: " +CTRL X+CTRL O,
> Code completion with QtRuby will only work if you are interacting with
> running code with a tool such as irb. It won't work with static
> environments like vim. So I would run irb as well as vim to try things
> out, and also use the command line 'rbqtapi' tool to introspect the
> QtRuby api.
>
> -- Richard
>
>
>
well, it's amazing : I have succeeded in having the completion of Qt
classes and methods by typing : let g:rubycomplete_buffer_loading=1.

olivier.





___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son
interface révolutionnaire.
http://fr.mail.yahoo.com
unknown (Guest)
on 2009-05-29 20:36
(Received via mailing list)
On May 29, 5:03 pm, lolveley <removed_email_address@domain.invalid> wrote:
> >> require 'Qt4' " returns true : Qt4 is recognized.
> >> or maybe I have made a mistake, an oversight.
> classes and methods by typing : let g:rubycomplete_buffer_loading=1.
Oh, that's intesting. I was assuming that vim code completion worked
by statically analyzing the ruby sources. But if it works with QtRuby
it must mean it is running code and doing introspection. Nearly all
method calls in QtRuby are trapped by method_missing() and then
forwarded as C++ invocations. So that means that the Ruby methods
don't really exist as such, they are not defined with rb_define_method
() or as Ruby code.

irb(main):002:0> Qt::Widget.instance_methods.sort
=> ["==", "===", "=~", "QT_TRANSLATE_NOOP", "QT_TR_NOOP", "SIGNAL",
"SLOT", "__id__", "__send__", "acceptDrops", "acceptDrops=",
"accessibleDescription", "accessibleDescription=","accessibleName",
"accessibleName=", "actions", "activateWindow", "activeWindow?",
"addAction", "addActions", "adjustSize", "attribute=",
"autoFillBackground", "autoFillBackground=", "backgroundRole",
"backgroundRole=", "baseSize", "baseSize=", "blockSignals", "childAt",
"children", "childrenRect", "childrenRegion", "class", "className",
"class_name", "clear
...


So vim must be making Ruby method calls like the above to know about
QtRuby methods (instance_methods() queries the 'Smoke' library runtime
to find the names of the Qt C++ methods).

-- Richard
This topic is locked and can not be replied to.