Code::Blocks

User forums => Using Code::Blocks => Topic started by: Aboq on January 05, 2007, 12:39:43 am

Title: SmartSense/IntelliSense/CodeCompletion
Post by: Aboq on January 05, 2007, 12:39:43 am
I tried to use this feature like i know it from VisualStudio or better VisualAssist...
I only tried latest nightly build 03jan07 on windows.

It doesnt work...

Code: [Select]
typedef struct teststr_dummy {
    int test;
} teststr;

class testclass {
    public:
    int test;
};

/* ------------------------------------------------------------------------- */
BOOL InitInstance(hInstance, nCmdShow)
HANDLE  hInstance;
int     nCmdShow;
{
    teststr bla_bla; // teststr not in list in code completion
    bla_bla ---// no code completion after hitting .
    testclass bla_class; // testclass not in list in code completion
    bla_class ----// bla_class not in list in code completion | no code completion after hitting .

So how does this feature work must i refresh the symbols manually, is it only supported with depth = 1 (I Mean no . ->)

thanks for me this is a essantial feature
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: stahta01 on January 05, 2007, 12:42:55 am
I tried to use this feature like i know it from VisualStudio or better VisualAssist...
I only tried latest nightly build 03jan07 on windows.

It doesnt work...

Code: [Select]
typedef struct teststr_dummy {
    int test;
} teststr_dummy;

I think they must be named the same, I do NOT use code completion so I don't know for sure.
Tim S
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Aboq on January 05, 2007, 12:52:35 am
no they shoulndt have the same name.

first is used inside the struct, second is used outside the struct definition.
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Ceniza on January 05, 2007, 01:17:51 am
IIRC CodeCompletion doesn't work with structs defined using a typedef... I even wonder if basic typedefs were implemented.
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: mann on January 05, 2007, 02:16:43 am
Yes this feature is essential for me as well, but if the code completion plugin can not handle typedef struct constructs it is unfortunately completely useless for us. can you estimate how long it will take until the code completion feature will work properly? it is one if not the most important feature of an IDE so it should be given highest priority,....do you agree?

thanks from hokkaido
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Ceniza on January 05, 2007, 02:58:27 am
Well, mandrav is the only man on earth who understands that plugin (he wrote it after all :wink:). I don't know how many time it would take a mortal to add it, and I have no idea if mandrav feels like implementing it anytime soon.

Even though there's something to clarify: CodeCompletion is able to parse structs and classes, but not those declared with a typedef.

In your example the plugin should be able to parse the class (testclass), but it should fail with the struct... and the function too. I just tested it and it's so.

Something that is not helping the plugin, 'cause it's unable to parse it, is the way you define the function: old-C style. If you change it from:
Code: [Select]
BOOL InitInstance(hInstance, nCmdShow)
HANDLE  hInstance;
int     nCmdShow;

to:
Code: [Select]
BOOL InitInstance(HANDLE hInstance, int nCmdShow)
then the plugin will be able to suggest things, and since you're also defining a class I guess you're using C++, so you should really define functions that way.

If you define structs like this:
Code: [Select]
struct NameOfTheStruct
{
  // data members
};

the plugin will be able to parse them.

Please have in mind the CodeCompletion plugin is still work in progress, even though it hasn't been touched that much for many months and it's known to lack support for a few 'constructs' (you know two now).
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: mandrav on January 05, 2007, 09:04:13 am
Code: [Select]
BOOL InitInstance(hInstance, nCmdShow)
HANDLE  hInstance;
int     nCmdShow;

Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Aboq on January 05, 2007, 10:11:08 am
so i should rewrite all library header files?

please implement C parsing since C is a subset of C++

This is not my coding style, my code can be parsed (if i dont use this typedef) but major library headers wont work.

So for Linux Developers Code::Blocks might be a good thing, but i dont see why i should prefer codeblocks over visual studio.


Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: killerbot on January 05, 2007, 10:20:38 am
you have a point there, that libraries you *use* might be created like that. For the moment we focus the most on the modern language style. No promise if that old style will be supported some day, but then again no promise we will never support this. There are things with higher priorities, it hope you can accept that.
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Aboq on January 05, 2007, 01:20:47 pm
Another Problem: Function Parameter display doesnt work right

void tester(int testparam) {
  // do something
}

void main() {
  // i enter tester( -> no parameters displayed
  // i delete ( and enter ( -> parameters are now displayed
}
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: killerbot on January 05, 2007, 01:55:18 pm
did you save first, will try out my self later on
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: mann on January 05, 2007, 04:16:50 pm
hello my friends,

ok thank you for answer. my colleagues and I have decided to stick to visual studio and use anjuta for the linux development of our project for now. but maybe we will reconsider codeblocks when version 2.0 has been released and code completion works more reliably. thank you for your work,

greetings from hokkaido
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: killerbot on January 05, 2007, 04:30:45 pm
Another Problem: Function Parameter display doesnt work right

void tester(int testparam) {
  // do something
}

void main() {
  // i enter tester( -> no parameters displayed
  // i delete ( and enter ( -> parameters are now displayed
}


I can confirm. I think I know why.
When I typed tester, after the test the CC popped up suggesting 'tester', however I kept on typing, so I typed tester, after the r was typed in the CC tooltip was still there. When I type the ( -> tooltip dismissed but the ( apparently did not trigger new CC tooltip for the arguments. When I then erase the ( and type it again, itworks. The ( in this case didn't had to clean up a previous tooltip.

Other test, instead of typing tester completely, I choose the tooltip suggestion that popped up after the 'test' (be hitting enter), so the tooltip was gone, after that enter-key I typed the ( and CC kicked in for the arguments.


@Yiannis, hope this gives you enough information to fix it ??
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Alturin on May 27, 2007, 09:03:55 pm
Typedefs are supported.

Code: [Select]
struct test_struct
{
    int first;
    int last;
    int percentage;
    char* text;
};

typedef struct test_struct MY_TEST_STRUCT;

int main()
{
    MY_TEST_STRUCT testOne;
    testOne. // hit ctrl-space, nothing happens, but code-completion DOES recognise it as a symbol (it shows up as local variable)

    return 0;
}

Code: [Select]
struct test_struct
{
    int first;
    int last;
    int percentage;
    char* text;
};

typedef struct test_struct MY_TEST_STRUCT;

int main()
{
    struct test_struct testTwo;
    test // hit ctrl-space, nothing happens, code-completion does not even recognise testTwo as a local variable

    return 0;
}

Code: [Select]
struct test_struct
{
    int first;
    int last;
    int percentage;
    char* text;
};

typedef struct test_struct test_struct;

int main()
{
    test_struct testThree;
    testThree. // hit ctrl-space, the list of available variables shows up

    return 0;
}

Code: [Select]
struct test_struct
{
    int first;
    int last;
    int percentage;
    char* text;
};

int main()
{
    test_struct testFour;
    testFour. // hit ctrl-space, the list of available variables shows up

    return 0;
}

So, I don't really see in what way typedefs are supported :(.
Apparent from test three and four it doesn't really parse the typedef, it just assumes it's there somehow?
It would be really superb to have typedef support, that is, testOne. completing properly.
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: TDragon on May 27, 2007, 10:37:53 pm
So, I don't really see in what way typedefs are supported :(.
Typedefs are certainly supported; it's C-style struct specifiers ("typedef struct test_struct blah;") that aren't. The typedef line is not recognized in any of the first three samples because of this; the last two examples work because "test_struct" is directly recognized as the previously declared struct -- which is entirely correct in C++ (except that the struct definition lacks a semicolon after the closing curly brace).
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Alturin on May 28, 2007, 01:04:09 am
So, I don't really see in what way typedefs are supported :(.
Typedefs are certainly supported; it's C-style struct specifiers ("typedef struct test_struct blah;") that aren't. The typedef line is not recognized in any of the first three samples because of this; the last two examples work because "test_struct" is directly recognized as the previously declared struct -- which is entirely correct in C++ (except that the struct definition lacks a semicolon after the closing curly brace).

I was testing the code on my laptop, and manually typed it over to the post, so yeah I forgot the semicolons; added them, thanks.
Is this kind of support on the near to-do list for Code Completion, if it's on there at all?
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: mandrav on May 28, 2007, 08:55:26 am
Is this kind of support on the near to-do list for Code Completion, if it's on there at all?

There are various things in my todo list but don't expect anything major before our next release is out the door.
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: Game_Ender on May 29, 2007, 07:04:48 am
Perhaps adapting a more robust code base from something like icomplete (http://stud4.tuwien.ac.at/~e0125672/icomplete/) or omnicppcomplete (http://www.google.com/search?q=omnicppcomplete)? (Both are C/C++ code completion libraries with VIM plugins).

EDIT: Both appear to use Ctags like eranif standalone application does.
Title: Re: SmartSense/IntelliSense/CodeCompletion
Post by: zelimir on June 04, 2007, 05:32:28 pm
First of all, I am really enthusiastic about this great IDE!
It has ample and cool features.
But I also miss those features addressed in this thread.

There are various things in my todo list but don't expect anything major before our next release is out the door.

Does this mean that you are considering to implement this feature BEFORE RC 3 or AFTER 1.0 Final?

I think this feature has to be in the final release, since it is essential for a quality IDE. And I am certainly not alone with this opinion.
A code completion which looks for the right function arguments and struct members makes an IDE a LOT more usable.

Greets,
Zelimir