Code completion doesn't work

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
Jack Rosenbloom

Code completion doesn't work

Post by Jack Rosenbloom » Fri Dec 24, 2004 7:42 pm

Hi,

In my large C++ projects, I find that code completion doesn't work at all ( no popup) about 1/2 the time. About 1/4 of the time, I get the operations and attributes for the wrong class. The remaining 1/4 of the time, it works but includes mistakes like typedefs showing as variable names. A small example of some of these problems is below.

Jack


typedef class my_class
{
public:
void init( void );

private:
typedef struct my_struct
{
int var1;
int var2;
} MY_STRUCT;


MY_STRUCT struct_data,
*struct_ptr;
} MY_CLASS;

MY_CLASS my_class1, *ptr1;

class my_class my_class2, *ptr2, class_array[4];




int main( void )
{
// code completion doesn't work for these lines (no popup)
my_class1.
ptr1->
class_array[0].

// code completion incorrectly includes MY_STRUCT as a attribute in popup
my_class2.
ptr2->

// code completion provided struct_data field but will not expand it further
my_class2.struct_data.

}

Guest

Post by Guest » Sun Dec 26, 2004 5:28 am

Hi Jack,
// code completion doesn't work for these lines (no popup)
my_class1.
ptr1->
For these two cases Zeus did in fact code complete. If you look in the status bar you will notice a message is displayed as you type in the . and > characters. If you look for the MY_CLASS in the Zeus class browser you will notice it is in the Typedefs section. As indicated by the class browser, not a lot is know about MY_CLASS and this is why Zeus did not display the result in the popup window.

But you have highlighted a bug, since a tool tip should have been displayed rather than having the tag displayed in the status bar :(
class_array[0].
No code complete is triggered for this case so this does look like a bug in Zeus :(
// code completion incorrectly includes MY_STRUCT as a attribute in popup
my_class2.
ptr2->
The Zeus code completion is directly tied to the class browser and the class browser is directly tied to the output produced by the Exuberant Ctags program. In this case the Zeus code completion for my_class2 results in the following popup window:

Code: Select all

init
MY_STRUCT
struct_data
struct_ptr
If you find the my_class object in the Class browser you will notice the browser details match the details of the popup window. To check the tag file for this code I saved the it to the test.cpp file and used the Tools, DOS Command Line menu to run this command:

Code: Select all

xtags.exe --c-types=+fp --excmd=p --fields=+afmikKlnsSz --sort=no -f- test.cpp
I then filtered the tags file looking for my_class class definition which gave me the following output:

Code: Select all

init        test.cpp /^void init( void );$/;      " class:my_class file: kind:prototype
my_struct   test.cpp /^typedef struct my_struct$/;" class:my_class file: kind:struct
MY_STRUCT   test.cpp /^} MY_STRUCT;$/;            " class:my_class file: kind:typedef
struct_data test.cpp /^MY_STRUCT struct_data,$/;  " class:my_class file: kind:member
struct_ptr  test.cpp /^*struct_ptr;$/;            " class:my_class file: kind:member
Once again you will notice this is identical to the structure displayed in the class browser and the popup window :)
// code completion provided struct_data field but will not expand it further
my_class2.struct_data.
But the strange thing about the tags produced is the fact that MY_STRUCT is a typedef but it does not appear in the Typedefs section of the class browser. The reason for this is the tags file lists these details for the MY_STRUCT item:

Code: Select all

MY_STRUCT   test.cpp /^} MY_STRUCT;$/;            " class:my_class file: kind:typedef
Zeus has used the class: scope directive to add the item to the the class but this means the kind: directive to be ignored and hence the item does not appear in the typedef section. But even if the MY_STRUCT had been in the Typedefs section, it would not have changed the code completion. Since this typedef is would display in a similar fashion to the earlier MY_CLASS case, and as before no popup window would be displayed since so little is known about the item.

Zeus by design tries very hard to be language neutral and this means all effort is made sure no language specific code is added to the editor. Zeus contains only the bare minimum of language syntax parsing code, just enough to make the code completion work.

Unfortunately this does mean it is possible to fool the code completion, and in cases where Zeus is confused it usually displays nothing. Add to this the fact that the quality code completion is highly dependent on the information produced by ctags, it does mean the code completion is definitely not 100% bullet proof :(

Cheers Jussi

Guest

Post by Guest » Wed Dec 29, 2004 2:00 am

Hi Jussi

Thanks for the reply. I guess the summary of your response is that code completion will not work for C++ users, without greatly modifying coding style ( no typedefs).

I believe from a C++ point of view, there should be no difference between a typedef or directly declaring a variable. Although the class browser doesn't contain any information about the typedef, a C++ knowledgable brower should cross reference a typedef'ed variable to the declaration. I recognize your efforts to make Zeus language independent, but the least common denomonator of all languages seems too inadequate.

I guess my next questions are:
1) Do you have an plan to improve the code completion operation for C++?
2) If not, are there any other tag programs specific for C++ which would work better with Zeus? Perhaps you need a different tag problem for each language.

While I love the editor even with code completion turnned off, you shouldn't advertise code completion which works so poorly.

Jack

jussij
Site Admin
Posts: 2446
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Wed Dec 29, 2004 1:10 pm

Hi Jack,
Although the class browser doesn't contain any information about the typedef, a C++ knowledgable brower should cross reference a typedef'ed variable to the declaration.
With enough parsing and processing of course anything is possible, but I personally do not think that writting a compiler into the editor just to achieve code completion is the correct approach. Not only is writting the compiler a non-trivial exercise, the support required to keep the compiler up to date is also large. This is exactly why Zeus leaves the compiler work to the ctags.exe program :)
I guess my next questions are:
1) Do you have an plan to improve the code completion operation for C++?
The only way to fix the code completion is to fix the output being written to the tags file. This means either fixing the ctags.exe or finding an alternative source of tags information. Both options are possible, but unfortunately neither is a quick fix and at this stage the time required to investigating these options is not available :(
2) If not, are there any other tag programs specific for C++ which would work better with Zeus? Perhaps you need a different tag problem for each language.
Zeus expects the tag file to be in the published ctags formated, so any program that produces this format should work.

I have also considered using one of the documentation tools to produce the tags file. There seems to be several that do a very good job of cross referencing c/c++ source. For example ccDoc and doxygen both seem to be very nice. But integrating either of these into Zeus is no simple task and even if it was possible, I suspect one of the major problems that this would introduce would be an excessively long tags build time. If you have ever seen MSVC++ grind to a halt as it updates its browser symbol file you will know what I mean.
While I love the editor even with code completion turnned off, you shouldn't advertise code completion which works so poorly.

I think this is a little unfair. Zeus is no different to other software in that there will always be features that could work better.

But Zeus is also shareware and runs fully functional for 60 days, so it is very difficult to falsely advertise anything. What you see in the shareware version is what you get so there should not be any surprises left.

Cheers Jussi

jussij
Site Admin
Posts: 2446
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Wed Dec 29, 2004 1:10 pm

Hi Jack,
Although the class browser doesn't contain any information about the typedef, a C++ knowledgable brower should cross reference a typedef'ed variable to the declaration.
With enough parsing and processing of course anything is possible, but I personally do not think that writting a compiler into the editor just to achieve code completion is the correct approach. Not only is writting the compiler a non-trivial exercise, the support required to keep the compiler up to date is also large. This is exactly why Zeus leaves the compiler work to the ctags.exe program :)
I guess my next questions are:
1) Do you have an plan to improve the code completion operation for C++?
The only way to fix the code completion is to fix the output being written to the tags file. This means either fixing the ctags.exe or finding an alternative source of tags information. Both options are possible, but unfortunately neither is a quick fix and at this stage the time required to investigating these options is not available :(
2) If not, are there any other tag programs specific for C++ which would work better with Zeus? Perhaps you need a different tag problem for each language.
Zeus expects the tag file to be in the published ctags formated, so any program that produces this format should work.

I have also considered using one of the documentation tools to produce the tags file. There seems to be several that do a very good job of cross referencing c/c++ source. For example ccDoc and doxygen both seem to be very nice. But integrating either of these into Zeus is no simple task and even if it was possible, I suspect one of the major problems that this would introduce would be an excessively long tags build time. If you have ever seen MSVC++ grind to a halt as it updates its browser symbol file you will know what I mean.
While I love the editor even with code completion turnned off, you shouldn't advertise code completion which works so poorly.

I think this is a little unfair. Zeus is no different to other software in that there will always be features that could work better.

But Zeus is also shareware and runs fully functional for 60 days, so it is very difficult to falsely advertise anything. What you see in the shareware version is what you get so there should not be any surprises left.

Cheers Jussi

Guest

Post by Guest » Wed Dec 29, 2004 8:25 pm

Hi Jussi

Please don't take me wrong. Even without code completion, Zeus is better than what I have been using and certainly worth the money.

Jack

jussij
Site Admin
Posts: 2446
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Thu Dec 30, 2004 1:22 am

Hi Jack,

I do also understand your frustration with the code completion and I for one agree totally that it can and should be better.

With time it will this feature will definitely improve and given enough time I suspect it will eventually be totally redesigned and re-written to use something other than ctags as the source of tag information :)

Cheers Jussi

jussij
Site Admin
Posts: 2446
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Tue Feb 08, 2005 5:04 am

Hi Jack,

An Experimental Doxygen tagger has just been uploaded to the Zeus web page.

As the name suggests, this is still very much in the early stages of development, but I am hoping that it might help with the some of the tagging problems that you have raised.

Cheers Jussi

jussij
Site Admin
Posts: 2446
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Thu May 25, 2006 10:31 am

A new Zeus patch is now available that should help fix some of these issues :)

For more details go to this link: http://www.zeusedit.com/forum/viewtopic.php?t=613

Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 7 guests