Author Topic: How auto-complete works?  (Read 1715 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: 1915
  • Hero Points: 218
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: 1413
  • Hero Points: 130
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!