Switching Header / Implementation takes wrong file

René J.V. Bertin rjvbertin at gmail.com
Thu Apr 7 09:27:28 BST 2016


On Wednesday April 06 2016 23:36:45 Erik Rull wrote:

>- I select the source file prj1/a.h in the first project and select "Switch
>Header and Implementation" and get the file prj1/a.cpp - fine.
>- I open the file prj2/a.h and select there "Switch Header and
>Implementation" and get again prj1/a.cpp and not as expected prj2/a.cpp.
>
>Any ideas why this happens? I use kdevelop 4.7 on kubuntu 14.04.

I've seen similar things happen when I use the context menu to go to the declaration or definition of a function that exists in multiple projects. It can be quite annoying if you don't notice the mix-up and start editing the wrong file.

>From what I deduce, the indexer/tagger ("ktags" :)) is clever enough to take header files from an open project instead of copies from the system header path (though I think I've already seen cases where it wasn't) but apparently it doesn't have a prioritised search algorithm where it will take an indexed file from the same/active project over an otherwise identical file from another project.

Suggestion: I think the titlebar could provide more useful information if it didn't try to show everything. Instead, showing just the session name, active project and the path of the active file (the latter 2 separated by whitespace) will make it easier to take in the relevant info in a glance and reduce the chance that part of it gets truncated. One could re-assess the order (the session name could come last, for instance) but ultimately it will depend on if the titlebar text is centred or left/right aligned what part of the text might get truncated. It should however be possible to compare the rendered width to the window width in order for instance to drop less relevant information (I have no idea if one can know the titlebar font on all platforms, however).

R.



More information about the KDevelop mailing list