Author Topic: Doxygen documentation with code completion?  (Read 9868 times)

Offline gokudo

  • Single posting newcomer
  • *
  • Posts: 4
Doxygen documentation with code completion?
« on: February 28, 2006, 01:30:42 pm »
Hi everyone.
I mainly program with java, and with a good IDE in this language we can always see the javadoc near the code completion window.
I've never seen this feature in a c++ ide (except visual studio which uses its own type of documentation - not doxygen, the most commonly used type of documentation).
I don't know if this would easy to implement or if everyone don't care, but I really think this could be useful.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5179
Re: Doxygen documentation with code completion?
« Reply #1 on: February 28, 2006, 01:34:20 pm »
nice idea for an extension, but the first topic we need to solve is, getting a good code completion. For the moment there are several issues with it. ;-)

Offline gokudo

  • Single posting newcomer
  • *
  • Posts: 4
Re: Doxygen documentation with code completion?
« Reply #2 on: February 28, 2006, 01:48:46 pm »
Yep, I now that.
But, by experience, I know that when a project become too big it's very difficult to add new features.
I really thing this type of feature could be the big "+" to make Code::Blocks one of the greatest ide for C++. So I try to point that, if you think this is interresting maybe you will create you project to make it easy-to-implement.

PS: please forgot my poor writting, my main language is not english.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Doxygen documentation with code completion?
« Reply #3 on: February 28, 2006, 01:58:05 pm »
But, by experience, I know that when a project become too big it's very difficult to add new features.

Yes, IMHO it is so. But if you design your project in a modular and scalable way and you avoid unnecessary hard-coding, then it would be easier to add new features.

Anyway, your suggestion is interesting :).

Best wishes,
Michael

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: Doxygen documentation with code completion?
« Reply #4 on: February 28, 2006, 03:52:10 pm »
gokudo: I agree wholeheartedly that this would be an excellent feature to have.

Albeit behind the scenes, I am working on building a code-completion parser with the potential for integration with Code::Blocks. Though I don't yet have the actual parser done at all (I'm struggling to come up with a good, modular and flexible design), the overall structure allows the ability to parse comments (and thus documentation of any style, including Doxygen-style) alongside the code itself, rather than extracting all commentary during a "preprocessing" stage. I implemented a "multilexer" (to coin a term) that directly tokenizes streams of characters into a stream of C or C++ tokens, whitespace, preprocessor directives, and commentary. I envision an "Overseer" class that will then direct this stream to appropriate subtasking classes including a "TokenFilter" class that can remove unneeded tokens from the stream (compiler-specific extensions, such as GCC's __attribute__, come to mind), a "CommentParser" and a "CxxParser" which will act in tandem to parse commentary and code, and any others as needed.

However the code completion redesign happens, it should definitely include functionality to handle all the contents of a source file. This will allow features like accompanying documentation to fall into our collective laps, so to speak.
« Last Edit: February 28, 2006, 04:14:34 pm by TDragon »
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Doxygen documentation with code completion?
« Reply #5 on: February 28, 2006, 05:29:10 pm »
So you have given up on using a real C++ parser that builds a full AST?  One like Elsa or ANTLRC++.  I know this is going to come on strong, but I have no faith in a custom built C++ parser providing any better level of functionality than the current pluggin.  Instead of spending hundreds of hours reinventing the wheel we should port Elsa (some small linux dependent pieces exist), or get the ANTLR passed parser working.  Then we can do a whole lot more than just code completion.  Elsa at least builds a full AST out of all possible c++ code including the stl headers, so it has full namespace and template support.  It has a prebuilt visitor based system for pulling information out of the AST, so you can gather all the information you need.

Now you could integrate the Elsa or ANTLR passed parser as your "cxxparser", but I don't think you need to go through all the extra work of building a parser smart enough to filter out that information.  I think the above listed parsers might keep the comments in the AST, and If they do, then it will save you a lot of work, they also don't care about extra preprocessor tokens.  Of course you could always use ucpp, or wave to preprocess everything for you.

In the end you will probably spend as much time integrating these already built libraries/parsers as you would in reimplementing a more stable version of the current pluggin, but you get something many times more powerfull.  I think it is worth it.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: Doxygen documentation with code completion?
« Reply #6 on: February 28, 2006, 07:14:42 pm »
So you have given up on using a real C++ parser that builds a full AST?  One like Elsa or ANTLRC++.
Not so much given up on as moved beyond. As it happens, I spent the past two to three months updating and integrating the ANTLR C++ grammar, to the point where it will now successfully parse most of the GCC libstdc++ headers. This done, it should be a fairly simple exercise integrating it with any existing base for code completion. Why, then, have I moved beyond it? Simply: It's SLOW. Parsing the iostream header takes in excess of 5 seconds on my machine, and that using all the CPU possible, rather than playing nice in threads as a good code completion module would. Granted, the iostream header is one of the bigger ones -- but it's also one of the more commonly used ones. Also granted, 5 seconds isn't a terribly long amount of time -- but it's too long for a code completion parser.

Quote
I know this is going to come on strong, but I have no faith in a custom built C++ parser providing any better level of functionality than the current pluggin.  Instead of spending hundreds of hours reinventing the wheel we should port Elsa (some small linux dependent pieces exist), or get the ANTLR passed parser working.  Then we can do a whole lot more than just code completion.  Elsa at least builds a full AST out of all possible c++ code including the stl headers, so it has full namespace and template support.  It has a prebuilt visitor based system for pulling information out of the AST, so you can gather all the information you need.
Because Elsa won't compile for Windows without porting work, I've passed over it thus far.

Quote
Now you could integrate the Elsa or ANTLR passed parser as your "cxxparser", but I don't think you need to go through all the extra work of building a parser smart enough to filter out that information.  I think the above listed parsers might keep the comments in the AST, and If they do, then it will save you a lot of work, they also don't care about extra preprocessor tokens.  Of course you could always use ucpp, or wave to preprocess everything for you.
I integrated ucpp with the ANTLR grammar as a part of my previous work, but that was where I encountered the issue I see as a problem: loss of positional data. How does the preprocessor communicate to the parser where the tokens it's receiving resided in the original text? It would take some modification of the ANTLR framework itself to include file position data in the tokens, and of ucpp to generate those tokens.

My CxxMultiLexer covers that straightforwardly, by generating tokens WITH positional data and by not filtering anything, leaving that to the CxxOverseer which in essence "splits" the incoming token stream and sends the relevant tokens to each task-specific class.

Remember, I'm not even an official Code::Blocks developer at this point in time. Most of what I'm working on right now is an experimental learning process, so that, when I'm finally ready to contribute to the code completion module, I'll be able to back the contribution with experience and know-how.
« Last Edit: February 28, 2006, 07:27:52 pm by TDragon »
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: Doxygen documentation with code completion?
« Reply #7 on: February 28, 2006, 07:29:58 pm »
TDragon: I've sent you a PM on this regard. :)