CodeCompletion for typedef defined with macro

General questions regarding the usage of CodeLite
dhs
CodeLite Enthusiast
Posts: 23
Joined: Fri Mar 16, 2012 3:02 pm
Genuine User: Yes
IDE Question: C++
Contact:

CodeCompletion for typedef defined with macro

Post by dhs »

Hi

I use a macro to define (typedef) multiple Types at the same time from for a specific class

1/ Here is a skeleton of the macro (may not compile)

>> #define DECLARE_MY_TYPES(X) class X;typedef std::vectorr<X> Vector##X; typedef map<str::string, X> Map##X;

2/ Then in any file .h, I do:

>> DECLARE_MY_TYPE(MyClass)
>> VectorMyClass test; // so test ~ std::vector<MyClass>

3/ The compilation of the project has no error.

4/ I try to do autocomplete from CodeLIte (test.<Ctrl-Space> ) --> nothing is showed

I am using the version 3.5.5375 Linux

Could you please tell me if COdeLite support typedef using ## in the macro ? I already try this with Eclipse and eclipse understand the feature

Thanks

DO Hong Son
Last edited by dhs on Sun Mar 25, 2012 6:12 pm, edited 1 time in total.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeCompletion for typedef defined with macro

Post by eranif »

Enable clang code completion - and it should understand that

http://www.codelite.org/LiteEditor/ClangIntegration35


Eran
Make sure you have read the HOW TO POST thread
dhs
CodeLite Enthusiast
Posts: 23
Joined: Fri Mar 16, 2012 3:02 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeCompletion for typedef defined with macro

Post by dhs »

Hi

I compile codelite on Linux without clang because the gcc version of my linux machine is a little bit old (here is the post: viewtopic.php?f=3&t=1642)

Is there any other workaround for this issue ?

Another issue I can see is that sometime CodeLite cannot distinguish between a normal variable and a pointer; So if I have a class X with a varibale x, CodeLIte will show same functions on code complete list when I do (x.) and (x->).

Thanks
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeCompletion for typedef defined with macro

Post by eranif »

dhs wrote:Is there any other workaround for this issue ?
No.
dhs wrote:Another issue I can see is that sometime CodeLite cannot distinguish between a normal variable and a pointer; So if I have a class X with a varibale x, CodeLIte will show same functions on code complete list when I do (x.) and (x->).
Works as intended - in the far past it was trying to be smarter and auto fix based on the operator used - it caused more annoyance then it helped

Eran
Make sure you have read the HOW TO POST thread
dhs
CodeLite Enthusiast
Posts: 23
Joined: Fri Mar 16, 2012 3:02 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeCompletion for typedef defined with macro

Post by dhs »

I try the following workaround by adding into Tagsoption --> ctags --> Advanced --> Types:
VectorInt=std::vector<int>
but CodeLite still does not show the code completion.

Did I do something wrong ?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeCompletion for typedef defined with macro

Post by eranif »

dhs wrote:VectorInt=std::vector<int>
I am not sure why, but this should work:

Code: Select all

#include <vector>
...
typedef std::vector<int> VectorInt;
VectorInt myVec;
myVec. // completion works
Eran
Make sure you have read the HOW TO POST thread
dhs
CodeLite Enthusiast
Posts: 23
Joined: Fri Mar 16, 2012 3:02 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeCompletion for typedef defined with macro

Post by dhs »

Could you please explain to me the difference between Types and Tokens in Tag Settings --> ctags --> Advanced ?

Is it possible to have the preprocessed files after Tokens and Types ? (to check if replacement is correct)

I try to explore the ctag file using a SQLite brower. is it possible to add some types manually to the database ?
Post Reply