Author Topic: How auto-complete works?  (Read 3516 times)

eruisi

  • Community Member
  • Posts: 18
  • Hero Points: 0
How auto-complete works?
« on: July 10, 2008, 05:56:00 AM »
Where SE looks for items in completion list?

I added a user tag file to a C workspace. The tag file is built from two C head files with many
function prototypes and constant definitions.

When typing, functions/constants declared in two C head files NEVER show up in the completion list.

I also added two C files directly to the project but it doesn't help either.

BTW: I am working on pure C language, no C++ classes.

Please help me out!

Thanks!

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: How auto-complete works?
« Reply #1 on: July 10, 2008, 06:13:56 AM »
What version of slick and what hotfixes do you have?

Can you post a specific minimal example of when the completion list is incomplete?

Graeme

eruisi

  • Community Member
  • Posts: 18
  • Hero Points: 0
Re: How auto-complete works?
« Reply #2 on: July 10, 2008, 07:54:35 PM »
I figured it out!

The following macro make SE can not determine which is the function name:

#define PROTO_PARAMS(params) params

Here is one example of function declarations:
vpiHandle  vpi_register_cb     PROTO_PARAMS((p_cb_data cb_data_p));

vpi_register_cb is not recognized correctly as the function name but PROTO_PARAMS is taken as function name.
 
I guess SE can not replace macros with parameters for tagging.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: How auto-complete works?
« Reply #3 on: July 10, 2008, 08:19:53 PM »
You just need to teach SE about the macro:

Go to Tools|Options, and type "preprocessing" in the search text box.
Click on the C/C++ Preprocessing node (either the ANSI-C one or the C/C++ one depending on which language you're using).
Add a preprocessing definition in the list there to teach SE how to interpret the macro.

The reason this is needed is so that SE doesn't have to preprocess every single directive in every single header file while trying to tag files.  If SE had to do that, tagging would be very slow indeed.  :-)  In a sense, you are sort of building a customized "precompiled header for tagging".

eruisi

  • Community Member
  • Posts: 18
  • Hero Points: 0
Re: How auto-complete works?
« Reply #4 on: July 10, 2008, 09:14:11 PM »
Yes, I tried your approach and it works just fine.

Thank you guys.
This community rocks!