omni-completion refresh

Jarmo jarmo.p at
Sun Dec 26 00:58:03 EST 2010


Let me add some new findings about omni-completion when modules are in use.
Even the following snippet will show "pattern not found":
module A
  class B
    def c


a =

By setting @@debug to true in rubycomplete.vim i see these messages when
trying to complete for the first time:
input a.
load_buffer_class(a) START
vartype A::B
load_buffer_class(A::B) START
load_buffer_class err: (eval):1:in `get_completions': uninitialized constant

For some reason module A is not eval'ed to create the constant. In
load_buffer_class the line:
  classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")')

returns nil.

Is there any better way to debug the Ruby code within rubycomplete.vim than
with those dprint() statements? Any chance to use ruby-debug there somehow?

Should the code completion even work with today's Ruby? I can see from the
github history that there hasn't been much of an action lately with
rubycomplete.vim, but that could mean anything of course.


On Sat, Dec 25, 2010 at 7:44 PM, Jarmo <jarmo.p at> wrote:

> Hi!
> I've finally got Ruby code completion working sort of, but not as i'd
> really like it. Currently it doesn't show the new methods added to some
> class if code-completion has already used. For example, if i have files like
> these:
> # a.rb
> class A
>   def my_method
>   end
> end
> # b.rb
> require "a"
> a =
> a. # <C-x><C-o> will show my_method
> Now if i open a.rb in a separate buffer and add some new method and save
> the file then again in the b-buffer omni-completion doesn't show the newly
> added method. I have to restart vim to make it show me the new method too.
> Is it possible to make vim reload the omni-completion data?
> In my vimrc i have currently these lines:
> autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
> autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
> autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
> autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
> Also, when i use modules then the omni-completion doesn't seem to work at
> all - even if i restart vim:
> # a.rb
> module MyModule
>   class MyClass
>     def my_method
>     end
>   end
> end
> # b.rb
> MyM #<C-x><C-o> shows no matches
> MyModule::MyC #<C-x><C-o> shows no matches
> a =
> a. #<C-x><C-o> shows no matches
> To conclude i have two problems:
> 1) how to refresh omni-completion data?
> 2) how to make omni-completion work with module namespaces?
> I'm relatively new to vim so please apologize for my ignorance.
> Jarmo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the vim-ruby-devel mailing list