<div>Hi!</div><div><br></div>Let me add some new findings about omni-completion when modules are in use. Even the following snippet will show "pattern not found":<div><div>module A</div><div> class B</div><div> def c</div>
<div><br></div><div> end</div><div> end</div><div>end</div><div><br></div><div>a = A::B.new</div><div>a.#<C-x><C-o></div><div><br></div><div>By setting @@debug to true in rubycomplete.vim i see these messages when trying to complete for the first time:</div>
<div><div>input a.</div><div>variable</div><div>load_buffer_class(a) START</div><div>vartype A::B</div><div>load_buffer_class(A::B) START</div><div>load_buffer_class err: (eval):1:in `get_completions': uninitialized constant VimRubyCompletion::A</div>
</div><div><br></div><div>For some reason module A is not eval'ed to create the constant. In load_buffer_class the line:</div><div> classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")') </div>
<div><br></div><div>returns nil.</div><div><br></div><div>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?</div><div>
<br>
</div><div>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.</div>
<div><br></div><div>Jarmo</div><br><div class="gmail_quote">On Sat, Dec 25, 2010 at 7:44 PM, Jarmo <span dir="ltr"><<a href="mailto:jarmo.p@gmail.com">jarmo.p@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi!<div><br></div><div>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:</div>
<div><br></div><div># a.rb</div><div>class A</div><div> def my_method</div><div> end</div><div>end</div><div><br></div><div># b.rb</div><div>require "a"</div><div>a = A.new</div><div>a. # <C-x><C-o> will show my_method</div>
<div><br></div><div>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?</div>
<div><br></div><div>In my vimrc i have currently these lines:</div><div><font face="arial, sans-serif"><span style="border-collapse:collapse"><div>autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete</div>
<div>autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1</div><div>autocmd FileType ruby,eruby let g:rubycomplete_rails = 1</div><div>autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1</div>
<div><br></div><div>Also, when i use modules then the omni-completion doesn't seem to work at all - even if i restart vim:</div><div># a.rb</div><div><br></div><div>module MyModule</div><div> class MyClass</div><div>
def my_method</div><div> end</div><div> end</div><div>end</div><div><br></div><div># b.rb</div><div>MyM #<C-x><C-o> shows no matches</div><div>MyModule::MyC #<C-x><C-o> shows no matches</div>
<div>a = MyModule::MyClass.new</div><div>a. #<C-x><C-o> shows no matches</div><div><br></div><div>To conclude i have two problems:</div><div>1) how to refresh omni-completion data?</div><div>2) how to make omni-completion work with module namespaces?</div>
<div><br></div><div>I'm relatively new to vim so please apologize for my ignorance.</div><div><br></div><font color="#888888"><div>Jarmo</div></font></span></font></div>
</blockquote></div><br></div>