Author |
Topic |
|
trave
New Member
United Kingdom
5 Posts |
Posted - Jun 21 2018 : 04:11:42 AM
|
Hi,
We have a coding standard that says that #includes should always include the path to a project include path, so that they can be copied between source files safely.
It would be extremely useful if VAssistX had an option to obey this when using its "Add Include" feature. Currently, if the header file is in the same folder as the source file, then it is included with no path. This works fine, of course, but we then need to go and edit it to obey our coding standards.
I think others would also find this useful. Is it something you could add? |
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
|
trave
New Member
United Kingdom
5 Posts |
Posted - Jun 26 2018 : 04:18:40 AM
|
Thanks. That looks useful, but unfortunately it doesn't seem to work in my case.
I've got "HKCU/Software/Whole Tomato/Visual Assist X/VANet15/AddIncludePreferShortestRelativePath" set to 00, and am using VS2017, with VA_X.dll file version 10.9.2270.0 built 2018.04.30. "Add Include style" under "Code Generation" in the VA Options is set to "" (i.e. it isn't one of the "Limit to filename" styles).
But, when I right-click on an undefined class, whose definition is in a header file in the same directory, the #include just includes the filename, not the directory.
Is the difference here that the header is in the same folder? In the example given on that page, the header is one folder up from the source file. |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jun 26 2018 : 1:36:32 PM
|
*ah* yes, I forgot about that. We have a feature request to add an option to always add includes relatively to project base directory:
case=33851
I've added your voice to the case. |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 24 2018 : 2:30:12 PM
|
case=33851 is implemented in build 2291 -- see Add Include path on the Code Generation page of the VA Options dlg. |
|
|
trave
New Member
United Kingdom
5 Posts |
Posted - Sep 26 2018 : 07:17:55 AM
|
Thanks Sean.
Having updated to build 2291, though, I'm not seeing any difference in behaviour between the three options in that drop down.
Our project uses property files for most project settings. Our additional include folders come directly from these; they're defined as "%(AdditionalIncludeHeaders)", and the inherited values include (for the case of the file I'm using) "..\..\Game\Independent". Note that the project files are in a subfolder of the "Workspaces" folder, which lives next to the "Game" folder.
Now I'm editing a file within "Game\Independent\Map", and am including a file that is in the "Server" folder below that. No matter which option I choose, I get the same result: when I right-click on a symbol, and select "Quick Actions and Refactorings (VA)" / "Add Include", the line that is added is:
#include "Server/Header.h"
But I need (to match our coding standards, which helpfully allow #include lines to be copied between files, as not everybody uses Visual Assist):
#include "Map/Server/Header.h"
The docs say: 'If you select "Prefer path relative to project", ensure that the path of your project is in Additional Include Directories at Project | <Project Name> Properties | Configuration Properties | C/C++ | General.', so presumably our additional include headers are not quite right. It feels as if it should work, though! |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 26 2018 : 11:25:52 AM
|
Where is the project file? The new setting attempts to generate a directive that is rooted to the directory of the vcxproj. It sounds like case 33851 may not have been the right place for your feature request if the vcxproj is in the Map dir. |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 26 2018 : 11:29:05 AM
|
It looks like you want a setting to only create directives based on include dirs, removing .\ from contention? |
|
|
trave
New Member
United Kingdom
5 Posts |
Posted - Sep 26 2018 : 11:39:05 AM
|
That is correct, yes :)
The project file is in .../Workspaces/ProjectName, and the source files are in .../Game/**/ (where ... is the root path of the folder structure).
So it seems to be a related but different case to case=33851. |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 26 2018 : 11:49:07 AM
|
I think I understand the request and have opened a new case: case=119619.
But I'm not sure I understand the result VA gave you with the new setting. I think that because the header was not below the dir where the vcxproj is located, it couldn't create a directive that made sense so fell back to default behavior. |
|
|
trave
New Member
United Kingdom
5 Posts |
Posted - Sep 26 2018 : 12:13:22 PM
|
Thanks Sean. |
|
|
|
Topic |
|