(debian,vim,Qt,ruby) on vim : no completion but everything elseworks fine

Discussion in 'Ruby' started by lolveley, May 29, 2009.

  1. lolveley

    lolveley Guest

    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
    lolveley, May 29, 2009
    #1
    1. Advertising

  2. lolveley

    Guest

    On May 29, 8:22 am, lolveley <> wrote:
    > 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.

    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
    , May 29, 2009
    #2
    1. Advertising

  3. lolveley

    lolveley Guest

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

    a écrit :
    > On May 29, 8:22 am, lolveley <> wrote:
    >
    >> 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.
    >>

    > 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
    lolveley, May 29, 2009
    #3
  4. lolveley

    Guest

    On May 29, 5:03 pm, lolveley <> wrote:
    > a écrit :
    >
    > > On May 29, 8:22 am, lolveley <> wrote:

    >
    > >> 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.

    >
    > > 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.

    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
    , May 29, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Walzenbach
    Replies:
    7
    Views:
    601
    Steven Cheng[MSFT]
    Feb 10, 2004
  2. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    454
    Luke Kenneth Casson Leighton
    Dec 31, 2008
  3. ziggs
    Replies:
    2
    Views:
    173
    Henry Robinson
    Apr 21, 2004
  4. Replies:
    1
    Views:
    105
  5. Audrius
    Replies:
    5
    Views:
    118
    Audrius
    Sep 16, 2005
Loading...

Share This Page