Page 1 of 1
Module and structure auto-completion
Posted: Mon May 23, 2016 9:36 am
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 :
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.
Re: Module and structure auto-completion
Posted: Wed May 25, 2016 1:39 pm
by freak
Works fine for me. Can you maybe create a small example project to reproduce the problem?
Re: Module and structure auto-completion
Posted: Wed May 25, 2016 3:32 pm
by Joubarbe
https://www.dropbox.com/s/auvvkl3snctav ... g.rar?dl=0
All three files are in one project (example.pbp). See main.pb.
Re: Module and structure auto-completion
Posted: Wed May 25, 2016 8:28 pm
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.
Re: Module and structure auto-completion
Posted: Wed May 25, 2016 11:01 pm
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" :
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).
Re: Module and structure auto-completion
Posted: Fri May 27, 2016 5:11 pm
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...
Re: Module and structure auto-completion
Posted: Sat May 28, 2016 12:26 am
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.