T O P I C R E V I E W |
Karma000 |
Posted - Mar 28 2024 : 2:33:31 PM Just installed the visual assist trial. I see "Move class to new file (beta)" and saw it as a new feature in 2023.6 but it's always greyed out. How do I use this?
I've tried right clicking the file, right clicking the class name, selecting the whole class, it's always greyed out.
Thank you!
|
5 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Apr 03 2024 : 12:18:12 PM Thank you for finding that, I am seeing the same problem here now I know what to try. I have put in a bug report for the macro stopping Move Class being offered:
case=164401
For specifying the directory that the new file will go into, I have put in a feature request for this:
case=164403
That could add a fair bit of complexity to things, but I can certainly see how this will help and be a popular addition. |
Karma000 |
Posted - Apr 02 2024 : 12:09:32 PM 1 - Both are using SLNs 2 - Single header files without a matching CPP, the "Move class to new file (beta)" command is there. 3 - "Create File" is there in all cases. 4 - I'm not sure what you mean by stable include directories, but none of the directories here (System Include Files, Source Files) are where my solution is stored.
In testing a simple header/cpp, I think I have found what is causing the issue. Some classes are using a DLL_EXPORT macro to dynamically __declspec(dllexport) or dllimport depending on the presence of EXPORTS defined in preprocessor directives. These classes look like this:
class DLL_EXPORT classname
with:
#ifdef EXPORTS #define DLL_EXPORT __declspec(dllexport) #else #define DLL_EXPORT __declspec(dllimport) #endif
With these classes, the "move to new file" doesn't appear. If I just remove that DLL_EXPORT tag, move the file, and re-add it, this works fine. So I think that's the problem and it has an easy work around.
However, I did notice that I can't change the target directory of the file, and have all the #includes update dynamically, which is what I was actually trying to do. So, unfortunately for me it doesn't really do what I was hoping for! Any chance of this being a possibility? You can do this in Eclipse in Java software for instance, very helpful. |
feline |
Posted - Apr 02 2024 : 08:21:14 AM Are both solutions using a SLN file, or is one of these a CMake project, or something else?
In the problem solution, do you have any single cpp or .h files, files where Alt-O doesn't do anything? I assume you have several header files without a matching cpp file. If you can easily find such a file, can you open it and see if VA is offering the "Create File" command? It should be offered in the Alt-Shift-Q, refactoring context menu, and also in the VAssistX menu under Code Generation and Refactoring.
I want to see if VA thinks it is able to offer this command at all in your problem solution.
With the problem solution open, if you look at:
VA Options -> C/C++ Directories
do VA's stable include directories overlap with the directories where your solution is stored? If this is happening it might explain why this command isn't being offered.
If Create File is being offered, and the stable include directories don't overlap, can you add a new, empty header file to the solution, and make sure Create File is being offered in this file.
Then add a new, simple C++ class to the file, and see if Move class to new file is being offered? It is possible the problem is tired to a widely used header file that is used in the solution. If it is something like this then it should be file specific, where file specific is actually most files. |
Karma000 |
Posted - Apr 01 2024 : 09:09:52 AM It works in a different solution I have here. Seems to be specific to this solution. Is there anything I can do to help you narrow it down? |
feline |
Posted - Mar 29 2024 : 07:50:52 AM Strange, this option is being offered to me.
Can you please try creating a new C++ solution, and adding a simple class to a header file, and see what happens? If we can get this to be offered for you under these conditions, then we can work from there. If even that test fails then something quite odd is going on. |
|
|