Code Completion Newbie Question

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
mrhaboobi
Posts: 10
Joined: Thu Jul 27, 2006 2:33 am

Code Completion Newbie Question

Post by mrhaboobi »

First appologies if this question has previously been answered. Im used to working with Visual Studio .Net for my work projects, but im looking at using Zeus for private work at home. Is it possible to a similar effect to the visual studio Ctrl- Space intellisense features?

Ive just downloaded the trial soft version of the software. and straight out of the box i just wanted to test with a simple c file. I wanted to do something simple like printf(). so i figured if i typed the first 3 or so characters of a std ansi c method that i might get a list of possible matches?

Perhaps im missing something simple, can could you provide any details? Thanks
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Is it possible to a similar effect to the visual studio Ctrl-Space intellisense features?

The Zeus intellisense feature is automatically triggered by the space bar (provided it is enabled) but it is also possibel to bind the Zeus TagsComplete keyboard function to the Ctrl-Space keyboard to provide alternative keyboard driven intellisensing.

But for the intellisensing to work Zeus also requires a source of tags information.

This tags information is automatically created and maintained for any files contained in a Zeus workspace, but for third party files the tags information needs to be configured by the user using the Tags Database Builder utility.

For example, below are a few examples of how tags information can be configured for MFC and Java:
i just wanted to test with a simple c file. I wanted to do something simple like printf(). so i figured if i typed the first 3 or so characters of a std ansi c method that i might get a list of possible matches?
Unfortunately the Zeus intellisensing does not currently do partial word matching :(

As an example lets assume a tags database file has been created using the C header files as described in the links above. How the intellisensing in Zeus works is as follows:
  1. If I type in printf( Zeus will display the arguments for printf after the ( key is pressed.
  2. Alternatively I could place the cursor on the printf and use the Tags, Find Current Word menu to go to the header file containing the printf definition.
Having said this, I ran a test by creating a Zeus tags database using the MSVC header files and unfortunately the tags produced did not contain a definition for the printf function. Zeus uses Exuberant Ctags to generate the tags information and I suspect Exuberant Ctags is having some trouble parsing these MSVC header files :(

Repeating the above test using something like asinf( as the input better illustrates how things are meant to work, since there is some tags information for the asinf function. In this case Zeus displaying inline float asinf(float _X) as the intellisense tip :)

Cheers Jussi
mrhaboobi
Posts: 10
Joined: Thu Jul 27, 2006 2:33 am

Post by mrhaboobi »

Thanks for the quick reply Jussi.

Any chance that Partial Word Matching is going to be something thats implemented in the future :)..

Excellent software, I'll keep testing it out, ive not found much else that seems to match my needs :) But the Partial matching not working is a bit of a bugger..

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

Post by jussij »

Any chance that Partial Word Matching is going to be something thats implemented in the future
I have added this feature request to the Zeus todo list so provided the feature is not too difficult to implement, it should make it's way into an upcoming Zeus patch ;)

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

provided the feature is not too difficult to implement, it should make it's way into an upcoming Zeus patch.
This feature looks as if it should be quite easy to implement, so expect to see it in the next Zeus patch due out in the next few weeks :)

Cheers Jussi
mrhaboobi
Posts: 10
Joined: Thu Jul 27, 2006 2:33 am

Post by mrhaboobi »

jussij wrote:
provided the feature is not too difficult to implement, it should make it's way into an upcoming Zeus patch.
This feature looks as if it should be quite easy to implement, so expect to see it in the next Zeus patch due out in the next few weeks :)

Cheers Jussi
Excellent, i look forward to that patch, now you just have to find a way for ctags to parse the MSVC headers :) hahah..
mrhaboobi
Posts: 10
Joined: Thu Jul 27, 2006 2:33 am

Post by mrhaboobi »

Hi Jussi,

UPDATE: Just found this on the cTags Site.

Include extern tags. ctags will normally ignore extern declarations of functions or variables; that's handy when generating tags for your own programs. A tags file for the extern declarations in the system's standard header files can be a very handy resource, so this -e flag was created.



Im trying to build a tags database for some of my .h files. For some reason its just not find anything in the .H files.

Any chance i can send you the include folder with my .h files and get you to test.

Let me know if you can help do a test and i'll email you the files.. ( send me your address or whatever )

Here is a sample.h file Things like putchar can not be found by the tag finding feature. :(


#ifndef _STDIO_H
#define _STDIO_H

#define BUFSIZ 1024
#define EOF (-1)

#ifndef SEEK_SET
#define SEEK_SET 0
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#ifndef SEEK_END
#define SEEK_END 2
#endif

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */
#endif

/* under constraction now */

#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int printf(char *fmt, ...); /**/
extern int sprintf(char *buffer, char *fmt, ...);

extern char getc(int); /**/
extern char getchar(void);
extern char *gets(char *);
extern void putc(char, int); /**/
extern void putchar(char);
extern void puts(char *);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif

#endif /* _STDIO_H */



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

Post by jussij »

Unfortunately this looks like a limitation of the current Zeus :(

Assuming the code above is contained in a file called test.h this is the command line Zeus runs to build the tags information:

Code: Select all

xtags.exe --c-types=+fp --excmd=p --fields=+afmikKlnsSz --sort=no -f output.tags test.hpp
where xtags.exe is just ctags.exe renamed to avoid name collisions. The contents of this tags file produced actually contains the function information defined under the prototype kind category.

The problem is the current Zeus ignores this prototype information :(

But what you can do is downlaod the latest Exuberant Ctags source code (see link in an earlier post) and edit this ctags file: c.c

At about line 287 you will see this:

Code: Select all

    { FALSE, 'p', "prototype",  "function prototypes"},
Just change it to read:

Code: Select all

    { FALSE, 'p', "function",   "function prototypes"},
Replace the xtags.exe with this new ctags.exe and Zeus should now detect this prototype information :)

To fix this properly I will also make sure Zeus is changed to not ignore this prototype information.

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

The latest Zeus patch found at the link below should fix the issues you have raised:

http://www.zeusedit.com/forum/viewtopic.php?t=770

But you will need to bind the new TagsCompleteEx keyboard function to the Ctrl+Space key combination ;)

Cheers Jussi
mrhaboobi
Posts: 10
Joined: Thu Jul 27, 2006 2:33 am

Post by mrhaboobi »

Excellent that appears towork nicely :)
Post Reply