Thread: [CEDET-devel] Displaying list of constructors in cpp
Brought to you by:
zappo
From: Nikhil P. <nik...@gm...> - 2010-04-24 08:16:48
|
Hi all, I recently started using Cedet for one of my Qt projects. After digging around the mailing list and tinkering with options I managed to get some nifty autocompletion working on Win7 / Qt 4.6 / emacs 23.1.50. One feature thought, that is either missing or I haven't been able to find yet, is some way to list all the possible overloaded constructors of a class when I'm creating a new object. As a simple example of what I'm talking about: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include <QtGui/QApplication> #include <QtGui/QPushButton> int main(int argc, char* argv[]) { QApplication app(argc, argv); QPushButton button( <-- at this point I'd like to see a list of constructors } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I have searched for possible commands that might implement this functionality and the closest I've come is the speedbar-analyzer mode. Even this however, only manages to show the list of constructors for when I'm creating an object using new, like: QPushButton* button = new QPushButton( <-- at this point speedbar anaylzer shows me a list of constructors So I'm wondering is there some way to list constructors for local objects. This to me is one of the most useful features that an IDE like QtCreator can offer. Could there be some command to provide the list of constructors maybe in the Completion buffer or something like that. Thanks in advance for all the help. -- -Nikhil |
From: Eric M. L. <er...@si...> - 2010-04-27 00:51:10
|
Hi, That information is available, but not through a handy user command. I added a short example function in semantic-ia.el and checked it in. If you update from cvs, you can try it as: M-x semantic-ia-show-variants RET If this does what you want, let me know and we can figure out how to make it more accessible. Eric On 04/24/2010 04:16 AM, Nikhil Parakh wrote: > Hi all, > > I recently started using Cedet for one of my Qt projects. After digging > around the mailing list and tinkering with options I managed to get some > nifty autocompletion working on Win7 / Qt 4.6 / emacs 23.1.50. One > feature thought, that is either missing or I haven't been able to find > yet, is some way to list all the possible overloaded constructors of a > class when I'm creating a new object. > > As a simple example of what I'm talking about: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > #include <QtGui/QApplication> > #include <QtGui/QPushButton> > > int main(int argc, char* argv[]) { > QApplication app(argc, argv); > QPushButton button( <-- at this point I'd like to see a list of > constructors > } > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > I have searched for possible commands that might implement this > functionality and the closest I've come is the speedbar-analyzer mode. > Even this however, only manages to show the list of constructors for > when I'm creating an object using new, like: > > QPushButton* button = new QPushButton( <-- at this point speedbar > anaylzer shows me a list of constructors > > So I'm wondering is there some way to list constructors for local > objects. This to me is one of the most useful features that an IDE like > QtCreator can offer. Could there be some command to provide the list of > constructors maybe in the Completion buffer or something like that. > > Thanks in advance for all the help. > > -- > -Nikhil > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Cedet-devel mailing list > Ced...@li... > https://lists.sourceforge.net/lists/listinfo/cedet-devel |
From: Nikhil P. <nik...@gm...> - 2010-05-11 05:18:40
|
Hi again, Sorry for the really late reply. It's been a busy couple of weeks. So I checked out the latest cedet revision from CVS and had a look at the function you mentioned: 'semantic-ia-show-variants'. As an example, here is what is happening: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include <QtGui/QApplication> #include <QtCore/QPoint> int main(int argc, char* argv[]) { QApplication app(argc, argv); QPoint point( <-- at this point do M-x semantic-ia-show-variants RET } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ However the command only returns a "Wrong type argument: integer-or-marker-p, nil" message. When I try the command before opening the argument bracket, like this: QPoint point <-- at this point M-x semantic-ia-show-variants RET, a *Symbol Variants* buffers pops open with the contents: ~~~~~~~~~~~~~~~~~~~~~~~~~~ inline QPoint point (int index) inline QPointF pointAt (qreal t) ~~~~~*Symbol Variants*~~~~~~~ This doesn't look right. It might be a problem in my cedet configuration, but apart from this function the completion is working as expected. Also I had cleared the .semanticdb and .srecode directories before using the cedet from cvs. In case it might help here's the relevant section from the .emacs file: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (load-file "~/.emacs.d/cedet/common/cedet.el") (require 'semantic-ia) (require 'semantic-gcc) (require 'semantic-sb) (semantic-load-enable-excessive-code-helpers) ;; smart completions (setq-mode-local c-mode semanticdb-find-default-throttle '(project unloaded system recursive)) (setq-mode-local c++-mode semanticdb-find-default-throttle '(project unloaded system recursive)) (setq qt4-base-dir "/usr/include/Qt") (semantic-add-system-include qt4-base-dir 'c++-mode) (add-to-list 'semantic-lex-c-preprocessor-symbol-file '"/home/nparakh/include/dummy.h") (add-to-list 'auto-mode-alist (cons qt4-base-dir 'c++-mode)) (add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir "/Qt/qconfig.h")) (add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir "/Qt/qconfig-dist.h")) (add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir "/Qt/qglobal.h")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("Q_GUI_EXPORT" . "")) (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("Q_CORE_EXPORT" . "")) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ My experience in elisp is minimal at best, but if there's anything I can do to help debug what might be going wrong, I'll gladly help. Thanks for your time. -- -Nikhil On Tue, Apr 27, 2010 at 6:26 AM, Eric M. Ludlam <er...@si...>wrote: > Hi, > > That information is available, but not through a handy user command. I > added a short example function in semantic-ia.el and checked it in. If you > update from cvs, you can try it as: > > M-x semantic-ia-show-variants RET > > If this does what you want, let me know and we can figure out how to make > it more accessible. > > Eric > > > On 04/24/2010 04:16 AM, Nikhil Parakh wrote: > >> Hi all, >> >> I recently started using Cedet for one of my Qt projects. After digging >> around the mailing list and tinkering with options I managed to get some >> nifty autocompletion working on Win7 / Qt 4.6 / emacs 23.1.50. One >> feature thought, that is either missing or I haven't been able to find >> yet, is some way to list all the possible overloaded constructors of a >> class when I'm creating a new object. >> >> As a simple example of what I'm talking about: >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> #include <QtGui/QApplication> >> #include <QtGui/QPushButton> >> >> int main(int argc, char* argv[]) { >> QApplication app(argc, argv); >> QPushButton button( <-- at this point I'd like to see a list of >> constructors >> } >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> I have searched for possible commands that might implement this >> functionality and the closest I've come is the speedbar-analyzer mode. >> Even this however, only manages to show the list of constructors for >> when I'm creating an object using new, like: >> >> QPushButton* button = new QPushButton( <-- at this point speedbar >> anaylzer shows me a list of constructors >> >> So I'm wondering is there some way to list constructors for local >> objects. This to me is one of the most useful features that an IDE like >> QtCreator can offer. Could there be some command to provide the list of >> constructors maybe in the Completion buffer or something like that. >> >> Thanks in advance for all the help. >> >> -- >> -Nikhil >> >> >> >> >> ------------------------------------------------------------------------------ >> >> >> >> _______________________________________________ >> Cedet-devel mailing list >> Ced...@li... >> https://lists.sourceforge.net/lists/listinfo/cedet-devel >> > |
From: Eric M. L. <er...@si...> - 2010-05-12 11:31:16
|
Hi, I appear to have introduced some sort of bug in my local copy of CEDET that is preventing me from evaluating this. I'll get back to this once I get this other include parsing bug fixed. Thanks Eric On 05/11/2010 01:18 AM, Nikhil Parakh wrote: > Hi again, > > Sorry for the really late reply. It's been a busy couple of weeks. > So I checked out the latest cedet revision from CVS and had a look at > the function you mentioned: 'semantic-ia-show-variants'. As an example, > here is what is happening: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > #include <QtGui/QApplication> > #include <QtCore/QPoint> > > int main(int argc, char* argv[]) { > QApplication app(argc, argv); > QPoint point( <-- at this point do M-x semantic-ia-show-variants RET > } > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > However the command only returns a "Wrong type argument: > integer-or-marker-p, nil" message. > > When I try the command before opening the argument bracket, like this: > QPoint point <-- at this point M-x semantic-ia-show-variants RET, a > *Symbol Variants* buffers pops open with the contents: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~ > inline QPoint point (int index) > inline QPointF pointAt (qreal t) > ~~~~~*Symbol Variants*~~~~~~~ > > This doesn't look right. It might be a problem in my cedet > configuration, but apart from this function the completion is working as > expected. Also I had cleared the .semanticdb and .srecode directories > before using the cedet from cvs. In case it might help here's the > relevant section from the .emacs file: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > (load-file "~/.emacs.d/cedet/common/cedet.el") > (require 'semantic-ia) > (require 'semantic-gcc) > (require 'semantic-sb) > (semantic-load-enable-excessive-code-helpers) > > ;; smart completions > (setq-mode-local c-mode semanticdb-find-default-throttle > '(project unloaded system recursive)) > (setq-mode-local c++-mode semanticdb-find-default-throttle > '(project unloaded system recursive)) > > (setq qt4-base-dir "/usr/include/Qt") > (semantic-add-system-include qt4-base-dir 'c++-mode) > (add-to-list 'semantic-lex-c-preprocessor-symbol-file > '"/home/nparakh/include/dummy.h") > (add-to-list 'auto-mode-alist (cons qt4-base-dir 'c++-mode)) > (add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat > qt4-base-dir "/Qt/qconfig.h")) > (add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat > qt4-base-dir "/Qt/qconfig-dist.h")) > (add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat > qt4-base-dir "/Qt/qglobal.h")) > > (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("Q_GUI_EXPORT" . "")) > (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("Q_CORE_EXPORT" . > "")) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > My experience in elisp is minimal at best, but if there's anything I can > do to help debug what might be going wrong, I'll gladly help. > > Thanks for your time. > > -- > -Nikhil > > On Tue, Apr 27, 2010 at 6:26 AM, Eric M. Ludlam <er...@si... > <mailto:er...@si...>> wrote: > > Hi, > > That information is available, but not through a handy user command. > I added a short example function in semantic-ia.el and checked it > in. If you update from cvs, you can try it as: > > M-x semantic-ia-show-variants RET > > If this does what you want, let me know and we can figure out how to > make it more accessible. > > Eric > > > On 04/24/2010 04:16 AM, Nikhil Parakh wrote: > > Hi all, > > I recently started using Cedet for one of my Qt projects. After > digging > around the mailing list and tinkering with options I managed to > get some > nifty autocompletion working on Win7 / Qt 4.6 / emacs 23.1.50. One > feature thought, that is either missing or I haven't been able > to find > yet, is some way to list all the possible overloaded > constructors of a > class when I'm creating a new object. > > As a simple example of what I'm talking about: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > #include <QtGui/QApplication> > #include <QtGui/QPushButton> > > int main(int argc, char* argv[]) { > QApplication app(argc, argv); > QPushButton button( <-- at this point I'd like to see a list of > constructors > } > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > I have searched for possible commands that might implement this > functionality and the closest I've come is the speedbar-analyzer > mode. > Even this however, only manages to show the list of constructors for > when I'm creating an object using new, like: > > QPushButton* button = new QPushButton( <-- at this point speedbar > anaylzer shows me a list of constructors > > So I'm wondering is there some way to list constructors for local > objects. This to me is one of the most useful features that an > IDE like > QtCreator can offer. Could there be some command to provide the > list of > constructors maybe in the Completion buffer or something like that. > > Thanks in advance for all the help. > > -- > -Nikhil > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Cedet-devel mailing list > Ced...@li... > <mailto:Ced...@li...> > https://lists.sourceforge.net/lists/listinfo/cedet-devel > > |
From: Eric M. L. <er...@si...> - 2010-05-13 01:51:41
|
On 05/11/2010 01:18 AM, Nikhil Parakh wrote: > Hi again, > > Sorry for the really late reply. It's been a busy couple of weeks. > So I checked out the latest cedet revision from CVS and had a look at > the function you mentioned: 'semantic-ia-show-variants'. As an example, > here is what is happening: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > #include <QtGui/QApplication> > #include <QtCore/QPoint> > > int main(int argc, char* argv[]) { > QApplication app(argc, argv); > QPoint point( <-- at this point do M-x semantic-ia-show-variants RET > } > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > However the command only returns a "Wrong type argument: > integer-or-marker-p, nil" message. Hmmm. I got "No completions", but this is likely because I have different Qt headers. > When I try the command before opening the argument bracket, like this: > QPoint point <-- at this point M-x semantic-ia-show-variants RET, a > *Symbol Variants* buffers pops open with the contents: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~ > inline QPoint point (int index) > inline QPointF pointAt (qreal t) > ~~~~~*Symbol Variants*~~~~~~~ I didn't get anything here, just a "no variants" message. If I put the cursor on QPoint, I got lots of possible constructor variants. Probably there is some magic needed for c++ to recognize a constructor and pull the prototype info from the type, not the variable name. Eric |