Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

code completion and symbols browser seems to be incomplete and buggy

(1/1)

jomeggs:
/*
Codeblocks SVN 3677
Windows XP

First, i'll say, that Code::Blocks is a really nice and useful IDE, many thanks for that. But...

Code completion and symbols browser seems to be incomplete, buggy and to slow for bigger projects if
'All workspace symbols' is selected in symbols browser. Ok, it's possible to select 'Current File'
therefore.

I created a little source for explanation uses, please see below. There you will find a typedef TSimple,
this is NOT shown in the opened symbols browser. If i try to type 'tSimple.' followed by ctrl-space,
code completion won't work. The nearly same struct S_simple and class CSimple are working fine with
completion and browser.

Ok, typing tSimple = 4711; by hand... compile, all looks good. Now, delete the 't' from struct<<.
Compile... many errors are shown... and the upper symbols browsers window is EMPTY! The lower pane still
shows my U_INT typedef.

Correct the source, compile... no errors and still NOTHING in symbols browser window. I clicked arround a
while, no positive result. The only way to get the symbols displayed again is to close Code:Blocks and
reopen it.

I enclosed the struct SSimple in #if 0 ... #endif. Saved the file, compiled it... CSimple is shown
in symbols browser anyway. I've checked the code completion settings 'parse preprosessor directives'
is set.

During the development of the little source below, i've had the missing symbols problem more than
ten times. Furthermore, after closing and reopen the Codeblocks, the size of the symbols browser
window is lost, i have to resize it.

It's not possible to fade out the symbols browser window via Menue->View->Symbols Browser.

In my opinion code completion and symbol browser are very important tools. I hope, that this problems
will be fixed in near future. Is someone working in this area?

Regards,
jomeggs
*/


#include <stdio.h>

typedef unsigned int U_INT;
typedef unsigned int U_INT2;

class CSimple
{
public:
 int nBlub;
 int nBlah;
 char szMyString[20];
};

#if 0
struct SSimple
{
 int nBlub;
 int nBlah;
};
#endif

typedef struct
{
 int nBlub;
 int nBlah;
 char szMyString[20];
}TSimple;

void MyGlobalFunc( void )
{
return;
};

void MyGlobalFunc( int nBlah )
{
return;
};

int main()
{
TSimple tSimple;
tSimple.nBlah = 4711;

#if 0
SSimple sSimple;
sSimple.nBlub = 4712;
#endif

CSimple clSimple;
clSimple.nBlah = 4713;

return 0;
}

Game_Ender:
No large development is being done in this area, but the lead developer maintains the plugin and its custom parser.

I am curious to know if that #if 0 hack works with other code completetion tools.  What the "parse preprocessor" directives means is that it will following things like #include, not become a full fledge preprocessor.  Also if you searched around a little bit you would find that the parser doesn't support typedef struct { ... } MyStruct yet.

Oh and please use
--- Code: --- tags.
--- End code ---

TDragon:

--- Quote from: Game_Ender on March 09, 2007, 09:31:14 pm ---I am curious to know if that #if 0 hack works with other code completetion tools.

--- End quote ---
It does with Visual Studio 2005's practically-perfect-in-every-respect code completion, but that's to be expected. Not a hack, either; a perfectly legitimate way of disabling blocks of code that might already contain /*...*/ comments.

Game_Ender:
I only called it a hack because if you did a long block and it wasn't syntax highlighted as a comment it wouldn't be easy to stop. How wide spread is editor support for comenting highlighting code demarked by the #if 0 #endif set?

jomeggs:

--- Quote ---Oh and please use Code .tags
--- End quote ---
ok


--- Quote ---No large development is being done in this area, but the lead developer maintains the plugin and its custom parser.
--- End quote ---
In the meantime i found the forum topic 'CodeCompletion redesign'. But, after some hickhack this thread seems to be dead, isn't it?

The meaning of 'parse preprozessor' setting has been understood now, thank you. The unsupported typedef parsing i can workaround with using classes as typedefs... But the other problem with #if 0 #endif enclosings is really important for me and others, i believe.

My job is to develop programs for multiple systems like WIN, Linux, WIN CE, own OS's. So i have sources, which are 'contaminated' with things like:

--- Code: ---#if defined(OS_BLAH)
  ...
#else if defined(OS_BLUB)
  ...
#else
 ...
#endif

--- End code ---

It's really often, that for different OS versions i have to describe Structs and Classes with same names but different architecture. A good classbrowser may not mix these and has to support preprozessor directives like that. I tested a little bit with BORLAND CBuilder, the following constructions will work there (No, CBuilder isn't better than CB 8) )


--- Code: ---
#if 0
   typedef struct
   {
    int a1;
    int b1;
   } TTest;
#else
   typedef struct
   {
    int a2;
    int b2;
   } TTest;
#endif

/* this will work too...*/

#if 0
#if 1
#if 4711
#if true

/* and this: */

#define _TEST

#if defined(_TEST)
   typedef struct
   {
    int a1;
    int b1;
   } TTest;
#else
   typedef struct
   {
    int a2;
    int b2;
   } TTest;
#endif


--- End code ---


--- Quote ---How wide spread is editor support for comenting highlighting code demarked by the #if 0 #endif set?
--- End quote ---
There is no support known by me. There is no need for it too. Code completion and syntax higlighting are different things in my eyes.

Navigation

[0] Message Index

Go to full version