Author |
Topic |
|
FriendlyRabbit
Junior Member
Germany
20 Posts |
Posted - Oct 12 2023 : 02:18:04 AM
|
I just learned about Create file functionality thanks to the tip of the day. It's quite nice but why doesn't it cover the most common usecase: to create a header and source pair, e.g. MyNewClass.cpp and MyNewClass.hpp?
In XCode, when creating a source file, there is a simple checkbox whether to create the corresponding header automatically. Can you do the same?
In Visual Studio, typically source files are in a directory "code" and header files in a directory "include". It would be nice if the created files could be put into the corresponding directories automatically. Maybe you can look at the currently open file and check its paths for header and source file. Allowing to customize the paths in the dialog would also be useful. |
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 12 2023 : 11:41:38 AM
|
We are already considering allowing you to set the directory that is used by Create File, so another vote for this is interesting:
case=97919
Creating both files in one go is reasonable. The basic design we have taken with our refactoring and code generation commands is to keep the commands simple and focussed, so you can chain them together to achieve the specific result you want. This is to try and avoid having complex dialogs and commands that try to offer all of the possible options you need in one place.
Still, a check box to make both files in one go is reasonable, so I have put in a feature request for this:
case=150152
For the directories that the files are being created in, is Create File failing to pick up the directory of the file you are sitting in when you trigger it? It should be using this as a guide to set the directory it is using. |
zen is the art of being at one with the two'ness |
Edited by - feline on Oct 12 2023 11:42:00 AM |
|
|
FriendlyRabbit
Junior Member
Germany
20 Posts |
Posted - Oct 13 2023 : 01:33:32 AM
|
Yes, Create File seems to use the directory of the currently open file. This is a good default of course. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 13 2023 : 07:29:44 AM
|
Thank you for confirming that, I was slightly concerned from your comments that this wasn't working correctly for you.
The problem with "expected" directories for files to be placed into is that different people and organisations have different standards, so what is reasonable for one person isn't reasonable for someone else. So apart from picking up the current file location, letting you set the directory to use is probably the best plan, unless you have a suggestion?
Any larger solution is likely to have the code split into multiple directories, so even a "default" directory stops working quite quickly. |
zen is the art of being at one with the two'ness |
|
|
FriendlyRabbit
Junior Member
Germany
20 Posts |
Posted - Oct 13 2023 : 08:20:03 AM
|
If I was to implement it, I would extend what you are already doing without adding any settings but by deducing the paths from the context
It looks to me as if "Create file" and "Create header/source pair" should be separate commands:
For Create file: Put the new file into the same directory as the current document. Let the user customize the path in the dialog. It is already shown but not modifyable. I would make it a simple entry field (just as "Name"), filled with the known path. I would also add a "..." button to open a file dialog.
For Create header/source pair: Do it similar to above, but with two customizable paths. Check if the current document is source or header. Find the corresponding header or source file. Use these paths as the default for header and source paths. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 16 2023 : 07:44:59 AM
|
Why a separate command to make the pair, and not just a check box / setting in the dialog? Or is this because of the possible need to set two paths? Some dialogs already add or remove fields depending on what you are doing, so that seems a reasonable enough approach. |
zen is the art of being at one with the two'ness |
|
|
FriendlyRabbit
Junior Member
Germany
20 Posts |
Posted - Oct 23 2023 : 01:45:02 AM
|
I am not a GUI developer. If you prefer to make one dialog, that is fine with me . I hope this feature gets a high priority. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 23 2023 : 11:27:53 AM
|
It is in the list of things to consider, but I am not sure about high priority. Keeping the building blocks small and simple is a design decision we took with the refactoring and code generation features. It does sometimes take a couple of steps to achieve what you want, but it gives you the flexibility to do so however you want. |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|