Code completion doesn't work
Code completion doesn't work
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.
}
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.
}
Hi Jack,
But you have highlighted a bug, since a tool tip should have been displayed rather than having the tag displayed in the status bar
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:
I then filtered the tags file looking for my_class class definition which gave me the following output:
Once again you will notice this is identical to the structure displayed in the class browser and the popup window
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
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.// code completion doesn't work for these lines (no popup)
my_class1.
ptr1->
But you have highlighted a bug, since a tool tip should have been displayed rather than having the tag displayed in the status bar

No code complete is triggered for this case so this does look like a bug in Zeusclass_array[0].

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 completion incorrectly includes MY_STRUCT as a attribute in popup
my_class2.
ptr2->
Code: Select all
init
MY_STRUCT
struct_data
struct_ptr
Code: Select all
xtags.exe --c-types=+fp --excmd=p --fields=+afmikKlnsSz --sort=no -f- test.cpp
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

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 completion provided struct_data field but will not expand it further
my_class2.struct_data.
Code: Select all
MY_STRUCT test.cpp /^} MY_STRUCT;$/; " class:my_class file: kind:typedef
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
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
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
Hi Jack,


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.
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
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 programAlthough 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.

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 availableI guess my next questions are:
1) Do you have an plan to improve the code completion operation for C++?

Zeus expects the tag file to be in the published ctags formated, so any program that produces this format should work.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.
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
Hi Jack,


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.
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
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 programAlthough 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.

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 availableI guess my next questions are:
1) Do you have an plan to improve the code completion operation for C++?

Zeus expects the tag file to be in the published ctags formated, so any program that produces this format should work.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.
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
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
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
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
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
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

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