Author Topic: Go to definition jumps to declaration instead of definition  (Read 31726 times)

bereid

  • Community Member
  • Posts: 7
  • Hero Points: 0
  • Software Developer
Go to definition jumps to declaration instead of definition
« on: February 15, 2008, 05:30:28 PM »
When I position the cursor on a class member function declaration in a header file, and then use Ctrl+. to go to the definition, the cursor always jumps to the first non-blank character on the line where the declaration is; never takes me to the definition in the corresponding cpp file. However, if I position the cursor in the cpp file on a call to the class member function, and use Ctrl+., I am correctly taken to the definition.

I'm using 2008 Beta (though I have seen the behavior in 2007 version also, which I used for only a brief time before switching to 2008). Versions used prior to 2007 were 9, 10, & 11. A co-worker also sees the same problematic 'Go to' behavior with his 2007 installation (same project files).

Version 11 Ctrl+. used to present a dialog with a list of matches from which to choose. I have never seen this since using 2008 Beta.

Additional info: If I use the Find Symbol mechanism to search for the class member function, I get different results depending on the choice of 'Look in': Both declaration and definition are listed if I select either Context Tagging, Current Project, or "C" Tag Files; only the declaration (no definition) is listed if I select Slick-C Tag Files. I believe I am using Context tagging, though I'm not sure. Further, I don't know when why or how to choose which tagging mechanism to employ? As far as I can tell, that decision is set just as it was set by the install procedure.

I have verified that my 'Go to Definition navigates to symbol definition (proc)' checkbox is selected, and the alternate checkbox 'Go to Definition navigates to symbol declaration (proto)' is deselected.

I have been able to reduce the scope of my project to a single pair of cpp and h files, and the same behavior persists.

Please advise what additional information I can provide to help solve this very inconvenient problem.

Thank you

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Go to definition jumps to declaration instead of definition
« Reply #1 on: March 05, 2008, 04:00:11 AM »
Concerning 'Find Symbol' I'd propose to <Use Context Tagging®>. This is the mode I'm almost always using. It's fast and reliable. Do not use Slick-C Tag files if you want to find C/C++ tags. That won't work.
Is it possible to provide an example (e.g. cpp/h files or code snippet) where the symbol navigations doesn't work as expected ?
HS2

bereid

  • Community Member
  • Posts: 7
  • Hero Points: 0
  • Software Developer
Re: Go to definition jumps to declaration instead of definition
« Reply #2 on: March 05, 2008, 05:32:27 PM »
Thank you for the tagging recommendation. I have tried different methods, but then settled on the method you have recommended. It works partially and intermittently (from one project to the next), but fails more than it succeeds.

I am attaching a zip file containing a small subset of my project files, and a sample project that still exhibits the failure for me. I also included a screen shot containing the project pane, which shows that the files needed to permit the navigation are present in the project. The upper buffer window shows the line that was highlighted, and the position of the insertion bar at the time I attempted to navigate to the definition; the lower buffer window shows the position that I expected to arrive at after navigating. Upon pressing Ctrl+., a dialog was displayed declaring that there is no such tag, and that I should consider rebuilding the tag file. I did so using the Tools->Tag Files->Rebuild Tag File menu, but to no avail.

I hope this will sufficiently demonstrate the failure, and that a solution can be found. It will be unfortunate if I have to revert back to version 11 (whose tagging always worked correctly), with no idea how to tell when it is safe to take the plunge again in the future.

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Re: Go to definition jumps to declaration instead of definition
« Reply #3 on: March 05, 2008, 08:30:58 PM »
I can reproduce your problem, but nothing I have tried so far fixes it.  Everything seems to be tagged correctly, but SlickEdit is just going directly to the declaration and not putting up the usual dialog to let you choose the definition or the declaration.

bereid

  • Community Member
  • Posts: 7
  • Hero Points: 0
  • Software Developer
Re: Go to definition jumps to declaration instead of definition
« Reply #4 on: March 05, 2008, 08:38:33 PM »
Thank you for the feedback.

I am gratified that at leas the problem can be seen by someone other than me, so there is a glimmer of hope.

I am surprised that while at least two of the developers here at my company have experienced these persistent tagging / navigation problems with both versions 12 and 13, this hasn't surfaced elsewhere, and been resolved before now?

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Go to definition jumps to declaration instead of definition
« Reply #5 on: March 05, 2008, 08:44:32 PM »
I'm seeing the same problem, but I'm still not sure about the reason ... (still fiddeling around)
HS2

tcolgan001

  • Community Member
  • Posts: 21
  • Hero Points: 0
Re: Go to definition jumps to declaration instead of definition
« Reply #6 on: March 20, 2008, 02:34:48 PM »
I've been suffering through this problem for more then a year now (using Version 12.0.3.0).

Whether I click
. Go to definition navigates to symbol definition (proc)
. Go to definition navigates to symbol declaration (proto)

it always goes to the prototype.

Are the Slickedit people oblivious to this problem?


bereid

  • Community Member
  • Posts: 7
  • Hero Points: 0
  • Software Developer
Re: Go to definition jumps to declaration instead of definition
« Reply #7 on: March 20, 2008, 04:20:30 PM »
No, I don't the SlickEdit folks are oblivious, but perhaps less concerned than one might expect. When I sent a sample project (created with the Beta1 version) demonstrating the problem, it was apparently helpful enough that they created a hotfix for version 11. One of my co-workers who was using version 11, and had been suffering with the same problem reported that the hotfix worked. With that, I abandoned my participation in the Beta program, reverted back to version 11, applied the hotfix, and have been untroubled since.

I realize it is expected to encounter some bugs with the Beta versions, but this one is serious enough to consider crippling. I don't think I will plunge into the Beta pool again any time soon.

Good luck

davew

  • Senior Community Member
  • Posts: 224
  • Hero Points: 6
Re: Go to definition jumps to declaration instead of definition
« Reply #8 on: May 06, 2008, 11:21:01 AM »
I am now using 13.0.0/2008 (i.e. not the beta) and I am seeing a similar problem with C. In the following code, if you put the cursor on the first Func in the STATE_MACHINE table and use Ctrl-., it will go to the prototype. However, if you put the cursor on the second Func in the table, it will go to the definition.

I'm going to submit this as a problem report.

int Func();

const
FP_t STATE_MACHINE[LAST_EVENT - EVENT_BASE][LAST_STATE] =
{// STOPPED                 INIT                     SKIPPING               RUNNING
  { (FP_t)Func, (FP_t)EV_LogError,       (FP_t)EV_LogError,     (FP_t)Func  }, //CM_REQ
};


int Func()
{
}

donjoe

  • Community Member
  • Posts: 35
  • Hero Points: 1
Re: Go to definition jumps to declaration instead of definition
« Reply #9 on: January 27, 2012, 04:03:12 PM »
Still seeing this in 16.0.3: no matter what I select in Options other than "Prompt", the context menu option "Go to definition" will always take me to the declaration (which is not the jump I want to make most of the time).
« Last Edit: January 27, 2012, 04:04:50 PM by donjoe »

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Go to definition jumps to declaration instead of definition
« Reply #10 on: January 27, 2012, 07:26:41 PM »
There's an option that controls whether "Go to definition" prompts, goes to prototype, or goes to implementation.

See attached screenshot.

donjoe

  • Community Member
  • Posts: 35
  • Hero Points: 1
Re: Go to definition jumps to declaration instead of definition
« Reply #11 on: January 27, 2012, 10:37:22 PM »
Yes, there is, and this topic is about how that option is malfunctioning. :)

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Go to definition jumps to declaration instead of definition
« Reply #12 on: January 27, 2012, 11:19:29 PM »
The option consistently works properly for me on 16.0.3 (with hotfixes).
I mostly use C/C++, and haven't tried it in other languages.

I remember discussions about this in 12 and 13, and verifying that it had been fixed.  I'm unable to get it to misbehave in 16.

Can you share a small sample workspace that reproduces the problem?  That way the SE team can reproduce the problem and debug it.

donjoe

  • Community Member
  • Posts: 35
  • Hero Points: 1
Re: Go to definition jumps to declaration instead of definition
« Reply #13 on: January 30, 2012, 09:39:15 AM »
I've tested it some more and it seems that it works fine for jumping to the definition of a class method being called directly from an instance of that class ( i.e. object.method(); ), but it misbehaves when you try to jump to the definition from a call made through an interface pointer ( i.e. interfacePointer->method(); ). That's when it will always jump to the declaration instead of the definition, despite your contrary setting in the Options menu.
This happens in 16.0.3 with no hotfixes (so far as I can tell, because I haven't installed any myself).
« Last Edit: January 30, 2012, 09:43:25 AM by donjoe »

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Go to definition jumps to declaration instead of definition
« Reply #14 on: January 30, 2012, 06:02:34 PM »
What's the type of "interfacePointer"?
If the type is the interface, then how can SE know which implementation of the interface it should jump to?  SE navigates based on type.

E.g. in the following case SE can't know which implementation interfacePointer could be an instance of, and can't ever know which implementation to go to.  Maybe it could make sense in small projects to list all implementations and let the user pick, but in the large projects where I usually work there are typically hundreds (or more) of discrete implementations of an interface.

Code: [Select]
interface IFoo;
class Bar : public IFoo
{
    ...
};

IFoo* interfacePointer;
interfacePointer->method()