Author Topic: Tagging unpredictablity  (Read 12610 times)

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Tagging unpredictablity
« on: June 21, 2007, 12:37:38 PM »
SlickEdit 12.0.1.0 on WinXP.

I have created a project with ~550 files, mostly .h with some .c and .cpp.

When I open a file and put the cursor on a symbol, the Preview window says "no matching symbol".  If I use Search->Find In Files for the symbol and go to the definition of the symbol, the Preview window now shows it. 

Go to Reference doesn't show any references other than the definition, even though the symbol is used in one file in the project.

Very frustrating.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Tagging unpredictablity
« Reply #1 on: June 21, 2007, 12:57:31 PM »
Did you create (and maybe also rebuild) your the workspace tagfile incl. references ?
Except there are some weird preprocessor macros used this should be fine... strange.
HS2

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Tagging unpredictablity
« Reply #2 on: June 21, 2007, 01:02:52 PM »
Right-click workspace in Project toolbar, select Retag Workspace.
I have also retagged all files via the Manage Tag Files dialog.

Tagging is pretty much broken for this project. 

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Tagging unpredictablity
« Reply #3 on: June 21, 2007, 01:36:32 PM »
These symptoms are mainly caused by non-matching C-Preprocessing setup.
Is there a lot of CPP stuff used in this project ?
Do you define (static inline) fct.s in your h files used in the c-modules ?
Maybe you need to check this thread: http://community.slickedit.com/index.php?topic=1515.msg6348#msg6348 too.
(workaround: add 'static' as CPP define to your file.ext setup->C/C++ Options->Other:C/C++ Preprocessing)

HS2

Dennis

  • Senior Community Member
  • Posts: 3960
  • Hero Points: 517
Re: Tagging unpredictablity
« Reply #4 on: June 22, 2007, 02:18:06 PM »
It sounds to me like the [header] file containing the symbol is not in your workspace, therefore, it is not included in the tag file.

A good way to track down these issues to to use the Symbols tool window to drill down and see if the symbol is in your workspace tag file or not.  If the symbol doesn't show up in the Symbols tool window, but when you open the file, it shows up in the Defs tool window, then either your tag file is out of date, or you do not have that file in your workspace.

Note, this is a common problem with Visual Studio solutions, because people set up the solution just so that they can build and do not add header files to the solution.

Another common problem area is extensionless C++ header files.  If you have not configured the extensionless header file stuff, SlickEdit might not see the file as C++ and it will not be tagged as you expect.

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Tagging unpredictablity
« Reply #5 on: July 10, 2007, 11:25:14 PM »
It sounds to me like the [header] file containing the symbol is not in your workspace, therefore, it is not included in the tag file.
Not the case.  The header file containing the def is part of the project.

Quote
A good way to track down these issues to to use the Symbols tool window to drill down and see if the symbol is in your workspace tag file or not.  If the symbol doesn't show up in the Symbols tool window, but when you open the file, it shows up in the Defs tool window, then either your tag file is out of date, or you do not have that file in your workspace.
Tag file is not out of date.  As I mentioned in a previous post, "Right-click workspace in Project toolbar, select Retag Workspace.
I have also retagged all files via the Manage Tag Files dialog."

Quote
Note, this is a common problem with Visual Studio solutions, because people set up the solution just so that they can build and do not add header files to the solution.
Not a VisStudio solution.

Quote
Another common problem area is extensionless C++ header files.  If you have not configured the extensionless header file stuff, SlickEdit might not see the file as C++ and it will not be tagged as you expect.
Not using 'em (extensionless C++ header files).  Most of the project is .c and .h files.

I just opened another project, updated the tag file, clicked on a symbol and tried "Go to References" -- two files are listed.  If I click on the symbol and use "Show <sym> in Symbol browser", then the References TB is updated after all the project files are scanned.  Every time.  1600+ files.

This is very frustrating -- having to use "Show <sym> in Symbol browser" and then wait for the project to be scanned.
 

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Tagging unpredictablity
« Reply #6 on: July 11, 2007, 12:55:34 PM »
Quote
This is very frustrating -- having to use "Show <sym> in Symbol browser" and then wait for the project to be scanned.
Well, not even that works.


Code: [Select]
typedef struct country_info {
HANDLE hNext;
char countryName[MAX_COUNTRY_CODE];
} COUNTRYINFO, *pCOUNTRYINFO;

The file (country.h) is included in the project.  I used the Manage Tag Files dialog to retag the project in its entirety, and country.h specifically. 
The Preview toolbar is docked and visible.
Cursor on country_info; "Go to definition of country_info" -- "Tag country_info not found" ?!

Cursor on COUNTRYINFO; Preview TB shows source code. 

"Go to definition of COUNTRYINFO" behaves as expected. 

"Show COUNTRYINFO in Symbol Browser" -- "Tag COUNTRYINFO[typedef] not found" ?!
« Last Edit: July 11, 2007, 01:23:56 PM by Wanderer »

Dennis

  • Senior Community Member
  • Posts: 3960
  • Hero Points: 517
Re: Tagging unpredictablity
« Reply #7 on: July 11, 2007, 08:29:36 PM »
What do you see in the Defs tool window?  Make sure you have the tag type filters set to "Show all tags", and "Sort by Line Number".  You should see:

    [-] country_info
              hNext
              countryName
         COUNTRYINFO
         pCOUNTRYINFO

It's also important to note whether you see what you expect before this and after it.

Now, go to the Symbols tool window.  Again, make sure all the filtering is turned off (click on Show all tags).
Drill into your Workspace tag file, then "Type Definitions", then tell me if COUNTRYINFO and pCOUNTRYINFO are there.  Now drill into "Structures" and tell me if country_info is there with the right members?

If you do not see anything at all, it could be that the code appears to be #ifdef's out.  This could happen if there is a conflict between the name of a #define you use and something we ship in syscpp.h.  In which case, you need to use the C Preprocessing dialog to delete the errant #define.

Anyone who ever has a tagging problem should go to the Defs tool window first, because it is a pretty good model of exactly what SlickEdit knows about the symbols in a file.

Dennis

  • Senior Community Member
  • Posts: 3960
  • Hero Points: 517
Re: Tagging unpredictablity
« Reply #8 on: July 11, 2007, 08:42:10 PM »
One other thing.  Watch out for psycho mismatching #ifdef'd braces.

Code: [Select]
void foobar()
{
#ifdef USE_TRY
     try {
#else
     {
#endif
         doSomething();
#ifdef USE_TRY
     } catch(...) {
#endif
     }
}

Your symptoms point to something like this, because it appears that the symbols are not tagged globally, but you do get some minimally working symbol analysis, as if it were being treated as a local structure definition.  That could only happen if you had mismatched braces and SlickEdit thought you were in the scope of a function.

The easy way to verify against that is to open a blank line above the typedef and look at the "Current Context" toolbar.  If your braces are right, it should say "no current context", since you aren't sitting on a symbol.  Otherwise, if it shows some function name, then I hypothesized correctly.

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Tagging unpredictablity
« Reply #9 on: July 11, 2007, 10:23:41 PM »
What do you see in the Defs tool window?  Make sure you have the tag type filters set to "Show all tags", and "Sort by Line Number".  You should see:

    [-] country_info
              hNext
              countryName
         COUNTRYINFO
         pCOUNTRYINFO

It's also important to note whether you see what you expect before this and after it.

In the Defs window, I right-click, and check Sort by Line Number, Show Hierarchy, and Quick Filters->Show All Tags.
Defs window screenshot, below, Defs1.

Quote
Now, go to the Symbols tool window.  Again, make sure all the filtering is turned off (click on Show all tags).
Drill into your Workspace tag file, then "Type Definitions", then tell me if COUNTRYINFO and pCOUNTRYINFO are there.
They are NOT shown.

Quote
Now drill into "Structures" and tell me if country_info is there with the right members?
NOT shown.

Quote
If you do not see anything at all, it could be that the code appears to be #ifdef's out.  This could happen if there is a conflict between the name of a #define you use and something we ship in syscpp.h.  In which case, you need to use the C Preprocessing dialog to delete the errant #define.

Anyone who ever has a tagging problem should go to the Defs tool window first, because it is a pretty good model of exactly what SlickEdit knows about the symbols in a file.

How do I figure out which #define is causing the problem?  Never mind, I used View->Selective Display->Preprocessor Directives, and there are no #defines that would be in syscpp.h.

I have sent a project with a single .h file to Support; maybe that will help get this figured out.

Thanks for your help.
« Last Edit: July 11, 2007, 10:35:47 PM by Wanderer »

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Tagging unpredictablity
« Reply #10 on: July 11, 2007, 10:38:36 PM »
The easy way to verify against that is to open a blank line above the typedef and look at the "Current Context" toolbar.  If your braces are right, it should say "no current context", since you aren't sitting on a symbol.  Otherwise, if it shows some function name, then I hypothesized correctly.
Followed your instructions -- opened a new line above
typedef struct country_info {

"no current context".

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Tagging unpredictablity
« Reply #11 on: July 13, 2007, 04:41:02 PM »
Running on WinXP.

Something changed (broke!?) in the tagging mechanism from v11 to v12. 

I have created a small project in SlickEdit v11. 
It behaves as I am used to -- it is able to go to definitions, lists all references to a symbol, etc.

If I open the same project i V12, it still behaves as expected.

If I delete the <project>.vtg, and open the project in v12, v12 rebuilds the tag file, and does a lousy job of it.  "Show <sym> in Symbol browser" says "Tag <sym> not found".  "Go to References..." lists 1 of 4 references, etc.

My small project has 1 .h file and 2 .c files.

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Tagging unpredictablity
« Reply #12 on: August 22, 2007, 06:14:46 PM »
New problem:
I have opened a VisStudio .sln file in SlickEdit 12.0.2.

Open a .h file; click on a globally-scoped variable and select "Go to references".  One reference is listed.

More:
Tools-Options->File Extension Setup->Context Tagging, "Go to Definition navigates to symbol definition (proc)" is CHECKED.  But 'Ctrl-.' jumps to the prototype....
« Last Edit: September 04, 2007, 05:58:10 PM by Wanderer »