shawncplus / phpcomplete.vim

Improved PHP omnicompletion
http://www.vim.org/scripts/script.php?script_id=3171
595 stars 110 forks source link

C-] opens the definition on an existing buffer and not the current buffer #69

Open dsdeiz opened 9 years ago

dsdeiz commented 9 years ago

For some weird reason C-] opens a definition on an existing buffer and not the current buffer. Is this an expected behavior?

complex857 commented 9 years ago

Do you mean (this is my best guess) that if you have the file with the definition already in a buffer then it somehow makes a difference when hitting the c-] combination compared to when you don't?

I'm not sure what do you mean by existing vs current buffer. Could you please ellaborate on this?

dsdeiz commented 9 years ago

Oops, sorry. This is how I can reproduce it:

  1. Open a file which is now on window A.
  2. C-W C-] on a function call (at this time it opens the file on window B and goes to the definition - somewhat messed up my terms, should've been window instead of buffer)
  3. On window B, C-] on another function call. This time it opens the function definition on window A.

I was assuming on the 3rd step, it would simply open the file with the function definition on window B but instead it opened it on window A.

complex857 commented 9 years ago

Oh, i see. This jump-to-definition feature works by vim's own :tag command (prefixed with the number) so i guess that this is how it's supposed to work, but would worth checking if the behaviour changes when the plugins is disabled.

dsdeiz commented 9 years ago

Yeah it's different without the plugin. On the 3rd step, it would open on window B when pressing C-] on a function call in window B. Not sure if it's relevant but :map <C-]> produces a call to phpcomplete#JumpToDefinition('normal').

complex857 commented 9 years ago

Thanks for looking into this for me! At this moment i have no clue of the reasons behind this, but I'll try to get the bottom of this.