Bug 139092 - provide switch .h <-> .cpp
Summary: provide switch .h <-> .cpp
Status: RESOLVED DUPLICATE of bug 359136
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 3.3.93
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-21 15:55 UTC by Maciej Pilichowski
Modified: 2018-03-25 21:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Pilichowski 2006-12-21 15:55:25 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs

3.3.93

I have .h file with almost complete class definition, only construct is moved to .cpp file. I use [F2] to switch between .h and .cpp files. And it works fine. But I added before two last methods in .h file a commet

// -------------------------------------------------------------------------------------------------------

to separate them. When I press F2 near the second method the cursor jumps at the first line of the first method (below the line). When I press F2 again nothing happens. If I remove this comment F2 works as intended.
Or if I move more up.

Of course I would like F2 just switches the files.
Comment 1 Amilcar do Carmo Lucas 2006-12-21 16:14:18 UTC
Getting a newer version from SVN might help.

3.3.94 fixes 256 bugs
3.4 SVN fixes extra 66 bugs.
Comment 2 Maciej Pilichowski 2006-12-21 17:56:24 UTC
3.3.94 -- still there. Btw. it works on any // comment really.
Comment 3 Maciej Pilichowski 2006-12-21 20:07:54 UTC
Ok, I guess I know where the bug is -- the behaviour of the switch is changed.

When the .h is active switch search for the definition in .cpp if there is none, it does not make a switch. If the user is outside the method the switch is performed.

While the search for the method definition is pretty nice, the rest is regression. The search should be an extra thing, but the switch should be performed all the time.
Comment 4 Jens Dagerbo 2006-12-21 21:25:40 UTC
This should work.. and does here.

Can you provide more info about your project? What buildsystem are you using? What are the paths of the respective files?
Comment 5 Maciej Pilichowski 2006-12-21 21:36:26 UTC
> This should work.. and does here. 

Here, sometimes. With 3.3.5 there was no search, but switch was 100% reliable. I can include those two files as attachment.

> Can you provide more info about your project? 

C++ code, nothing fancy. Just one class. 

> What buildsystem are you using?

make.

> What are the paths of the respective files? 

The same. So it is 
/home/macias/prg/mambo/source/Builder.h
/home/macias/prg/mambo/source/Builder.cpp

Btw. I don't say there is no switch at all, I am just saying that I have to put cursor in empty line, or at the first line (#define) which guarantees the switch.

 
Comment 6 Alexander Dymo 2006-12-21 21:52:51 UTC
If you have function implementation in .h file and have your cursor positioned there then the switch will not work because it will decide that implementation is already at the cursor.
This does make me think that we shall separate switch header/source from switch decl/def.
Comment 7 Maciej Pilichowski 2006-12-21 21:58:42 UTC
Alexander, thanks for explanation -- so it is changed as I suspected.

Yes, such switch as would be good, because (at least I don't see it) there is no way to get "smart-switch" (combined those two in one).

Btw. the decl/def switch should be a bit smarter, if I am outside the def/decl. it should find the nearest one and then switch. Currently it is mixed def/decl/header/source :-) because of lack of such find.
Comment 8 Andreas Pakulat 2008-07-06 15:29:16 UTC
fixing up this wishlist report. KDevelop4 has no "switch .h/.cpp" but just a switch from declaration to definition (and vice versa). also this applies to cpp support not ada.
Comment 9 Milian Wolff 2009-07-20 16:30:44 UTC
There is CTRL + SHIFT + C to switch .h and .cpp files. Marking as fixed.
Comment 10 Andreas Pakulat 2009-07-21 07:21:59 UTC
sorry, but as I said, we don't have a "switch .h/.cpp", we only have "switch decl/def" which is a significant difference.
Comment 11 Olivier.jg 2010-12-19 06:37:34 UTC
I would debate that being a significant difference, especially since, when not in a decl/def context, it does switch between .h/.cpp.
Comment 12 Milian Wolff 2010-12-20 00:38:44 UTC
sometimes you want to switch quickly to the header and don't move the cursor, i.e. to the last position you where in. Right now ctrl + tab does that but it's not as fast as a single shortcut. So there is still place for this.
Comment 13 Olivier.jg 2010-12-20 02:10:39 UTC
But you'll only have to move the cursor in the event that the header for the function you're editing is not the header for the file you're editing.
How many times do you want to switch back and forth between a header and a function that's completely unrelated to the header?
Comment 14 Olivier.jg 2010-12-20 02:15:40 UTC
Sorry milian, I completely missed your point, I didn't think about that.
Comment 15 Kevin Funk 2018-03-25 21:45:56 UTC

*** This bug has been marked as a duplicate of bug 359136 ***