Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Koron on May 16, 2005, 07:51:39 pm

Title: Code completion plugin
Post by: Koron on May 16, 2005, 07:51:39 pm
Why code completion not work for example with WNDCLASSEX, RECT and not work , if file, with new classes, is not saved?

I have WinXP, AMD XP2.4GHz with 512MB RAM
Title: Code completion plugin
Post by: Anonymous on May 16, 2005, 07:56:25 pm
Version is 1.0-beta7
Title: Code completion plugin
Post by: rickg22 on May 16, 2005, 11:29:53 pm
It's by design. Code completion was designed to parse only saved files.
Title: Code completion plugin
Post by: jludvig on May 17, 2005, 12:33:00 am
Hey Rick and other devs - thanks a buch for opensourcing this marvellous IDE. And I was so close to buying visual studio...

Some things i'd love to see in the code completion plugin:

parse templated classes and typedefs or whatever keeps me from getting code-completion on my stadard template library objects.

you do parse includes like #include <vector> or #include<windows.h> right? or maybe that's the thing...

strong code completion is a big issue for me so I appreciate the recent improvements in the latest version. I have tried to look at the code but it's a bit of a mouthfull - I don't have that much spare time at the moment.
Title: Code completion plugin
Post by: rickg22 on May 17, 2005, 04:16:08 am
The options for codecompletion are in the main menu, under "Settings, configure plugins".

Yes, includes are parsed too if you set it up. Just make sure to grab a cup of coffee and enable both "codecompletion cache" and "parse external includes". When the parsing's finished, you can safely close the project.

I'm not sure if this is correct, but AFAIK included files aren't parsed separately but per-project instead, so unfortunately you'd have to repeat the process for all your projects.
Title: Code completion plugin
Post by: jludvig on May 17, 2005, 11:57:59 am
I already enabled the cache and the parsing of global and local includes... still the parser seem to leave out some stuff. I also experienced a crash on startup when I had cache enabled - codeblocks refused to start until i disabled it in registry.

will run some more tests and get back to this thread with more detailed feedback.
Title: Code completion plugin
Post by: jludvig on May 17, 2005, 12:06:23 pm
I't the combination of "parse GLOBAL includes" and "use cache" that crashes the codecompletion plug. It might have something to do with how I set my paths to the compiler. I tried using the codeblocks settings with no luck and now use the environment variables "LIB" and "INCLUDE" I bet the codecompletion plug doesn't search those paths - it's pretty microsoft specific I guess.
What is the correct way of setting it up? thanks.
Title: Code completion plugin
Post by: jludvig on May 17, 2005, 12:39:17 pm
the parsing only to work for files that are added directly to the project.

I tried creating a simple class in a file called "ParseTest.h".

I placed the file in my visual toolkit include dir, and included it as a global include <ParseTest.h> - no dice
I event tried adding that directory to the project include's instead of just having it set in the global settings->compiler dialog.
I then moved it to my project folder and included it as "ParseTest.h" again it compiled ok, but no parsing
Only when I added the file to the project it was recognized by the codecompletion plugin.
Title: Code completion plugin
Post by: rickg22 on May 17, 2005, 06:02:56 pm
Hmmmmmmmm.... strange indeed.
Yes, the environment variables are microsoft-specific. You have to add the include directories in Project's Properties, etc. But I'm not sure about the parser analysing global includes.

Regarding the crash, do you happen to have "parse preprocessor directives" enabled in the codecompletion plugin? I think it crashed for me once when it was disabled.
Title: Code completion plugin
Post by: jludvig on May 18, 2005, 01:34:13 pm
the include directories were added to project properties and the IDE compiler settings, didn't make a difference - you cannot reproduce the bug on your system?
Title: Re: Code completion plugin
Post by: Game_Ender on August 01, 2005, 07:20:42 pm
The code completion plugin is supposed to parse directories included in your project, but I can't seem to get it to work. It talks about your project and the compiler's "include directories", by this I assume it means the directories listed in "Directories/compiler" in the "Project's compiler options" dialog. Is this correct? I have the Ogre include directory as one of the compiler directories but it does not do any code completion related to external files, only one my project.  Am I doing something wrong?
Title: Re: Code completion plugin
Post by: Urxae on August 01, 2005, 08:27:00 pm
I have the Ogre include directory as one of the compiler directories but it does not do any code completion related to external files, only one my project.  Am I doing something wrong?
In Settings -> Plugins' settings -> Code completion, do you have "Follow GLOBAL includes" set? (I believe it's off by default because it takes a while to parse all that stuff)
Title: Re: Code completion plugin
Post by: Game_Ender on August 01, 2005, 09:23:03 pm
Yes I have follow LOCAL and GLOBAL include checked, and all the cache options turned on.  Also, the newline characters don't work right for me, they just display as a tiny square.  I don't know if this may cause any issues but I installed codeblocks RC1 over top of my old one (final-beta 7).
Title: Re: Code completion plugin
Post by: rickg22 on August 02, 2005, 01:03:58 am
Also, the newline characters don't work right for me, they just display as a tiny square.  I don't know if this may cause any issues but I installed codeblocks RC1 over top of my old one (final-beta 7).

AH HAH!

OK, first of all, purge your codeblocks directory. (If you have your projects inside it, then it's an "uh-oh", because that's normally a wrong behavior :P )

Second, after installing CB, if it still doesn't work,
try disabling and-or enabling caching AND smartsense (I recall someone saying smartsense screwed up code completion). So, try with caching - smartsense both on, one on otherone off, etc until you try all the combinations.

Third - if you have caching enabled, purge the cache - might have become corrupted or something.

Hope that helps.
Title: Re: Code completion plugin
Post by: Game_Ender on August 02, 2005, 04:38:44 pm
Thats doesn't work seem to work. So my guess is I don't have it setup right.  The code completion plugin is supposed to follow the include paths in  BuildOptions->Directories->Compiler.  Is there anyone who has gotten the code completion plugin to parse files not in their project?
Title: Re: Code completion plugin
Post by: mandrav on August 02, 2005, 05:17:37 pm
After you open your project, try right-clicking the 'Symbols' tree item (in the 'Symbols' tab) and clicking 'Re-parse now'...

Yiannis.
Title: Re: Code completion plugin
Post by: Game_Ender on August 02, 2005, 06:39:56 pm
It does work, I just thought it wasn't.  It turns out it doesn't put classes from the external files in the class browser.  Thanks for all the help and thanks to Mandrav for the great IDE.
Title: Re: Code completion plugin
Post by: mandrav on August 02, 2005, 07:53:00 pm
It does work, I just thought it wasn't.  It turns out it doesn't put classes from the external files in the class browser.  Thanks for all the help and thanks to Mandrav for the great IDE.

Heheh, just thinking of what the symbols tree would look like if all the parsed symbols were in there, makes me shiver :P

Yiannis.
Title: Re: Code completion plugin
Post by: rickg22 on August 02, 2005, 08:18:14 pm
You could as well post a config option, and I don't know, maybe add it in "external classes" ?
Title: Re: Code completion plugin
Post by: Game_Ender on August 02, 2005, 08:26:25 pm
Question, is there a way to make the code completion plugin understand inheritance?  Take orge for example.  I create a variable of the scene SceneNode type, which is a subclass of Node.  The Node class has the SetOrientation method, but SceneNode doesn't.  Yet, if I have "smart sense" on it doesn't know that it should also display Node's methods, if I am working with a subclass like SceneNode.

Is there a way I can fix this?  It seems the class browser understands inheritance, can we make "smart sense" do the same?
Title: Re: Code completion plugin
Post by: mandrav on August 02, 2005, 08:41:25 pm
Is there a way I can fix this?  It seems the class browser understands inheritance, can we make "smart sense" do the same?

It does support inheritance (that's what SmartSense is anyway). If it doesn't work as you expect, post a minimal test case please...

Yiannis.