Author Topic: SmartSense/IntelliSense/CodeCompletion  (Read 20825 times)

Aboq

  • Guest
SmartSense/IntelliSense/CodeCompletion
« 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
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

Online stahta01

  • Lives here!
  • ****
  • Posts: 7665
    • My Best Post
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #1 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
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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Aboq

  • Guest
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #2 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.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #3 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.

mann

  • Guest
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #4 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
« Last Edit: January 05, 2007, 02:20:31 am by mann »

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #5 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
BOOL InitInstance(hInstance, nCmdShow)
HANDLE  hInstance;
int     nCmdShow;

to:
Code
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
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).

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #6 on: January 05, 2007, 09:04:13 am »
  • Typedefs are supported.
  • "Typedef struct XYZ {} ABC;" is not supported. Break it in two steps if you need it (struct XYZ {}; typedef XYZ Sxyz).
  • This kind of code (what's it called? K&R?) is not supported:
Code
BOOL InitInstance(hInstance, nCmdShow)
HANDLE  hInstance;
int     nCmdShow;

  • Finally, this is WIP. Never forget that :).
Be patient!
This bug will be fixed soon...

Aboq

  • Guest
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #7 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.



Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #8 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.

Aboq

  • Guest
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #9 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
}

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #10 on: January 05, 2007, 01:55:18 pm »
did you save first, will try out my self later on

mann

  • Guest
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #11 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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #12 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 ??

Alturin

  • Guest
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #13 on: May 27, 2007, 09:03:55 pm »
Typedefs are supported.

Code
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
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
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
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.
« Last Edit: May 28, 2007, 12:58:05 am by Alturin »

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: SmartSense/IntelliSense/CodeCompletion
« Reply #14 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).
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)