User forums > Help

Help me understand AutoCompletion and ...

(1/3) > >>

mmccarty12:
how to use it properly.

It is my understanding that AutoCompletion is supposed to make our lives, the users of IDEs easier by showing options for a given set of characters in the edit windows.  What I believe it does is look up, from some sort of data structure, all available tokens consisting of characters available to the project or workspace. 

It seems to me to now work consistently.  I know from reading posts that local variables are not necessarily parsed when the project is parsed to create the data structure.  While a tad inconvenient, I can see the logic of the programmer(s) who created the system.  What I am not understanding is the part where it fails to pop up the available data members for classes and structures.  This system seems to work for any class or structure I have defined in my project, but does not work when working with a class like wxWidgets, upon which CB is built.  As the auto-complete does work, I feel that I am missing something in my project or application set up that determines what shows up when.  I am, of course, referring to the idea as has been displayed several times in these forums.  What I have not seen is any explanation as to what appears to work "sometimes" as some have put it. 

When I use a class like std::vector, I get none of the available functions or data structures for that class. 

EX in the CB editor:

--- Code: ---//   my.cpp
#include <vector>

typedef struct foo { int a }

int main(int argc, char** argv) {
  std::vector<int> v;
  v.

  foo f;
  f.
  return 0; }

--- End code ---
At the point I hit the dot after the v, nothing shows up, but when I hit the . after the f the autocomplete box pops up and shows me that 'a' is a member of f. 

My question is thus: What do I need to do to make sure, when my project is parsed for autocomplete, all available members of a class are included in the list for a given class or struct?

I find it frustrating that the system does not show me the available members of the wxWidgets especially as CB is written using it.  I use wxWidgets exclusively for my projects and would like to not have to bounce between my work environment and the internet to find a specific function or data member for a wxWidget object.  As I said, I believe this has to do with the way the project or default applications setting are. 

As a side note, I went to Project -> Properties -> C/C++ parser and added the following lines to the folders I wanted added to the parse, but that seems to not be enough.
/mywidgetsfolder/wxWidgets-2.9.5/include/wx
/mywidgetsfolder/wxWidgets-2.9.5/include
It was enough to get things like wxALIGN_* to pop up with what is available, but does not work if I do the following.

--- Code: ---wxTextCtrl* tc = new wxTextCtrl(parent, NewControlId(), wxEmptyString);
tc->
[/[font=Verdana][/font]code]

Thanks
CB: SVN 9271  CentOS5
--- End code ---

anotherOpenGLFan:
For the auto completion, you can do:
    Settings->Editor->Code Completion (left side panel)->Update Parser While Typing (Code Completion tab, should be checked unless changed by the user)

Or, when you open up a project, you can:
    Right click the project->"Reparse Project"

Keep in mind, that it's parsing is not instantly done, it run's it in the background while your programming. And for large project's that include a lot of library's,
it might take a long time for it to finish parsing all the files. And there may be some quirk to it where it skip's over part's that it doesn't think need to be done,
and thus might not parse through "std::vector". I'm not sure, but I've experienced similar thing's from a variety of places, where it only work's "sometimes".
Personally, the best solution I've found is to know what your programming with. (And Google help's too.)

mmccarty12:
I did what you said,
Settings->Editor->Code Completion (left side panel)->Update Parser While Typing
Right click the project->"Reparse Project"

I even added more c++ header files to be included as well as specific wxWidgets headers.  The project I am working on is currently small, only about 20 files total, but includes many wxWidgets widgets.  It still cannot parse the files.  I added the wxWidgets-2.9.5 folders into the Project -> Properties -> C/C++ Parser Options, and still cannot get it to properly parse any of the wxWidgets classes.

Is that a design feature, or is there some specific way to force CB to recognize and parse classes?

dmoore:
Are you on Windows or Linux? What version of C::B?

Anyway, something must be wrong with your setup because CC works pretty well for me on both Windows and Linux (I am using an April build). I get mostly accurate completion hints for instances of a large number of wxWidgets and STL classes. Keep in mind that heavily templated or macro'd stuff can cause problems.

mmccarty12:
CB: SVN 9271  CentOS5

And I know something is wrong with my setup, I am trying to find out what is wrong with my setup and fix it.

Navigation

[0] Message Index

[#] Next page

Go to full version