Bug 385816

Summary: KDevelop has problems with multiple projects with same structure
Product: [Applications] kdevelop Reporter: Victor <vicfernrod>
Component: file treeAssignee: kdevelop-bugs-null
Status: CONFIRMED ---    
Severity: major CC: eugene.shalygin+bugzilla.kde, mail
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Victor 2017-10-16 15:43:22 UTC
I have the same project on two different folders, each of them in a different git branch.
This way I can refactor one branch in the other branch.

The issue is, KDevelop fails to understand files from different folders, but same name, are different, so, when telling KDevelop to 'Jump to', even on a method in the same file, it opens the same file, but from the other project, so I end up modifying both branches, while the idea was to have one of them untouched.
Comment 1 Victor 2017-10-16 15:50:21 UTC
Forgot to add that I have both projects open in the same session of KDevelop
Comment 2 Sven Brauch 2017-10-16 16:17:18 UTC
Yes, a similar problem occurs when you have headers of a project installed which is also open in KDevelop. It will sometimes go to the installed headers, sometimes to the local files. I'm not sure what to do about it, maybe prefer symbols from the same project?
Comment 3 Victor 2017-10-19 07:36:36 UTC
It seems like the solution to me
Comment 4 Kevin Funk 2017-10-19 07:36:41 UTC
> I'm not sure what to do about it, maybe prefer symbols from the same project?

That sounds like a good idea to me.
Comment 5 Eugene Shalygin 2021-08-04 00:43:14 UTC
Also had two branches checked out in different dirs and both open in the same session. 

And KDevelop jumped to the source code in the second project from the first one when using "Jump to declaration" or "Jump to definition". Even after I unloaded the second project. And even after I then restarted KDevelop. And after I removed ~/.cache/kdevduchain (and restarted KDevelop once again). How is that possible?
Comment 6 Sven Brauch 2021-08-04 10:28:39 UTC
I think the actual bug is explained above.

To explain your particular behavior, you probably still have some files open from the old project. Then the parser kicks in on those and you get the wrong symbols.

Try "close all", close KDevelop, remove cache and restart.
Comment 7 Eugene Shalygin 2021-08-04 14:29:57 UTC
Thank you, it turned out I had one crashed KDevelop instance in the KDE bug handler.