Author Topic: Go to definition doesn't prompt for all choices even option is set? beta1  (Read 1461 times)

rowbearto

  • Senior Community Member
  • Posts: 1672
  • Hero Points: 119
See attached file, gotodef.cc.

With a clean config, under Tools->Options->Languages->Application Languages->C/C++->Context Tagging, both "Prioritize navigation" and "When there are multiple choices" are set to "Prompt with all choices".

However, when I put cursor on "funcname" on either line 1 or line 3 and press Ctrl+. (go to definition), I am not prompted with choices, it goes back and forth between the definition and the declaration each time I press Ctrl+.

In my own config, I have "Prioritize navigation" set to "Symbol definition(proc)" and When there are multiple choices set to "Prompt with all choices", but I am still not prompted for all choices?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2971
  • Hero Points: 440
This is by design.  If the cursor is already on the line of the function definition or declaration, it will just go to the the other one.  No point in prompting you to jump to the line you are already on.

There is a related utility that some people may not be aware of:  edit-associated-symbol (Alt+`).  This will toggle you between the function declaration and definition.  You don't even have to be on the function name, just hit Alt+' when you cursor is anywhere in the function, and it will go the prototype (and vice-versa).  Handy for fixing argument lists.

rowbearto

  • Senior Community Member
  • Posts: 1672
  • Hero Points: 119
This was a simplified test case. My real situation had the prototype repeated in many many .cc files as well in a .hh file. When I pressed Ctrl+. where the function was called, it kept going to various prototypes in the many .cc files, when my purpose was to find which .hh file it was declared in so that I could #include it. So because of this, I could not quickly find which .hh file the prototype was in. If I got the dialog showing me the choices, I could have easily found the .hh file - but I was unable to do so without getting prompted.

Perhaps if the prototype is repeated in many files, you can provide a dialog with the choices.
« Last Edit: August 21, 2018, 03:37:05 pm by rowbearto »

rowbearto

  • Senior Community Member
  • Posts: 1672
  • Hero Points: 119
Attached is a simple tar ball example. Notice the prototype is now repeated in gotodef2.cc.

Pressing Ctrl+. toggles between 3 different places.

Now pretend there are files gotodef3..gotodef100, so 97 more prototypes!

I didn't write this code, I think many developers over time copy/pasted code, yet this is the situation I'm in :(

In cases like this, I would like a dialog so I can find the header file.

Otherwise it would be easier to keep doing the copy/paste like the others, extending the bad practice.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2971
  • Hero Points: 440
OK.  I think I can tweak this special case without doing too much harm.

rowbearto

  • Senior Community Member
  • Posts: 1672
  • Hero Points: 119
Thanks! I like how when there is only 1 prototype and 1 definition, not to put up the dialog to choose. But if there are multiple repeated prototypes, would be nice to get the dialog.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2971
  • Hero Points: 440
The fix will be in the next v22.0.2 hot fix, as well as the next v23 beta drop.

rowbearto

  • Senior Community Member
  • Posts: 1672
  • Hero Points: 119
Thanks!

rowbearto

  • Senior Community Member
  • Posts: 1672
  • Hero Points: 119
Just tried this with beta2, and the issue is still there.

I'm guessing you just missed the cut for getting this into beta2?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2971
  • Hero Points: 440
Yep, it will be in beta3.

rowbearto

  • Senior Community Member
  • Posts: 1672
  • Hero Points: 119
Checked that it is fixed in beta3, thanks!

One comment, if I choose one of the definitions and end up going there, then it puts me at the beginning of the line. Pressing Ctrl+. again after that doesn't reopen the dialog, just gets me to cycle through each reference. However if I move the cursor into the middle of the function name, then I'm presented with the dialog. I think I'll like this behavior, but I'll see over time as I use it.

Thanks again!

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2971
  • Hero Points: 440
That is by design.  Repeating Ctrl+. or Ctrl+, only works when you are cycling through choices, once you do anything else, you are out of that mode.

It kind of has to be that way, because if you move the cursor and hit Ctrl+., most likely you are looking to jump to a different place.