Page 1 of 1

[SOLVED] AutoComplete and modules

Posted: Fri Apr 24, 2015 9:15 am
by Joubarbe
Hi,

Maybe someone already said this on the forum, but when you have multiple files in a project, and a module for each file, and a common module ; all procedures called from the common module are not recognized by AutoComplete. That would be great to see that fixed :)

Re: AutoComplete and modules

Posted: Sat Apr 25, 2015 3:15 am
by sancho2
I'm not %100 sure this is what you are looking for but have a look in the preferences under autocomplete/displayed items.

Re: AutoComplete and modules

Posted: Sat Apr 25, 2015 7:45 am
by Joubarbe
I'm aware of that, I'm not looking for anything. I'm pretty sure it's a bug. The AutoComplete does not work at all in the case I described.

Common.pb :

Code: Select all

DeclareModule Common

  Declare MyProcedure()

EndDeclareModule

DeclareModule UI
  
  UseModule Common

EndDeclareModule

Module Common

  Procedure MyProcedure()
    ; stuff
  EndProcedure

EndModule

XIncludeFile "UI.pb"
UI.pb :

Code: Select all

Module UI
  ; if you try to call MyProcedure() from here, AutoComplete will not work - it will work however if you don't use "UseModule Common" and call Common::MyProcedure() ; but the point of having a common module is to avoid that.
EndModule
FYI, all the files are in a single project.

Re: AutoComplete and modules

Posted: Sat Apr 25, 2015 8:36 am
by sancho2
I see. (edit removed wrong answer ..sorry)
I just tried your code and it works for me. Autocomplete does see the module.

Re: AutoComplete and modules

Posted: Sat Apr 25, 2015 8:41 am
by Joubarbe
Wot ?

That's what it does. It includes the Common module... "UseModule Common". That should work.

Re: AutoComplete and modules

Posted: Sat Apr 25, 2015 8:58 am
by sancho2
Looks like I'm losing all around on this one. It does work but you do have to qualify it with the module name, ie:

Code: Select all

Common::MyProcedure()
Which makes the UseModule command redundant. Your point is valid, sorry about the confusion.

Re: AutoComplete and modules

Posted: Sat Apr 25, 2015 11:06 am
by freak
Its not a bug but rather a limitation of the way AutoComplete is implemented. I have written about this here: http://www.purebasic.fr/blog/?p=417

All you have to do is to repeat the UseModule keyword inside your Module to help the IDE understand the connection.

Code: Select all

Module UI
  UseModule Common 
 
  ; Now AutoComplete should work
EndModule

Re: AutoComplete and modules

Posted: Sat Apr 25, 2015 11:12 am
by Joubarbe
Great, thank you freak ! :)