开发者

Problem with Ruby OmniComplete in Vim 7.3 finding matches at one line but not 2 lines down

开发者 https://www.devze.com 2023-03-30 00:52 出处:网络
Im trying to figure out why ruby omnicompl only works sometimes for me. Here it\'s working as expected.

Im trying to figure out why ruby omnicompl only works sometimes for me.

Problem with Ruby OmniComplete in Vim 7.3 finding matches at one line but not 2 lines down

Here it's working as expected.

Problem with Ruby OmniComplete in Vim 7.3 finding matches at one line but not 2 lines down

But when I try the same thing on the same ivar 2 lines down I get "Pattern not found"

Both are done the same way, typing out @current_user_session.fiCtrl+X+O

I checked tpopes rails.vim github page for open/closed issues and tried to google it without luck.

My macvim and vim is compiled with +ruby

:echo &omnifunc returns rubycomplete#Complete

:Rails! returns rails.vim 4.3 (Rails-controller)

I have my complete vimdir o开发者_高级运维n github for reference.


one would imagine that it's because in img2 it's now below the setting of the variable (@current_user_session = UserSession.find).

which means that as this is now an instance it's looking for instance methods, whereas before it was returning the class method.

e.g.

User.find # => fine


user = User.find
user.find # => Method not found

to demo the difference run these:

User.methods.sort
User.find.methods.sort

you'll see that it's quite different. put bluntly you're trying to look up 'find' for a user you have. "'tom'.find" doesn't make any sense.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号