ivalkeen/vim-ctrlp-tjump

CtrlP shows no entries but tjump shows matches

gezpage opened this issue · 17 comments

Seems to jump straight to the declaration when there is only one match, but if there are more it shows CtrlP window with == NO ENTRIES ==

However if I use :tjump at the same position I get the old list of matches which I can jump to by entering the number.

My ctags file is generated by a git hook: https://github.com/greg0ire/git_template/blob/master/hooks/php/ctags/update-ctags

Could you, please, move your cursor on the identifier you want to search tags for and then run this command: echo taglist('^'.expand('<cword>').'$') and send me output?

Sure:

[{'cmd': '/^public function getUser()$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject/app/cache/dev/classes.php'}, {'cmd': '/^public function getUser()$/', 'static': 0, 'name':
 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject/app/cache/prod/classes.php'}, {'cmd': '/^    public function getUser($username)$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/
Dev/git/sf2testproject/src/Acme/DemoBundle/Service/Service.php'}, {'cmd': '/^    public function getUser()$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject/vendo
r/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php'}, {'cmd': '/^    public function getUser()$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject/vendo
r/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php'}, {'cmd': '/^    public function getUser()$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject/
vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php'}, {'cmd': '/^    public function getUser()$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject.bdm
-voice.co.uk/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php'}, {'cmd': '/^    public function getUser()$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject
/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php'}, {'cmd': '/^    public function getUser();$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject.
bdm-voice.co.uk/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php'}, {'cmd': '/^    public function getUser()$/', 'static': 0, 'name': 'getUser', 'kind': 'f', 'filename': '/home/gez/Dev/git/
sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php'}, {'cmd': '/^    protected function getUser($roles = array(''ROLE_FOO''))$/', 'static': 0, 'name': 'getUser', '
kind': 'f', 'filename': '/home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Core/Authentication/Token/RememerMeTokenTest.php'}]

Hm, looks good. Do you launch this plugin using keyboard mapping? Could you try to launch is by executing command: call ctrlp#tjump#exec(expand('<cword>')) (your cursor must be on the identifier you want to search tags for).

Still nothing I'm afraid:

:call ctrlp#tjump#exec(expand(''))

 == NO ENTRIES ==

:tjump

  # pri kind tag               file
> 1 F   f    getUser           /home/gez/Dev/git/sf2testproject/app/cache/dev/classes.php
               public function getUser()
  2 F   f    getUser           /home/gez/Dev/git/sf2testproject/app/cache/prod/classes.php
               public function getUser()
  3 F   f    getUser           /home/gez/Dev/git/sf2testproject/src/Acme/DemoBundle/Service/Service.php
               public function getUser($username)
  4 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
               public function getUser()
  5 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php
               public function getUser()
  6 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
               public function getUser()
  7 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php
               public function getUser()
  8 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
               public function getUser()
  9 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php
               public function getUser();
 10 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php
               public function getUser()
 11 F   f    getUser           /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Core/Authentication/Token/RememerMeTokenTest.php
               protected function getUser($roles = array('ROLE_FOO'))
Type number and <Enter> (empty cancels): 

What version of CtrlP and this plugin are you using? Could you try it on master version (both)?

Have checked and I'm coming off the latest version of CtrlP from the master branch (kien/ctrlp.vim@daf0c01).

When I run :CtrlPTag I can see lots of tags and files but not the ones I'm interested in, almost as if it's looking in a different tags file.

Might be worth noting that using the YATE plugin (https://github.com/vim-scripts/yate) I can browse my tags fine as well.

Looks as if it's a CtrlP issue then?

Looks like it fails to load tselect output (which seem to be correct) into ctrlp. Could you, please, run this command and send me output:
echo map(taglist('^'.expand('<cword>').'$'), 'v:key + 1 . "\t" . v:val["kind"] . "\t" . v:val["name"] . "\t" . v:val["filename"] . "\t" . v:val["cmd"]')

No problem:

['1     f       getUser /home/gez/Dev/git/sf2testproject/app/cache/dev/classes.php      /^public function getUser()$/', '2      f       getUser /home/gez/Dev/git/sf2testproject/app/cache/prod/classes.php
/^public function getUser()$/', '3      f       getUser /home/gez/Dev/git/sf2testproject/src/Acme/DemoBundle/Service/Service.php        /^    public function getUser($username)$/', '4 f       getUser /home/gez/Dev/git/sf2te
stproject/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php   /^    public function getUser()$/', '5  f       getUser /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony
/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php      /^    public function getUser()$/', '6  f       getUser /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DataC
ollector/SecurityDataCollector.php      /^    public function getUser()$/', '7  f       getUser /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php        /^    public fu
nction getUser()$/', '8 f       getUser /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php      /^    public function getUser()$/', '9  f
getUser /home/gez/Dev/git/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php     /^    public function getUser();$/', '10        f       getUser /home/gez/Dev/g
it/sf2testproject/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php       /^    public function getUser()$/', '11 f       getUser /home/gez/Dev/git/sf2testproject.bdm-voice.co.u
k/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Core/Authentication/Token/RememerMeTokenTest.php  /^    protected function getUser($roles = array(''ROLE_FOO''))$/']

This looks correct. Could you, please, ensure that when you launch this plugin, your search string in CtrlP is empty? Also, do you see any errors, when CtrlP window is opened? Could you also provide your CtrlP settings in .vimrc?

Also, could you run this command: :unlet g:syntax_on and try again?

Ok I think I have found the issue, CtrlP doesn't seem to be aware of my tags file unless I specify it with :set tags+=/full/path/to/tags even though I can browse tags without it.

Not sure what the solution is though as my tags files are stored in .git/tags in each project.

Will have a poke around and see if I can find a way to do this, do you still want the answer to your questions or does this clear it up?

Thanks for your help.

The solution is actually incredibly simple!

In my .vimrc:

set tags+=.git/tags

I don't know why it works with :tlist and :tjump without it though..

Thanks very much for your help. The plugin works great :)

Yes, I don't know too. But I'm glad you made this work for you!

Ok just as a footnote I've realised that Vim fugitive https://github.com/tpope/vim-fugitive automatically looks for a tags file in .git/tags which is why it works using the basic tags commands.

@gezpage, I've updated master version, and it now should respect tags added by fugitive, so I believe, it should work now without adding .git/tags to .vimrc (just like :tjump and :tselect do). Would be great, if you could confirm this.

Hi @ivalkeen thanks for the update. I've just tested though and still having the same problem where it can't find the tags.

Have confirmed I'm using latest changes from the master branch and inspected file to confirm your updates are there.

@gezpage, thanks a lot for testing this.