[SOLVED] AutoComplete and modules

Working on new editor enhancements?
Joubarbe
Enthusiast
Enthusiast
Posts: 555
Joined: Wed Sep 18, 2013 11:54 am
Location: France

[SOLVED] AutoComplete and modules

Post 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 :)
Last edited by Joubarbe on Sat Apr 25, 2015 11:12 am, edited 1 time in total.
sancho2
User
User
Posts: 44
Joined: Wed Apr 15, 2015 5:14 am

Re: AutoComplete and modules

Post 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.
Joubarbe
Enthusiast
Enthusiast
Posts: 555
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: AutoComplete and modules

Post 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.
sancho2
User
User
Posts: 44
Joined: Wed Apr 15, 2015 5:14 am

Re: AutoComplete and modules

Post by sancho2 »

I see. (edit removed wrong answer ..sorry)
I just tried your code and it works for me. Autocomplete does see the module.
Last edited by sancho2 on Sat Apr 25, 2015 8:46 am, edited 2 times in total.
Joubarbe
Enthusiast
Enthusiast
Posts: 555
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: AutoComplete and modules

Post by Joubarbe »

Wot ?

That's what it does. It includes the Common module... "UseModule Common". That should work.
sancho2
User
User
Posts: 44
Joined: Wed Apr 15, 2015 5:14 am

Re: AutoComplete and modules

Post 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.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: AutoComplete and modules

Post 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
quidquid Latine dictum sit altum videtur
Joubarbe
Enthusiast
Enthusiast
Posts: 555
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: AutoComplete and modules

Post by Joubarbe »

Great, thank you freak ! :)
Post Reply