lyuts / vim-rtags

Vim bindings for rtags, llvm/clang based c++ code indexer.
BSD 2-Clause "Simplified" License
282 stars 56 forks source link

Undefined variable "ch" with latest vim-rtags #76

Open rajukv opened 7 years ago

rajukv commented 7 years ago

Using latest vim-rtags with vim 7.4.1689(Ubuntu 16.04 default), I get the following errors when I try to "FindRefs" or "JumpTo"(pretty much every command throws a similar error).

Error detected while processing function rtags#JumpTo[7]..rtags#ExecuteThen[2]..rtags#ExecuteRCAsync: line 41: E121: Undefined variable: ch E15: Invalid expression: {ch, data -> rtags#HandleResults(ch_info(ch).id, data, 'vim_stdout')} line 42: E121: Undefined variable: ch E15: Invalid expression: {ch, data -> rtags#HandleResults(ch_info(ch).id, data,'vim_exit')}

lyuts commented 7 years ago

It is strange how it actually got past those checks for job/channel which are not supposed to be available for vim 7.4. Which git commit are you on? I tried using vim 7.4 and got a different error. 054cd89 should fix for the error I got on my old version of vim. Could you give a try and let us know if that works for you?

rajukv commented 7 years ago

I am on c6dcdd4f67484f3e1e94a06a2f56012449fd5528

rajukv commented 7 years ago

I pulled your commit 054cd8970eda8e222fc5b4c7b88d2a8727d34f25, but I am still hitting the issue. I dont have any problems with neovim though

kurdybacha commented 7 years ago

I have the same issue on my Ubuntu 16.04 with: VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48) Included patches: 1-1689 Extra patches: 8.0.0056

samaursa commented 7 years ago

Same issue with Linux Mint 18.1 with the same vim version as @kurdybacha. Updating to vim 8.0 fixed all the issues. It seems that it's just vim 7.4 that the plugin has trouble with. I am new to rtags so I can't comment about much more than that.

therivenman commented 7 years ago

I think this link might shed some light on this issue: https://www.reddit.com/r/vim/comments/44qgn0/vim_patch_741274_adds_job_functionality_not/

On Ubuntu 16.04 ViM 7.4-1689 returns true for both the job and channel features, as they are both technically there, although I imagine they are not fully compatible with the API implemented in ViM 8.0...

Might I suggest adding a version check to avoid this problem on older versions of ViM.

guigui64 commented 6 years ago

Same issue on commit fbfa692. Any improvement on the matter?

extr15 commented 6 years ago

same problem here.

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056

4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

svuolli commented 6 years ago

Same here: Plugin commit id: fbfa69264cb0283bf00e60f860566ac33943e24a

Vim version: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 7 2018 10:50:27) Included patches: 1-1587

For vim I tried two configurations: one built with python2 and the other with python3 support.

KavenC commented 6 years ago

I got this problem when using

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056

btw this is the newest VIM in Ubuntu 16.04 package repository.

Problem solved by updating VIM to 8.0. For Ubuntu users: http://tipsonubuntu.com/2016/09/13/vim-8-0-released-install-ubuntu-16-04/

The implementation of ExecuteRCAsync uses lambda expression which I think is a feature from VIM8.0. No matter if it is using channel/job or not, I would upvote to add a version check as @therivenman has suggested.