FIle position jumps away when coming back

Why am I not getting back to the last position/line in the file I was working in when I just went to another file and then back? It jumps to a class start in the middle of the file instead.

1

Hi,

How exactly do you navigate to another file (like, “Go to declaration” or just switch the tab) and back ("go back" or by tab)?

Also, what file types are affected?

0

Switching tab and php files :)

 

Edit: Not exactly swithing tab. But both tabs are open. But I switch by clicking the files in the Tree view.

0

Thank you for the clarification.

I vaguely remember some similar reports in the past but was not able to reproduce it on my setup currently.
But might be I am missing something obvious here. Would it be possible to record a short screencast? 

0

Here is a screen recording: https://drive.google.com/file/d/1k-84vcpRFtV6PGreCas32mIMPMlrHQYI/view?usp=drive_link

Hope it work? It's always when I go back to the file functions-participant.php when it jumps down to that class in that file.

0

Similar: WI-72953

On related note: WI-45181 → WI-46425

Peterwesterlund 

Would be good if you describe what your classes are. Ideally even provide 2 or 3 of such files (can replace their content, but as long as it reproduces the issue with those files in a brand new empty project with those files only.)

1

@Peterwesterlund, Sorry, I cannot open this screencast without your permission (I have requested one from my @jetbrains.com email account). 

 

0

Sorry, it's now open for “everyone with the link” :)

0

Thanks!

I have managed to reproduce it now (I wonder how it was not reproducible for me before). As Andriy fairly noticed above, most probably, this is it:
https://youtrack.jetbrains.com/issue/WI-46425/Allow-to-disable-placing-caret-on-the-class-name

Do you have only one class in that affected file on a screencast?
It does not matter even if IDE does not consider this file as class only (no class icon when class name is the same as filename).

Turns out that it is not reproducible in these cases:
- More than one class (interface, trait) in one file;
- When you switch already open files via tabs/switcher;
- If “Open files with single click” option is enabled and you use single-click to open the file (no caret is placed anywhere unless you place it but not automatic navigation to the class definition either).

I will add an internal link to this thread to the aforementioned YouTrack issue to draw some extra attention to it.

1

Ah, also, this type of automatic navigation is disabled if class has PHPDoc, even without any tags:

Not an elegant but some kind of a workaround.

1

Thank you for the answer and the workarounds! That's perfectly good solution for me. That and the good support here make me comfortable to buy the license :) (my trial ends tomorrow)

0

Thank you, I am happy to hear that! :)

0

请先登录再写评论。