Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 open corresponding file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mnicolella
Junior Member

14 Posts

Posted - Sep 03 2013 :  3:32:20 PM  Show Profile  Reply with Quote
Sometimes I have files like this:

Foo.h
Foo.cpp
Foo_Platform1.cpp
Foo_Platform2.cpp

When I'm in Foo_Platform1.cpp, Alt-O does nothing. I'd like it to go to Foo.h. I understand that Alt-O from there will go to Foo.cpp.

I'd like to propose an option that would let Alt-O, if it fails using the current means, to have it look at the first #include file in the current file, and go there.

Either that, or try to find the .h with the longest match to the current filename

feline
Whole Tomato Software

United Kingdom
18946 Posts

Posted - Sep 04 2013 :  9:07:31 PM  Show Profile  Reply with Quote
Is this something you often want to do? My first concern here is that this behaviour is going to seem very "random" if you don't know what to expect.

Are you aware that you can use Alt-g on a #include line, to jump to the referenced header file?

zen is the art of being at one with the two'ness
Go to Top of Page

mnicolella
Junior Member

14 Posts

Posted - Sep 06 2013 :  1:39:17 PM  Show Profile  Reply with Quote
Yes, it's common with cross-platform codebases. I know you can alt-g on an #include line, but alt-o exists just to shortcut this - currently it simply does nothing in this situation
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18946 Posts

Posted - Sep 06 2013 :  2:57:43 PM  Show Profile  Reply with Quote
Ah, now the "Platform" part of the file names makes more sense. I did not initially think of cross platform development, but its obvious when you say it

I am wary of using the first #include in the file, since sometimes people re-order these, or wrap them in #ifdef #endif blocks, so this might not be as reliable as it sounds. How reliable is the file name matching likely to be? This sounds predictable and easy to explain, which are always good features.

Can we expect the files to be grouped in similar directories, or even the same directory? Or are they sometimes in very different directories? Figuring out the matching file when files are in widely scattered directories can sometimes be a little tricky.

As a temporary solution, if you are using VS2010 or earlier, you could use an IDE macro to emulate Alt-O, and extend it to do this, a sample macro is given here:

http://support.wholetomato.com?W439

zen is the art of being at one with the two'ness
Go to Top of Page

mnicolella
Junior Member

14 Posts

Posted - Sep 06 2013 :  6:35:32 PM  Show Profile  Reply with Quote
I think the file name matching would be fine - really if you have FooSomething.cpp, find the .h file with the longest match to the .cpp file (assuming an exact match isn't found)

If people discover this feature, they will be more inclined to make the names match

As for directories, sometimes it's in the same directory. If there's lots of stuff I'll usually organize it like this:


System\       System.h
       System.cpp
       PlatformA\                 System_PlatformA.cpp
       PlatformB\                 System_PlatformB.cpp


Or maybe:


System\       System.h
       System.cpp
SystemPlatformA\                System_PlatformA.cpp
SystemPlatformB\                System_PlatformB.cpp


I'm sure others have other conventions. I know some people split .h and .cpp at a much higher level, ie 'src/' and 'include/' directories near the top level, so to answer your question: they could be in very different directories. But they would be within the solution, so maybe that doesn't matter?

We are on VS2012, so I didn't try your 2010 macro

Edited by - mnicolella on Sep 06 2013 6:36:09 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18946 Posts

Posted - Sep 07 2013 :  1:07:28 PM  Show Profile  Reply with Quote
Unfortunately Microsoft have removed the IDE macros in VS2012 and above, so this is no longer an approach that we can take.

It turns out that a form of this already exists, but it requires you use "_part1", "_part2", etc, as the file name extension. I have just set up a simple test case in VS2012 with VA 1949, and the files:

system.h
system.cpp
system_part1.cpp
system_part2.cpp

and Alt-O is working perfectly. In the first two files it just jumps between the matching files, as normal. In the two _part files you get the Alt-O menu, asking you which file you want to jump to. The menu lists the 3 other files.

The feature request is still open, to allow you to specify the file name suffix list user definable:

case=65732

but for now, if renaming your files is an option, then this already works, which was a pleasant surprise

zen is the art of being at one with the two'ness
Go to Top of Page

mnicolella
Junior Member

14 Posts

Posted - Sep 09 2013 :  12:01:42 PM  Show Profile  Reply with Quote
Oh interesting, I'll try it out - I guess my suggestion included an underscore in the filename, but in reality I didn't name my files exactly that way.

I'll give it a shot - thanks!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18946 Posts

Posted - Sep 09 2013 :  3:21:41 PM  Show Profile  Reply with Quote
I suspect none of your files are named like this, and case=65732 is open, and requesting the ability to have user defined suffixes for the files. But if renaming the files is not to much trouble then this is a way to get this working now.

Plus having the underscore as a separator, to indicate the difference between the main file name and the suffix might make things clearer down the line.

This should just work for you, but if you have any problems then please just let me know.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000