Author Topic: Defs and Refs problems  (Read 5026 times)

Wanderer

  • Senior Community Member
  • Posts: 558
  • Hero Points: 23
Defs and Refs problems
« on: November 16, 2008, 04:19:51 pm »
Hello,

My class has overloaded functions like
  doIt(InterfaceA * pifc)
  doIt(InterfaceB * pifc)

When I right-click on a use
  InterfaceA * pIfcA = /* something */;
  doit(pIfcA);
and select "Go to References to doIt", I am given a list of the two versions of doIt() to choose from.  Regardless of the version I choose, SlickEdit lists all references to all versions.

Similarly, if I right-click on doIt(ifcA) and choose "Go to definition of doIt", I have to choose from a list of all versions, both declarations and definitions.  In this case, I am guessing SlickEdit only looks at the function name, and not the parameter list.  It would be nice if the params were evaluated; if I have 5 overloads, the list is 10 entries...

UPDATE:  This problem is very tedious.  I am working in the same handful of overloaded functions; when I click on a function call, I want to go to that specific overload's definition.  Since I have "Options->Languages->Application Languages->C/C++->Context Tagging->Go to Definition->Prefer to navigate directly to symbol definition" checked, why are the prototypes listed in the Select Symbol dialog?  Removing the prototypes would cut the number of entries in the dialog in half.  (Of course, the right thing is to go to the correct def w/o presenting all overloads in a list....)
« Last Edit: November 18, 2008, 12:05:54 am by Wanderer »

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Defs and Refs problems
« Reply #1 on: November 18, 2008, 02:59:11 pm »
Have you tried using "Attempt to filter out non-matching function overloads (expensive and slow)?" It's on the Context Tagging options under the "Prefer to navigate directly to ..." settings. That should filter out the non-matching overloads, but I can't predict just how "expensive and slow" it will be for you.

I'm looking into why the prototypes are being listed. It does seem that they should be in a case like this.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Defs and Refs problems
« Reply #2 on: November 18, 2008, 03:26:33 pm »
OK, the setting I suggested before only applies to "Go to Definition", not "Go to Reference". As for the issue with both prototypes and functions being listed, I can't replicate that. No matter what I do, I'm only getting the functions listed in the Select Symbol dialog. The "Prefer to Navigate directly to..." settings only apply to "Go to Definition". So, having selected a function in the Select Symbol dialog, I am presented with a list of references to all symbol references using the same symbol name--no type matching is done to filter this list.

Wanderer

  • Senior Community Member
  • Posts: 558
  • Hero Points: 23
Re: Defs and Refs problems
« Reply #3 on: November 18, 2008, 04:06:29 pm »
Have you tried using "Attempt to filter out non-matching function overloads (expensive and slow)?" It's on the Context Tagging options under the "Prefer to navigate directly to ..." settings. That should filter out the non-matching overloads, but I can't predict just how "expensive and slow" it will be for you.

I'm looking into why the prototypes are being listed. It does seem that they should be in a case like this.
Thanks, Scott, that setting helps, and it doesn't seem to add too much overhead.
Here's an odd case -- when symbol is in a #if 0/#endif block, SE prompts with a list of declarations and definitions.



ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Defs and Refs problems
« Reply #4 on: November 18, 2008, 09:03:57 pm »
OK, I got the story on this one. The Select Symbol dialog will always display the full set of declarations and definitions regardless of your settings. The thought is that since a choice is required anyway, you might as well have a comprehensive list of choices.

Wanderer

  • Senior Community Member
  • Posts: 558
  • Hero Points: 23
Re: Defs and Refs problems
« Reply #5 on: November 19, 2008, 07:07:47 pm »
Now what?  "Go to Definition" only works intermittently, even on a function that is not overloaded.  If the Preview toolbar is visible, the def and the decl are listed, but Ctrl-. doesn't do anything.
If I turn off "Attempt to filter out non-matching....", it works as expected, but then I have the frustration with the overloaded functions...


Wanderer

  • Senior Community Member
  • Posts: 558
  • Hero Points: 23
Re: Defs and Refs problems
« Reply #6 on: December 03, 2008, 04:29:30 pm »
Now what?  "Go to Definition" only works intermittently, even on a function that is not overloaded.
I now think that "Go to Definition" does not work for a non-overloaded function when "Attempt to filter out non-matching...." is checked.
Is there a workaround for this problem, other than turning off "Attempt to filter..."?
Is this likely to be addressed in the near future?


ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Defs and Refs problems
« Reply #7 on: December 04, 2008, 08:39:32 pm »
It seems to be working for me. The only problem I get is that sometimes it can't rule out the overload. I've never seen a case where it fails to find the definition, regardless of whether it is overloaded or not.

Can you boil this down to a small workspace that reliably demonstrates the problem and attach it to a post? That should help us figure out what's going on.

Wanderer

  • Senior Community Member
  • Posts: 558
  • Hero Points: 23
Re: Defs and Refs problems
« Reply #8 on: December 04, 2008, 09:43:01 pm »
Can you boil this down to a small workspace that reliably demonstrates the problem and attach it to a post? That should help us figure out what's going on.
Here ya' go....
Line 32, main.cpp, cursor on collectByID(), click "Go to Definition..."
« Last Edit: December 04, 2008, 09:45:16 pm by Wanderer »

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Defs and Refs problems
« Reply #9 on: December 15, 2008, 03:04:02 pm »
I just wanted to give you an update. I was able to reproduce this problem using the workspace you posted. Thank you very much for that! I can't tell you how frustrating it is to read problems and then not be able to reproduce them.

Anyway, I've forwarded this on to the appropriate developer and we'll see what he has to say.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2068
  • Hero Points: 256
Re: Defs and Refs problems
« Reply #10 on: December 16, 2008, 08:05:45 pm »
Thanks for the example.  An updated 13.0.2 hot fix will be available by the end of the week.