Author Topic: how to jump to struct definition or find symbol automatically at the cursor.  (Read 3762 times)

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Hi Expert,

    in below c++ codes, I want to slickedit jump to struct definition at line 168 by type hot key CTRL+. at word "geo_location"

but it always jump to the typedef at line 15, it is not my expectation , could you please help ?

.... 15   typedef struct geo_location geo_location;

....168  struct geo_location {
....169         int x;
....170         int y;
....171  };

another question is,  I can invoke "Find Symbol" dialog form, but I have to manually input the symbol name in "search for" edit box, is there any method to invoke the "Find Symbol" Dialog with the word at cursor automatically?

PS, my slickedit version is 19.0.2.5

Thanks,
Lusu
 

Tim Kemp

  • Senior Community Member
  • Posts: 546
  • Hero Points: 92
In Tools->Options->Languages->Application Languages->C/C++->Context Tagging, set Prioritize navigation to Symbol definition (proc).

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Tim,

    I set it per your suggestion, but it doesn't work :-(

btw: I can use "Find Symbol" dialog to get the definition of symbol then jump to line 168. but I have to type "geo_location" in "search for" editbox, it doesn't fill the word at cursor to "search for" editbox automatically:-(.
and I am also confused about push_tag , why "Find symbol" can get the structure's definition but push_tag cannot?

Thanks,
Lusu

Tim Kemp

  • Senior Community Member
  • Posts: 546
  • Hero Points: 92
Sorry, I misread your example. I don't know how to do this.

Edit:
I was looking at the options and see, Ignore forward class declarations. Have you tried that?
« Last Edit: July 28, 2016, 12:31:48 PM by Tim Kemp »

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Tim,
    I try the "ignore forward class declarations", it doesn't work too.

I try to reproduce it by a tiny c++ file. here it is

// test.cpp ,  g++ test.cpp -o test
#include <stdio.h>

typedef struct geo_location geo_location;

int dummy_global_int1;
int dummy_global_int2;

struct geo_location {
    int x;
    int y;
};

int main () {
    geo_location test; // please move cursor to geo_location in this line, and type CTRL+.

    test.x = 1;
    test.y = 2;
    printf("x = %d, y = %d\n", test.x, test.y);
    return 0;
}

looking forward to solution to this issue.

Thanks,
Lusu

Tim Kemp

  • Senior Community Member
  • Posts: 546
  • Hero Points: 92
Probably not the ideal solution, but if you tell SlickEdit to go to the definition of a member of the structure instead of the structure itself it works fine.

Dennis

  • Senior Community Member
  • Posts: 3989
  • Hero Points: 519
There will be a fix for this in the next beta for v21.

For what it is worth, a typedef like that is almost always unnecessary in C++, it is just a carryover from C.

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Hi Dennis,

    Thanks you very much! I see v21 beta 2 is ready and it include
"Fix bug distinguishing between typedef and struct with same name, for example: typedef struct duck duck", I am going to download and try it!

   btw: is it possible to fix it in 19.0.2.5? (I buy this version last year, and had plan to upgrade it next year)

Best Regards
Lusu