Author Topic: tag include directories  (Read 2890 times)

scsnow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
tag include directories
« on: January 14, 2014, 12:47:49 pm »
I'm using v18.0.1.2.
Is it possible to tag include files (Project properties -> Directories -> Includes)?
I could follow #include definition to see contents of header, but referred symbols from this header are highlighted as undefined, so I assume that symbols are not tagged at all.

I found out that it's only possible if I do either:
1) Add these headers into the project tree
2) Add these includes into build-in include compiler directories used for that project
Both options are ugly.

Thanks

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: tag include directories
« Reply #1 on: January 14, 2014, 03:48:10 pm »
There are a couple other approaches. Hopefully you'll find one of them palatable.

Method 1 - An Auto-Updated Tag File
1. Create a new empty C++ project inside a new workspace. Add the include directories you need tagged. Tag the workspace. This will create a .vtg tag file. Close this workspace when tagging is done.
2. Open your other workspace file (.vpw) in an editor as a text/XML file. We need to hand-edit the XML before we open it as a project.
3. Add a <TagFiles> XML node to your workspace .vpw file, as a child of the workspace node, specifying the name and relative path of the .vtg you created in step 1.
Code: [Select]
<Workspace>
...
   <TagFiles>
   <TagFile File="MyIncludeProject.vtg" AutoUpdateFrom="../path/to/MyIncludeProject.vtg"/>
   </TagFiles>
...
</Workspace>
The tags from the include directory project will now be available to this workspace, and won't be visible in other workspaces that do not have this <TagFiles> entry.

Method 2 - A 'non compiler' language mode tag file
Use this simple way if you don't mind the includes being visible to other projects that use the target language. (I'm assuming you're doing C/C++)
1. Go to the Tools > Tag Files menu item, and in the dialog that pops up highlight the "C/C++ Tag Files" section.
2. Click the "Add Tag File" button at the bottom.
3. In the dialog that pops up, make sure C/C++ is selected in the first drop-down box.
4. Fill out the Save As: field (C:\Path\To\MyIncludes.vtg) and the Source path: field.
5. Check the "Recursive" option if necessary, as well as pick the file specs and exclude specs.
6. Click OK, and the file will be generated.
This tag file will expose tags to all C/C++ projects, regardless of what compiler is being used, and without having to manually add the <TagFiles> section to individual workspaces.

« Last Edit: January 14, 2014, 03:50:26 pm by Matthew »