Page 1 of 2
Request: smart-pointers smart auto completion
Posted: Sat Dec 20, 2008 3:09 am
by asterisc
Hey guys, I just took a look at this CodeLite IDE, and I'm very happy to see how it works. However, I found a thing I wish CodeLite should have, smart pointers smart auto-complete.
Take a look at this brief example:
class A
{
public:
void print() {}
};
auto_ptr<A> spA( new A );
spA. <-- should display auto_ptr methods, like it does today
spA-> <-- should display the things in class A
Same for boost::shared_ptr...
Maybe a rule is to check if it has the "operator->" overloaded, and if it has, check if it returns a pointer and if it does, display the pointer's things.
Re: Request: smart-pointers smart auto completion
Posted: Sat Dec 20, 2008 3:14 am
by eranif
asterisc wrote:Same for boost::shared_ptr...
Maybe a rule is to check if it has the "operator->" overloaded, and if it has, check if it returns a pointer and if it does, display the pointer's things.
I believe that you did not test it with shared_ptr, since it is already working for boost shared_ptr
Eran
Re: Request: smart-pointers smart auto completion
Posted: Sat Dec 20, 2008 3:18 am
by asterisc
I only tested it with auto_ptr. Not working for me.
Re: Request: smart-pointers smart auto completion
Posted: Sat Dec 20, 2008 3:30 am
by eranif
What is not working for you? std::auto_ptr or boost::shared_ptr?
See screen shot.
Re: Request: smart-pointers smart auto completion
Posted: Sat Dec 20, 2008 4:37 am
by sdolim
One difference I see in the respective header files: Boost uses a standard namespace declaration:
Code: Select all
namespace boost {
template <class T> class shared_ptr ...
}
But the declaration of auto_ptr is wrapped in a namespace macro:
Code: Select all
_GLIBCXX_BEGIN_NAMESPACE(std)
template <typename _Tp> class auto_ptr ...
_GLIBCXX_END_NAMESPACE
Also, there is an explicit template specialization for type void in the same file:
Code: Select all
template <> class auto_ptr<void> ...
Boost does not have this, since it uses a separate traits class, which does have specializations.
Eran, does ctags_le handle template specializations correctly?
Scott
Re: Request: smart-pointers smart auto completion
Posted: Sat Dec 20, 2008 11:09 am
by eranif
Hi Scott,
If you open the pre-processor list (settings -> tags settings -> advanced tab -> preprocessors), you will see that I entered an entire section to handle STL oddities:
Code: Select all
_GLIBCXX_BEGIN_NAMESPACE(std)=namespace std{
_GLIBCXX_END_NAMESPACE=}
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)=namespace std{
_GLIBCXX_END_NESTED_NAMESPACE=}
_GLIBCXX_STD=std
These replacements are preformed inline by ctags-le (NOT supported by regular ctags), so when the yacc parser tries to parse the text, it sees standard namespace declaration.
BTW: without this, typing std:: would have fail (for STL 4.2 and up I think)
I will need to check deeper about auto_ptr
Eran
Re: Request: smart-pointers smart auto completion
Posted: Sat Dec 20, 2008 1:00 pm
by asterisc
I only tested std::auto_ptr which isn't currently working. I assumed shared_ptr isn't working as well, but I was wrong.
You do a very good job and you guys are very responsive! Keep up the good work!
Re: Request: smart-pointers smart auto completion
Posted: Sun Dec 21, 2008 3:59 am
by asterisc
Not smart-pointer related, but auto-completion isn't working for iterators.
Example:
Code: Select all
class C
{
public:
void foo() const {}
};
int main()
{
vector<C> c_vec;
for( vector<C>::const_iterator it = c_vec.begin(); it != c_vec.end(); ++it )
it->... //< nothing is shown
}
I'm using Kubuntu 8.10 and CL 1.0.2527, downloaded from the CL website.
Re: Request: smart-pointers smart auto completion
Posted: Sun Dec 21, 2008 9:41 am
by eranif
Yes, the entire STL library is problematic for parsing. Dont expect any solution in the near future
Eran
Re: Request: smart-pointers smart auto completion
Posted: Sun Dec 21, 2008 4:36 pm
by asterisc
Sorry to announce, but auto-completion isn't working in this case as well:
Code: Select all
class C
{
public:
void foo() {}
};
nt main()
{
typedef C D;
D c;
c. //< nothing is displayed
}
using CodeLite Revision 2527, for Windows, this time.