Module and structure auto-completion

Post bugs related to the IDE here
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Module and structure auto-completion

Post by Joubarbe »

Hey,

Here is how I design my programs : https://openclassrooms.com/courses/3235 ... ublication

It's in French but it will give you a good idea. I have one file per module, and all the files are inside a project (all files are always open in the IDE).

The auto-completion works for everything when I add UseModule both in the common module and in the module itself, but if I want to refer to a structure of another module, the auto-completion doesn't work.

For instance, in my example, let's say I want to add the following code in my gameplay DeclareModule section :

Code: Select all

Structure s_ship
  hp.i
  model.s
EndStructure

Global myShip.s_ship
Then if I'd like to modify myShip\hp in my main module :

Code: Select all

gameplay::myShip\hp + 10
In this code, the auto-completion won't work, and won't show me "hp" and "model" after I typed "gameplay::myShip\".

It becomes a little bit annoying when you have many elements inside your structures.

Anyway, thanks for reading this.
freak
PureBasic Team
PureBasic Team
Posts: 5946
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Module and structure auto-completion

Post by freak »

Works fine for me. Can you maybe create a small example project to reproduce the problem?
quidquid Latine dictum sit altum videtur
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: Module and structure auto-completion

Post by Joubarbe »

https://www.dropbox.com/s/auvvkl3snctav ... g.rar?dl=0

All three files are in one project (example.pbp). See main.pb.
freak
PureBasic Team
PureBasic Team
Posts: 5946
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Module and structure auto-completion

Post by freak »

Hmm, still not able to reproduce it. Both ways of AutoComplete work for me. Is there maybe another file open in your IDE with a conflicting definition of the variable and/or structure?

Some questions:
- what PB version are you using?
- what is your setting in the Preferences on the "AutoComplete->Displayed Items" page for "Add Items from" (the setting at the bottom) ?

I noticed that your project file does not actually reference the source files in your example. If you associate the source files with the project (via Project -> Add file to project) and change the above mentioned preferences setting to "the current project", then this may solve your problem. AutoComplete via the direct project association is generally better than using the "open files" mechanism, because there is no possibility of non-project files interfering with the AutoComplete resolution. Also, the project association works for AutoComplete even if the source file is not currently open.
quidquid Latine dictum sit altum videtur
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: Module and structure auto-completion

Post by Joubarbe »

1. 5.42 (x64)
2. These settings are default : "the current project (if any)"

I don't understand ; when I click on the Project tab of the example I sent to you, I see my three files. I always right click on this list and click "add file to project" :

Image

But a strange thing happens now... It's working... But not in my current project, which I can't send to you.

Could it be that the order of the DeclareModule sections matters?

Weird. In my project, it's kinda the same architecture, expect with about 15 modules/files and bigger structures. And it doesn't work. Also, I always have one project open at the same time (which I assume is forced by PB).


EDIT : I think I found the problem. In my project, I did all the tests on a structured array with two dimensions. With a global integer, it works, but not with the array (same structure).
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: Module and structure auto-completion

Post by Joubarbe »

Ok can you please try this one : https://www.dropbox.com/s/auvvkl3snctav ... g.rar?dl=0 ?

The macro seems to be the problem...
#NULL
Addict
Addict
Posts: 1499
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Module and structure auto-completion

Post by #NULL »

if a macro is the problem then put that macro in a separate file that is not part of the project.
i had that problem when i accessed an structured array via a macro to implement some array bounds checking including throwing of errors etc. then the IDE won't give me autocompletion for element fields because it thinks rightly thats its a macro and not a structure. this is solved if the file containing the macro is not open and is not part of the project.
Post Reply