NO

Author Topic: Completion HOWTO ?  (Read 6334 times)

drakoh

  • Guest
Completion HOWTO ?
« on: April 24, 2005, 07:04:14 PM »
Hi,

got a quick question about code completion.

how does it work ? it will never complete my structure fields ...

like :

typedef struct test { int var; } test

int main(int ac, char** av) { test* t = malloc(sizeof(test));
t->v <---- now type Ctrl+Space, and nothing happens ...
return (0);
}

I have seen I had to enable certains option and I also had to build the project at least one time, but even after doing this I still can't complete, Am I doing something wrong ?

thx !

--edit--
it strangely started to work ... now fields do appear, I dont even have to type Ctrl+Space, and I dont remenber having changed anything (maybe the debug flags for compiler/linker ?)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Completion HOWTO ?
« Reply #1 on: April 25, 2005, 01:55:19 PM »
Hello,

Good question.

The member list (a list of struct/union members after . or ->) actually requires full browse information. The Options, Source tab seems to be misleading. Both "Build browse info"/"Full", and "Use member list" must be enabled on the source tab.

That said, I think the problem is with the browse info. If I look in the database, I can't find the local variable t in your example. If that variable isn't found, the rest will fail.

The browse info builder doesn't work like the compiler, reading all the include files for a source file - it just scans the source file. This means I can sometimes get into trouble, like with the following:

name1 * name2

What is it? Two variables being multiplied, or a pointer declaration where name1 is a typedef? And so on.

I have to investigate some more...

Pelle
/Pelle

drakoh

  • Guest
Completion HOWTO ?
« Reply #2 on: April 25, 2005, 03:18:39 PM »
ok I see, thx for your time !

BTW I had a look to eclipse for c developpment too, and it works quite well .... under linux.
under windows some things works, but it require mingw, ctags, and unix stuff.

JohnF

  • Guest
Completion HOWTO ?
« Reply #3 on: April 25, 2005, 04:13:53 PM »
Quote from: "Pelle"
Hello,

The member list (a list of struct/union members after . or ->) actually requires full browse information. The Options, Source tab seems to be misleading. Both "Build browse info"/"Full", and "Use member list" must be enabled on the source tab.

That said, I think the problem is with the browse info.
Pelle


Your Add-in structs are not picked up by this feature as far as I can see.

For example,

ADDIN_RANGE range;

When one types range.

Nothing but a beep.

John

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Completion HOWTO ?
« Reply #4 on: April 25, 2005, 08:01:07 PM »
OK. Thanks for the info. I will look at it. Maybe I need a different approach...

Pelle
/Pelle

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Completion HOWTO ?
« Reply #5 on: April 26, 2005, 12:29:20 PM »
Hello,

Attached is a version for testing. It seems to handle the reported cases better, hopefully without handling other cases worse.

Add-in definitions are probably found in sysdefs.tag, which is built only once. You should manually delete this file (in the Bin folder of Pelles C), to get the updated definitions. You also need to build any project, to get this file rebuilt too (will be built when missing).

Pelle
/Pelle

JohnF

  • Guest
Completion HOWTO ?
« Reply #6 on: April 26, 2005, 12:41:05 PM »
That worked for the ADDIN structs, thanks.

John

drakoh

  • Guest
Completion HOWTO ?
« Reply #7 on: April 26, 2005, 08:51:39 PM »
thx will be trying this evening !