Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: eranif on August 21, 2006, 01:44:17 pm

Title: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on August 21, 2006, 01:44:17 pm
Hi,

On January 06, 2006 I posted a thread about using ctags as parser, and many people responded that there is even 3 alternatives for it and some are under development.

My question is:

What is the status of CodeCompletion? - and when I am talking about code completion, I am talking about: Symbol tree, Hint tips, auto completion and find symbols?

is it working well?

I am currently working on a complete solution for all of the above - using my old idea of ctags & sqlite.
I redesgined everything to be more OOD - and its currently working very well.

If this is still relevant, talk to me

Eran
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 21, 2006, 02:15:57 pm
Hi Eran!

What is the status of CodeCompletion? - and when I am talking about code completion, I am talking about: Symbol tree, Hint tips, auto completion and find symbols?

is it working well?
The GUI-part is working well for the most part. It's the parser the one who isn't.
In the last week the parser has been improved and continues to be improved. But it is still far from perfect, and remember that is a hand-crafted one.

I am currently working on a complete solution for all of the above - using my old idea of ctags & sqlite.
I redesgined everything to be more OOD - and its currently working very well.

I would really want to see if you can make an alternative CodeCompletion plugin, or adapt the current one to your parser.

Now about your parser, I'm about to tell you someone else (ddiego, the author of the VCF library) is working on something very simmilar to this (see here: http://vcfbuilder.org/?q=node/139).
The parser is made by using Ctags and SQLite, with the addition of the C++ ANTLR parser (which is the most complete and correct parser I could found). ucpp is being used for macro preprocessing.

I've talked to him on this thread: http://vcfbuilder.org/?q=node/143 (you need to register in the forum to see it complete), and nonetheless I think what he's working on now it's the best approach for C++ parsing.
For languages other than C++, it's different, as most of the languages aren't difficult to parse, a Ctags-only based plugin is a good bet.

I really encourage you for making the plugin, as well I would like if you can go and discuss or coordinate in the above thread with ddiego, you know, you can learn from his experiences about implementing the parser, and viceversa.  :)

Regards,
Takeshi Miya
Title: Re: CodeCompletion - what is the status?
Post by: Game_Ender on August 21, 2006, 03:17:54 pm
Please continue with your solution, the pluggin based system of Code::Blocks leaves plenty of room for multiple implementations, especially since I am sure the Code::Blocks team would probably rather be focusing their efforts toward the compilier redisgn effort.
Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 21, 2006, 03:42:03 pm
Thanks for the motivation  :wink:

I will try to complete the work in the coming weeks with a sample GUI demostration for you guys to give feedback.

When I have something to show you, I will post it here.


Eran

Title: Re: CodeCompletion - what is the status?
Post by: thomas on August 21, 2006, 09:07:48 pm
Hi Eran!

Code completion still works the same as it did almost a year ago (except for a few minor tweaks and other default settings), there is no noticeable improvement to date.

Ceniza has partially implemented (and is still working on) a parser that is a lot faster and more reliable than the current one (and which correctly interpretes all language features). Once we're satisfied with it, we will remake the code completion plugin bottom up.

Nevertheless, this should not stop you from pursuing your idea. It should (within the limits of ctags) work just fine, and if nothing else, ctags is reliable and reasonably fast.
Personally, I don't think that using SQLite is a good idea because I believe that parsing the SQL and converting data to and from the database's storage format may cause noticeable overhead, but I may as well be wrong. Prove me wrong! I'll be happy if you do :)

I think having two approaches at hand is not a bad thing at all. Your approach may be a lot more flexible to support other languages, too.
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 21, 2006, 09:41:07 pm
Personally, I don't think that using SQLite is a good idea because I believe that parsing the SQL and converting data to and from the database's storage format may cause noticeable overhead, but I may as well be wrong. Prove me wrong! I'll be happy if you do :)
You'll be happy, Eran has already proved that SQLite is very fast for the purpose (you can download his IDE).
The c++ parser of ddiego also uses SQLite and Ctags, and he said it was very fast, the code parsing is the bottleneck

I think having two approaches at hand is not a bad thing at all. Your approach may be a lot more flexible to support other languages, too.
100% true.

Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 21, 2006, 09:48:38 pm
I'll post here the interesting info from http://vcfbuilder.org/?q=node/143 since it requieres registration:
(The replies are from ddiego)

Quote
Something very simmilar to your purpose have been done here: http://forums.codeblocks.org/index.php?topic=1889.0
You really want to read that thread.

However, I didn't have it clear: you will be discarding ANTLR at all, and only using CTags?
Or will use ANTLR to generate the database?

Interesting thread. I still see the need for only 2 "parsers".

 The ctags parser is used to create the persistent DB which will exist in various places just like it Visual Studio does with it's .ncb files. The question becomes how often these db files become updated. For system include directories this would be a one time cost, the db is made once, and then not messed with unless the system includes dir changes or the system include files changes.

The db for the project would be more volatile, that would have to be changed more often, but given the speed of ctags and sqlite I don't see this as a problem.

The difference between the DB data and the parser data, is that the DB data would be more sparse. But the result of using either one would be the creation of an AST that is a graph of CodeNode instances that can be traversed. So if you parse a single file with the ANTLR based C++ parser, or request some data from the ctags based DB, both will return this information as a collection of CodeNode's.

...

I am (I'm already coding this right now) using both. The idea is to use ctags to create a DB that has a broad overview of the various AST elements, but use ANTLR to provide an exact view of a specific file/resource.

...

In addition to my earlier comments here are some thoughts on where I'd like to see this whole thing going:

Currently, relying we are relying soley on the C++ parser to handle ALL of the parsing chores. To parse a single file in "real time" (about as fast as you can type), it works OK, but to potentially have to have it parseing thousands of files to keep track of all the possible headers in your project, plus system (and other third party headers) files seems unwieldy - it just won't handle this fast enough.


So this got me thinking about how all of this (the parser and the CodeStore "engine") should work. After taking a glance at how Visual Studio seems to do things I've come to some conclusions:

    * First, an simplify things by creating a database of all the core elements that we need to display in our class AST. This set of elements is a subset of the entire AST for any given file. We care about things like function declarations, function arguments, templates, template arguments, class declarations, namespace declarations. Putting these into a database makes it easy to search, and provides more potential flexibility for search types.
    * If we have a database of this data, then it makes sense to support more than one. There would be one db per project, and then one (or more) "global" db's for system headers (like the C runtime, or the C++ STL). The global db's would only have to be generated once, since these won't change often (if at all).
    * We would need a schema for the db, a table that has the following columns: 
          o id INTEGER PRIMARY KEY
          o name  TEXT
          o filename  TEXT
          o line INTEGER,
          o kind INTEGER,
          o language INTEGER,
          o access INTEGER
          o inheritance TEXT,
          o parent INTEGER,
          o signature TEXT

    This schema  would allow for generating a hierarchical display if neccesary

    * To generate these databases, we don't need the full fledged support of the C++ parser, since we need only a limited number of AST nodes, at this level. So what what I'm thinking is to use ctags to generate the initial db info, then use SQLite3.2 to create/store the ctags data into a db. This would accomplish most of what we need, then use the parser for those cases where the entire AST is needed. Using ctags, and SQLite, I can create a DB representation of the entire VC98/Includes directory from scratch in about 1 minute or less (that's about 726,773 lines of code scanned). And this would only have to be done once.

All of the above would be done transparently by the CodeStore engine. SQLite source would become incorporated, and ctags would be used as an exe (we can't use it directly as a library due to GPL issues).


----

You can check out the project by doing:
svn co https://svn.sourceforge.net/svnroot/classdom classdom

Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 21, 2006, 10:24:02 pm
Hi Takeshi,

All what you have written here from the thread - I already implemented (the database described by Diego - is almost identical to my...)

I uploaded to my site a compressed zip of my current work including all sources. I reached the part of the auto-completion - all the infrastructure functions are ready - I just need to put the together.

In the zip you can find:
Visual studio workspace 7.1
Three projects: CodeParser, CodeParserTest & CodeParserGUISample
sqlite3.dll

Compile the workspace and run the GUI sample - it is a very easy to use.

When running first time: use the option: Add source to database
and follow the instructions

double click on an item on the GUI tree to the left, will open it in an editor to the right
and will place the cursor on the correct line.

All the logic and flow are located on the frame.cpp file

to make sure it will run, copy ctags.exe and put it under C:\windows\system32

Link to the source files:
www.eistware.com/wxes/codeparser/codeparser.zip (http://www.eistware.com/wxes/codeparser/codeparser.zip)

Link to ctags.exe for windows:
www.eistware.com/wxes/codeparser/ctags.zip (http://www.eistware.com/wxes/codeparser/ctags.zip)

Btw, I too once thought of using real parser for IDE, but I abandoned this idea since true parsers will throw exceptions when syntax is incorrect, so we need more of a guessing system

for example:

When you write:
CBlock block;

as a coder, you automatically assume that CBlock is a class or something like this, but real parser, if it will not find the declaration for it, it will fail.
so you need more tolerant parser.

Anyways, I believe I will complete my work during next week.

Eran


Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 21, 2006, 11:11:56 pm
Btw, I too once thought of using real parser for IDE, but I abandoned this idea since true parsers will throw exceptions when syntax is incorrect, so we need more of a guessing system
You're talking about Compiler parsers, which are designed for being very correct and to fail at the first incorrect syntax.
The ANTLR c++ generated parser does not, however, because it is designed to be extremelly correct, but as it's a generated parser you can control what to do at failing times, and how to generate the AST, etc.

Quoting ddiego which have read your previous thread: "I still see the need for only 2 parsers.
The idea is to use ctags to create a DB that has a broad overview of the various AST elements, but use ANTLR to provide an exact view of a specific file/resource."

The idea of having also an exact view of a specific file also becomes evident when we'll want to use the parser for Refactoring. In that moment, we'll have to use the "exact view".

So that hybrid approach seems to be the best solution.

Anyways, I believe I will complete my work during next week.
Thank you for your efforts, really looking forward to it!

Regards,
Takeshi Miya
Title: Re: CodeCompletion - what is the status?
Post by: MortenMacFly on August 23, 2006, 11:16:48 pm
In the zip you can find:
Visual studio workspace 7.1
I read this and would like to have a look into it. Unfortunately I don't get it compiled. Besides the fact I have no VC7.1 I tried converting this into a C::B project but... failed! :shock:
Eran: Do you see any chance to provid me (us) with a C::B project file that e.g. uses the wxWidgets libs as they are produces for C::B (please look at: http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Building (http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Building))? I ask because you may have this already - it may be not much work for you...?!
With regards, Morten.
Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 24, 2006, 12:29:42 am
Hi Morten,

For the VC7.1, I dont have other editors here (unless VC8 is good for you ... ), I dont have C:B cause I am too lazy to build it from scratch  - I am patiently waiting for the official release so I can install it using setup  :D

What I can do, is to pack everything in setup.exe and will upload it to my site

EDIT:

here is the link for the setup.exe installation for the sample - it will install missing dlls & ctags for you (uninstall is also provided)
www.eistware.com/wxes/codeparser/CodeParserSample.exe (http://www.eistware.com/wxes/codeparser/CodeParserSample.exe)

While I am writing here, I will report my progress so far  :):

First of all, I want to make a point that I am making this is a wxWidget library and not C::B plugin. So it means that once it is completed, it  is up to the developers here to decide whether they choose to use it or not (an integrate it into C::B), but I will be more then happy to answer/fix anything required from my side.

About the current status:

I actually made a nice progress with it:

- What now is working nicely is the class tree + class tree updating during editing
- Tomorrow I will focus my work on WordCompletion (when you type Ctrl+Space - a list of suitable words will appear or if only one word is available, it will be completed automatically) - this part is including local scope and workspace scope, should be completed by friday I think.

Next step is the code completion - I am familiar with couple of cases that will cause problems:
1. Casting - 'C' style casting is a pain in the a**. - I can parse a simple casting and get the method, however there will be cases that it will fail. the simple cases, such as ((Box*)rect)-> will give the correct results for code completion

2. Inhertiance members are not taking into considerations - but this one is easy to implement - so I dont expect any problems here

After code completion, comes symbol searches ( find function declaration Ctrl + . will jump you to function / member implementation or declaration )

I really hope that by the end of next week everything will be completed for testing ( I do expect bugs, but i want it to be stable )

Eran


Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 27, 2006, 12:52:54 am
Hi,

I have updated the sample program on my website, it is now demonstrates the following:

1. Building up a GUI tree (AKA Symbol tree) using ctags & sqlite
2. GUI tree is updated upon saving the file. If you will change file content the tree will be updated once you save it, this is done since ctags accepts files as input, so updating the tree per interval is too much overhead (creating temporary file, passing it to ctags and then delete it - too much)
3. Saving the tree into database for later reloading
4. word completion is now completed - what is word completion you may ask, well, word completion is step one of the CodeCompletion, it completes words using Ctrl + Space, the completion is considering the local scope and the entire workspace.
HOw does it works? first it scans local scope for members that qualifies with the partial name under the cursor, and then scan the database and adds other matches (if we are inside class, it will add its members / functions) such as GLOBAL variables + function + class struct etc

if only single match exist, it will automatically insert it under the cursor, else it will print out to the debug window the matches it found. scope depth is taking into consideration as well, for example:
Code
void foo()
{
    int number =0;
    if(number == 0)
    {
           wxString name;
           break;
    }
    n<------ Here you type Ctrl + Space
only number will be available from local scope since name is in depth=2 while number is depth=1 same as n.

If you would like to check out the sample (I named the libe CodeLite & the sample program LiteEditor  :wink::
http://www.eistware.com/wxes/codeparser/liteeditor.exe (http://www.eistware.com/wxes/codeparser/liteeditor.exe)

If you want the source files, drop me a message here or in private and I will upload them or email them (to package them I need to close my editor and close all windows so I can tar it ^^)

Eran
Title: Re: CodeCompletion - what is the status?
Post by: grunerite on August 27, 2006, 03:27:51 pm
If you would like to check out the sample (I named the libe CodeLite & the sample program LiteEditor  :wink::
http://www.eistware.com/wxes/codeparser/liteeditor.exe (http://www.eistware.com/wxes/codeparser/liteeditor.exe)

Hi Eran,

Pretty cool. I think this is meant to be an example to show that it works, but this example app could be made a valuable tool if you add 1 more feature: the ability to open more than 1 source file at a time. In the file open dialog, I can select many files at once, but it only opens 1 file (last clicked?).

I commonly download some library code, and don't want to load it up in an IDE to browse classes, etc. With this app, I could just load up a bunch of source at once and browse through it to learn the library faster.

Very nice.
Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 27, 2006, 03:45:09 pm
Hi,


Pretty cool. I think this is meant to be an example to show that it works, but this example app could be made a valuable tool if you add 1 more feature: the ability to open more than 1 source file at a time. In the file open dialog, I can select many files at once, but it only opens 1 file (last clicked?).


Well, my intention was to demonstrate that the library itself works well before I will hand it over to some of the developers here to integrate it into C::B.

The reason that you cant open more than one file is that the current API of the library TagsManager::SourceToTags support single file only, I still need to add some kind of batch operation API, but this is very straightforward to do.

About enhancing it, once the library is completed I will publish it along with the source code of the editor (the sample program) to the public domain

I published it as setup.exe becuase one of the developers here said that he cant open the source file using VC7.1 - my working enviornment, so I created an install shield using InnoSetup for it.

I really hope I will complete the CodeCompletion by the end of this week.

A question for users / developers here:

I am considering that the library itself will popup a AutoCompletion box - my own implementation, and a find symbol dialog (for example, find a function declaration/definition)
what do you guys think?

Eran
Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 28, 2006, 11:45:42 pm
Hi,

I think that the code completion is pretty much ready for integration - if you guys want it.

I will start by listing what I have accomplished so far:

- As described in previous posts - tree view & tree updates using the library thread which works in the background
- WordCompletion - attempts to complete a word under the cursor when hot key is pressed ( in the demo it is Ctrl+Space ), if single match is found, the word is inserted automatically no list box is poped, other wise, user selection box pops up (scintilla built in)
- CodeCompletion - typing an operator . or -> will attempt to parse the expression and to evaluate its return value, this is done with no limit of how complex the sentence is. for example: GetClassBox().GetBox().GetName(), a popup box will be shown for every operator (if a match will be found).
- Partial casting is supported (currently, only 'C' style casting is supported)
- All files were build and tested using g++ 3.4.5 MinGW, makefile is provided, you may need to alter it a bit, but the hard part of converting to code to compile under g++ is behind me (pheww, MSVC warning level 4 didnt do the job i got hundreds of errors when attempted to build with g++, especially with templates)
- Batch API was added to allow adding multiple files at a time to the database (in the demo you can select File->Add source file -> and select multiple files)
- Smart file parsing, if for example you have only the implementation of a function :
 
Code
int Rectange::GetTopRight() {}
and the class Rectangle is declared in another file, which you did not add to the database, the library will automatically identifies that something is missing (in our case Rectange) and will 'fill' the space with 'dummy' entry to the tree view and the database. Once the real entry is added it will replace the dummy one.

Need to be added with minimum effort:
- Scope operator ( :: )
- this pointer & *this
- C++ casting (static_cast, dynamice, const_cast, reintepret_cast) style
- Identify whether an indentifier is a pointer or reference (or object), currently it responds for both regardless the type (e.g. Box *b; b. <-- will open a popup box)

I think that the code is well documented and can be easily read and followed.

The source files can be retrieved at:
http://www.eistware.com/wxes/codelite/CodeLite_sources.zip (http://www.eistware.com/wxes/codelite/CodeLite_sources.zip)

to build the demo, you will need the following:
wxscintilla, wxsqlite3 and wxcontrols (already provided, under sdk/gcc_lib)

Setup for the demo:
http://www.eistware.com/wxes/codelite/LiteEditor.exe (http://www.eistware.com/wxes/codelite/LiteEditor.exe)

Eran
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 29, 2006, 10:55:38 am
Eran: Amazing, is all I can say.

I'm trying to compile it with GCC, I'll let you know if I get stuck.

UPDATE:
I could compile & link CodeLite without errors :D (but with 300 warnings, mostly "defined but not used variables" and "dllimports" warnings).
I could compile & link LiteEditor with all it's dependencies, except wxFlatNotebook, since it's missing the implementation (wxFlatNotebook.cpp), and it appears to be different to the one in SourceForge and the one shipped in C::B.

I've tried first to compile in UNICODE mode but I failed, there are errors regarding conversions between char* and wxStrings specially in the ctags_manager.
In ANSI mode I didn't have to touch any line of code to get it to compile successfully in C::B/GCC .

Suggestion: can you remove the wxControls dependency? I know they're nice, but they're not necessary in this case (and the debug version weights 15mb). With wxScintilla and wxFlatNotebook is enough for demoing purposes.

The most serious issue is Unicode: I guess the conversions between ASCII<->UNICODE will be necessary in Ctags since I doubt it supports unicode, but I wonder if saving the DB in ANSI would be good. (In a dream world Ctags would support unicode tags and filenames).


Now on the library itself:
Wow it's very fast, ~2 seconds for parsing the entire C::B SDK and ~1 second for opening the DB. :)
And the tree symbol seems to be correct, I didn't found nothing missing at first glance (except inherited members?).
As for the WordCompletion, it seems to work ok for the most cases :D, but I get usually 0 matches with local scope variables.

Aside from that, something that would really want to have, is comment parsing, along with (simple) doxygen parsing.
Something like this:

For CodeCompletion
(http://www.wholetomato.com/products/features/images/shorthandQuery.gif)

"Hovering tooltips"
(http://www.wholetomato.com/products/features/images/hoverFromSource.gif)

And for the Tree view
(http://www.wholetomato.com/products/features/images/hcbTooltip.gif)

Honestly these are the only things I still miss from the days of Visual Studio + Visual Assist X.
Title: Re: CodeCompletion - what is the status?
Post by: tiwag on August 29, 2006, 03:59:03 pm
can you post the cb project file please
Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 29, 2006, 04:46:45 pm
Quote
Suggestion: can you remove the wxControls dependency? I know they're nice, but they're not necessary in this case (and the debug version weights 15mb). With wxScintilla and wxFlatNotebook is enough for demoing purposes.
Sure no problem, I forgot about their size ... (i uploaded the whole thing from work where I have high upload bandwidth)

Quote
I've tried first to compile in UNICODE mode but I failed, there are errors regarding conversions between char* and wxStrings specially in the ctags_manager.
I didnt try to build it with UNICONDE, since I am not very familiar with it, if you can provide me with guidelies, I will be happy to do it

Quote
I didn't found nothing missing at first glance (except inherited members?)
Thanks for reminded me of that, I knew I forgot something  :lol:
I did prepared the infrastrcutre to support it (look at the database at the table strcuture, you will see there column for it already and it is populated where there is a match), anyway, should be easy to add (just run some more querys on the database)

Quote
As for the WordCompletion, it seems to work ok for the most cases Very Happy, but I get usually 0 matches with local scope variables.
Can you give me a sample source file where it does not work?, the local scope does not support (currently) function arguments

Hovering tips - the library already supports it, its just that the demo does not
show how to use it (check out funtction at Language::ProcessExpression, it does all the work)

Adding combos above the tree view - is easy (unless you meant that you want me to add to the library a control for that,
like i did with symbol_tree):
to fill up the combox values run:
'select * from tags where kind in('class', 'struct', 'union');

for each result you can run (when it is selected from the combobox):

std::vector<TagEntry> tags;
TagsManagerST::Get()->TagsByParent(className, tags);

Parsing comments, well, I think there is a more useful feature before that, that you didnt mention:
symbol browsing from the editor, if you worked with vslick it is Ctrl+. or Ctrl+, in visual studio, right click->Go to definition
very useful feature, and very easy to implement it once you have SQL database of all tags.

Eran
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 29, 2006, 05:26:54 pm
can you post the cb project file please
Of course, will commit when I get the missing files.

Quote
Suggestion: can you remove the wxControls dependency? I know they're nice, but they're not necessary in this case (and the debug version weights 15mb). With wxScintilla and wxFlatNotebook is enough for demoing purposes.
Sure no problem, I forgot about their size ... (i uploaded the whole thing from work where I have high upload bandwidth)
Remember also that the wxFlatNotebook implementation is missing.

I didnt try to build it with UNICONDE, since I am not very familiar with it, if you can provide me with guidelies, I will be happy to do it
It's really easy.

For compiling the wxWidgets library you would normally issue the command mingw32-make -f makefile.gcc
For compiling the UNICODE version just add the parameter UNICODE=1

Example:
Code: bash
set path=C:\MinGW\bin;C:\mingw\mingw32\bin
cd C:\wxWidgets-2.6.3\build\msw
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1

For using it in the makefile, since I noticed you're using my tool, you'll only need to change to the resulting directory
as in WXCFG=gcc_dll\mswud.

For fixing the code reading this article might help: http://wiki.codeblocks.org/index.php?title=Unicode_Standards

I did prepared the infrastrcutre to support it (look at the database at the table strcuture, you will see there column for it already and it is populated where there is a match), anyway, should be easy to add (just run some more querys on the database)
And add a checkbox somewhere to toggle inherited members viewing off, since sometimes is useful to toggle it off.


Quote
As for the WordCompletion, it seems to work ok for the most cases Very Happy, but I get usually 0 matches with local scope variables.
Can you give me a sample source file where it does not work?, the local scope does not support (currently) function arguments
So that was, I was trying function arguments and they didn't worked. But I found other local scope variables that doesn't works.
I'll point later the failing cases (I'm testing it mainly with parsing the C::B SDK).


Adding combos above the tree view - is easy
Oh no, ignore the combos part, I was pointing the tooltips in the tree with comments/documentation being shown.

Parsing comments, well, I think there is a more useful feature before that,
Hehe, it's arguable the usefulness since with tooltips you don't even need to click and open the file (which might be even missing from disk but present in the DB?).

that you didnt mention:

symbol browsing from the editor, if you worked with vslick it is Ctrl+. or Ctrl+, in visual studio, right click->Go to definition
very useful feature, and very easy to implement it once you have SQL database of all tags.
It's really useful but I didn't asked, since I taked it for granted (as current C::B CodeCompletion haves the "Go to definition/declaration" feature). :P

I've sent you a mail with more info. :)
Title: Re: CodeCompletion - what is the status?
Post by: tiwag on August 29, 2006, 05:37:09 pm
can you post the cb project file please
Of course, will commit when I get the missing files.

how did you build it then as you've posted before ?

UPDATE:
I could compile & link CodeLite without errors :D (but with 300 warnings, mostly "defined but not used variables" and "dllimports" warnings).
I could compile & link LiteEditor with all it's dependencies, except wxFlatNotebook, since it's missing the implementation (wxFlatNotebook.cpp), and it appears to be different to the one in SourceForge and the one shipped in C::B.

I've tried first to compile in UNICODE mode but I failed, there are errors regarding conversions between char* and wxStrings specially in the ctags_manager.
In ANSI mode I didn't have to touch any line of code to get it to compile successfully in C::B/GCC .

Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 29, 2006, 05:51:32 pm
how did you build it then as you've posted before ?

As I've said, CodeLite compiles and links succesfully, LiteEditor compiles but not links successfully (because it's missing the implementation of wxFlatNotebook).

Attached are the CBP projects but be warned, you'll have to adjust them accordingly to the dependencies on your system
(or you can wait until I bundle the dependencies - wxsqlite, wxscintilla, etc).

[attachment deleted by admin]
Title: Re: CodeCompletion - what is the status?
Post by: tiwag on August 29, 2006, 06:03:39 pm
Attached are the CBP projects but be warned, you'll have to adjust them accordingly to the dependencies on your system

thx,
can you post the wx-config too ?
seems to be handy
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 29, 2006, 06:16:28 pm
thx,
can you post the wx-config too ?
seems to be handy

Of course, I've put it here in the meantime: http://www.wxwidgets.org/wiki/index.php/Wx-config_Windows_port

Little OT: I'm wanting to add support for it in the wx Wizard, but I haven't found yet squirrel bindings to do it (I haven't found a way to add/remove environment variables, and I don't know if there is a way to communicate with plugins). Plus other things, like I would need to have text-file reading bindings for simple parsing.
Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 29, 2006, 07:14:44 pm
Hi,

I removed the wxStyledNotebook from the code and replaced it with wxFlatNotebook
I also add the implementation of wxFlatNotebook - the updated files of wxFlatNotebook are under CVS in SF (I was too lazy to create new version release), I cant commit my changes for sometime now I am getting error "No route to host" ..

the link to the sources:
www.eistware.com/wxes/codelite/CodeParser.zip (http://www.eistware.com/wxes/codelite/CodeParser.zip)

I also did some minor cosmetics changes to the demo:
put liteeditor.xml file under your working directory (xml file containing colour and other settings for scintilla), it can be found under CodeParser/LiteEditor

Next step, I will try and build the library in UNICODE.
Eran
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 29, 2006, 07:24:42 pm
Hi,

I removed the wxStyledNotebook from the code and replaced it with wxFlatNotebook
I also add the implementation of wxFlatNotebook - the updated files of wxFlatNotebook are under CVS in SF (I was too lazy to create new version release), I cant commit my changes for sometime now I am getting error "No route to host" ..
Yes, SF has been working very bad lately, lot's of Error 500 too.

BTW, have you received my mail?
Title: Re: CodeCompletion - what is the status?
Post by: eranif on August 29, 2006, 07:52:45 pm
Well,

by posting my changes again on the site, u can guess that I did not read you email. That was before your post, I kept checking my messages on the forum until i realized that you sent it for me to my home email.

So, now I am download totroisesvn - never used it before, but I guess that it is similar to tortoisecvs.

Maybe now, I will also download code blocks nightly build ...

Eran
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on August 29, 2006, 08:00:32 pm
So, now I am download totroisesvn - never used it before, but I guess that it is similar to tortoisecvs.
Yes, it's the same, only that better.

Maybe now, I will also download code blocks nightly build ...

You should! Both SVN and C::B are invaluable tools for development. :D

Steps for installing a nightly build:
Download this (http://prdownload.berlios.de/codeblocks/mingwm10.7z), this (http://prdownload.berlios.de/codeblocks/wxmsw26u_gcc_cb_wx2.6.3p2.7z) and this (http://prdownload.berlios.de/codeblocks/CB_20060828_rev2918_win32.7z). Uncompress them in the same folder. That's it.  :D

Title: Re: CodeCompletion - what is the status?
Post by: Alturin on September 02, 2006, 12:04:27 am
Even after this great work on the parser thingy, the following still confused it:

Code
#if defined(NO_INITIAL_ALPHA_PFILEDIRS) || defined(WIN32) 
if(file_exists(PLAYER_DIR "%s.plr", first_name)){
#else
if(file_exists(PLAYER_DIR "%c" DIR_SYM "%s.plr", first_name[0], first_name)){
#endif

After that bit, it won't parse any new functions, and keep thinking it's in the function it's in at that moment.
It'd be like, really cool if this somehow could be fixed, cos it misses out alot of symbols this way.
If you have any questions, or would like to see the whole file or sumthin, give a holla.
Title: Re: CodeCompletion - what is the status?
Post by: eranif on September 02, 2006, 12:49:30 am
Holla !  :D

Can you please copy paste here the file you are trying to parse?

Eran


Title: Re: CodeCompletion - what is the status?
Post by: Alturin on September 02, 2006, 09:59:32 am
Sure thing!
The offending code is around line 150 btw.

[attachment deleted by admin]
Title: Re: CodeCompletion - what is the status?
Post by: eranif on September 02, 2006, 11:01:19 am
Hi,

I loaded the file you sent me as is into the CodeLite demo, and I see nothing wrong ...

To make sure, I compared the resulted tree with MSVC 7.1 tree, attached are the result (MSVC was even fooled by the args(()) definition)  :wink:

(http://eistware.com/wxes/codelite/msvc71_symbol_tree.png)(http://eistware.com/wxes/codelite/codelite_symbol_tree.png)


Please ignore the functions ended with <prototype> I am still working on it ^^

If you want to test it for yourself, and you are working on windows, here is a link to the demo installation:
http://eistware.com/wxes/codelite/LiteEditor_0.1.zip (http://eistware.com/wxes/codelite/LiteEditor_0.1.zip)

If you want to build it by yourself, use SVN to get the latest source files:
https://opensvn.csie.org/CodeLite/ (https://opensvn.csie.org/CodeLite/)

HTH,
Eran

Title: Re: CodeCompletion - what is the status?
Post by: Alturin on September 02, 2006, 11:57:31 am
Aaah, I seem to have mistaken the CC redisign by Mandrav with your work *chuckle*.
I guess I'll post this in the proper thread.
Title: Re: CodeCompletion - what is the status?
Post by: takeshimiya on September 02, 2006, 08:13:45 pm
For anyone wanting to testing this parser library, go to https://opensvn.csie.org/traccgi/CodeLite/wiki

Any help is appreciated. I've included Code::Blocks projects along with all dependencies and projects.  :)
I can compile and link everything fine, the library too. Still can't link the example "LiteEditor", I'm trying to solve it.
Title: Re: CodeCompletion - what is the status?
Post by: eranif on September 03, 2006, 07:16:49 pm
I commited earlier today a version of makefile (not code blocks project) that compiles and links everything successfully using g++ /mingw (it builds the dependencies first sqlite, scintilla) CodeLite library and then LiteEditor program (revision 38)

I tested the unicode debug version build, and it is working perfectly

The only configuration missing is Unicde debug dll/Unicode release dll, but this can wait until the library functionality is closed

Eran




Title: Re: CodeCompletion - what is the status?
Post by: joubertdj on September 04, 2006, 02:33:17 pm
 :P Oh boy... this is cool... thanx Eran. Question... for I am either mis-configuring my CodeCompletion or it is still in development. Is the CodeCompletion for the open files only (The ones in the editor), or do you have to "parse" other header files that you would like to use (Ogre, Allegro, RakNet etc.) into the SQLLite database also?
Title: Re: CodeCompletion - what is the status?
Post by: mandrav on September 04, 2006, 02:53:41 pm
Eran, can you please edit your first post's subject to indicate that what is discussed here is not about the code-completion plugin?
It's starting to get confusing for people...
Title: Re: CodeCompletion - what is the status?
Post by: joubertdj on September 04, 2006, 03:21:35 pm
 :? I think that confused citizen is me... whoops
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on September 04, 2006, 04:40:48 pm
Quote
Eran, can you please edit your first post's subject to indicate that what is discussed here is not about the code-completion plugin?
It's starting to get confusing for people...
Done, I think that the topic title now indicates that this is not the current CodeCompletion plugin
Eran
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: pastbin on September 05, 2006, 05:18:22 pm
Great work Eranif
I compiled everything from the repository today (mingw).
I noticed something for local scope variables. Here is an example:

Code
void f() {
  int aa;    // 1
#define BLAH // 2
  int bb;    // 3
}

Ctrl+space works fine with aa or bb.
Now remove line 1. There is no match for bb.
We have to remove the preprocessor keyword (line 2) if we want bb to be matched again.

It seems there is a little problem with preprocessor instructions.
Not sure if I can track the bug. I'll try to understand your codebase before.

Anyway, keep up the good work!
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on September 05, 2006, 08:09:03 pm
Thanks for letting me know of this bug - I fixed it.

Eran
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: MortenMacFly on September 06, 2006, 10:38:40 am
Well... I again tried to compile this "beast" ;-). Now that there are C::B project files in SVN (r59) I didn't have to adjust a lot (nice work!). Everything compiles nicely but in the end the linkage fails for a reason I don't understand. Here is the linker's output:
Code
mingw32-g++.exe -LD:\Devel\wxWidgets\lib\gcc_dllUnicode -L..\CodeLite\lib -L..\sdk\wxscintilla\lib -L..\sdk\wxsqlite3\lib -L..\sdk\sqlite3\lib -LD:\Devel\GCC345\lib  -o bin\LiteEditor.exe .obj\Release\cpp_symbol_tree.o .obj\Release\editor.o .obj\Release\editor_config.o .obj\Release\frame.o .obj\Release\resources.o .obj\Release\wxFlatNotebook.o .obj\Release\app.o  .obj\Release\code_parser.res  -s -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--add-stdcall-alias  -lcodelite_wxdll -lwxscintilla_wxdll -lwxsqlite3_wxdll -lsqlite3 -lwxmsw26u  -mwindows
..\CodeLite\lib/libcodelite_wxdll.a(symbol_tree.o):symbol_tree.cpp:(.text+0x713d): undefined reference to `_imp__wxEVT_COMMAND_SYMBOL_TREE_ADD_ITEM'
..\CodeLite\lib/libcodelite_wxdll.a(symbol_tree.o):symbol_tree.cpp:(.text+0x7163): undefined reference to `_imp__wxEVT_COMMAND_SYMBOL_TREE_DELETE_ITEM'
..\CodeLite\lib/libcodelite_wxdll.a(symbol_tree.o):symbol_tree.cpp:(.text+0x718f): undefined reference to `_imp__wxEVT_COMMAND_SYMBOL_TREE_UPDATE_ITEM
'
collect2: ld returned 1 exit status
I realised that the missing export is actually declared in parse_thread.h... Any idea what I am missing here?!
With regards, Morten.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on September 06, 2006, 12:05:56 pm
I think tiwag solved that issue - this error is only realted to dll build

Try to build the static build (since I am not using C::B I dont know if there is project for the static build) using the provided makefile.

Eran


Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: takeshimiya on September 06, 2006, 12:14:01 pm
since I am not using C::B I dont know if there is project for the static build
Yes, there is: the project is exactly the same, regardless if it uses wxWidgets in static, shared, monolithic, unicode or whatever configuration. :)
For using the static build, you just need to set the env. var. accordingly, ie. WXCFG=gcc_lib\mswu.

UPDATE: tiwag just added explicit C::B projects for wxWidgets SHARED=1.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: tiwag on September 06, 2006, 01:23:27 pm
Well... I again tried to compile this "beast" ;-). Now that there are C::B project files in SVN (r59) I didn't have to adjust a lot (nice work!). Everything compiles nicely but in the end the linkage fails for a reason I don't understand. Here is the linker's output:
Code
mingw32-g++.exe -LD:\Devel\wxWidgets\lib\gcc_dllUnicode -L..\CodeLite\lib -L..\sdk\wxscintilla\lib -L..\sdk\wxsqlite3\lib -L..\sdk\sqlite3\lib -LD:\Devel\GCC345\lib  -o bin\LiteEditor.exe .obj\Release\cpp_symbol_tree.o .obj\Release\editor.o .obj\Release\editor_config.o .obj\Release\frame.o .obj\Release\resources.o .obj\Release\wxFlatNotebook.o .obj\Release\app.o  .obj\Release\code_parser.res  -s -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--add-stdcall-alias  -lcodelite_wxdll -lwxscintilla_wxdll -lwxsqlite3_wxdll -lsqlite3 -lwxmsw26u  -mwindows
..\CodeLite\lib/libcodelite_wxdll.a(symbol_tree.o):symbol_tree.cpp:(.text+0x713d): undefined reference to `_imp__wxEVT_COMMAND_SYMBOL_TREE_ADD_ITEM'
..\CodeLite\lib/libcodelite_wxdll.a(symbol_tree.o):symbol_tree.cpp:(.text+0x7163): undefined reference to `_imp__wxEVT_COMMAND_SYMBOL_TREE_DELETE_ITEM'
..\CodeLite\lib/libcodelite_wxdll.a(symbol_tree.o):symbol_tree.cpp:(.text+0x718f): undefined reference to `_imp__wxEVT_COMMAND_SYMBOL_TREE_UPDATE_ITEM
'
collect2: ld returned 1 exit status
I realised that the missing export is actually declared in parse_thread.h... Any idea what I am missing here?!
With regards, Morten.

Hi Morten,
the beast is drilled.

needed changes to parse_thread.h

* changes to codelite/parse_thread.h
  added header guard for definition of WXDLLIMPEXP_SYM_TREE
  MACRO USAGE:
  use WXMAKINGDLL_SYM for building codelite regardless if .dll or static library .a
  use WXUSINGDLL_SYM when using codelite as .dll
  use no macro when using codelite as static library .a


update from svn to rev 66

the CB workspace CodeLiteEditor_wxdll.workspace builds fine for me by doing "Build Workspace"
it builds Release and Debug versions of CodeLiteEditor
btw. these projects don't use wx-config, they use the CB global variables instead.

if you want to run it from the LiteEditor\bin directory, you have to copy the files
liteeditor.xml, sqlite3.dll and ctags.exe there too , it runs fine for me using wx263.dll

i would be interested if it builds and runs fine for you too

Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: MortenMacFly on September 06, 2006, 06:31:31 pm
i would be interested if it builds and runs fine for you too
Yes, it does now. Thanks!!!
BTW: I've modified the C::B project files to use wxUnicode - thus, basically change the compiler include, add the _UNICODE and wxUSE_UNICODE defines to the compiler switches and link against wxmsw26*u*. This works very well, too.
Now that I have "my" executable I can start testing... ;-)
With regards, Morten.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: takeshimiya on September 07, 2006, 05:19:05 am
if you want to run it from the LiteEditor\bin directory, you have to copy the files
liteeditor.xml, sqlite3.dll and ctags.exe there too , it runs fine for me using wx263.dll

For the wx-config LiteEditor project I've set post-build steps:
Code
cmd /c copy /y ..\sdk\sqlite3\lib\msw_gcc\sqlite3.dll bin\msw_gcc\
cmd /c copy /y ..\sdk\ctags\bin\msw_gcc\ctags.exe bin\msw_gcc\
cmd /c copy /y liteeditor.xml bin\msw_gcc\

i would be interested if it builds and runs fine for you too

Everything works fine now in all configurations in both projects. :)
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: tiwag on September 07, 2006, 08:03:50 am
Everything works fine now in all configurations in both projects. :)
(http://www.clicksmilies.com/s0105/grinser/grinning-smiley-003.gif)
Title: Re: CodeCompletion - what is the status?
Post by: Blue-Tiger on September 07, 2006, 07:18:11 pm
Hi there!
As C++ supports multiple inheritance it is possible that a class has more than 1 parent. Currently your implementation has a single "parent" column in your database. So if a class has more than superclasses, you'd have to store something like "ParentA, ParentB" in that column, or write 2 entries that only differ by their parent-value. This is usually considered bad database design (If you're interested might want to check out http://en.wikipedia.org/wiki/First_normal_form ), as it makes queries like "find me all the parents of class Foo" a bit akward. I don't know if this is an issue for you or not. Probably the whole thing would work just fine anyways. I just thought I let you know, because it might need a restructuration of your database to fix it. So it should better not be left until the end of the coding ;)


P. S.I didn't like LiteEditor being distributed with an Installer, personally I like simple zip-archives more, because you can usually just delete & forget them once you're done with them ( + installation is much faster). This is just my personal opinion, though. :)
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on October 09, 2006, 10:59:41 pm
Just a quick update on this subject:
the library + a demo for how to use it, is ready with the following features:

With minimum work on the Editor side, the CodeLite library can provide the following:

- Built-in Symbol browser  (automatic update etc)
- Built-in parsing thread
- *very* fast parsing of sources (took me less then 30 secs to parse and build database with the whole gnu include directory, STL included)
- CodeCompletion works with STL, wxWidgets ect (ofcourse bug are there, just waiting to be discovered)
- WordCompletion
- Static database in addition to the workspace database, the static database contains information from unlikely to change headers files (for example, gcc include directory /usr/include, wxWidgets etc)
- Hover tips (assiting tooltips)
- Goto definition/declaration
- Comment parsing and can be displayed in the Hover toolip

Other features can be added on demand, with minimum work.

If any developer would like to create a plugin for C::B, drop me a message

the most updated source file can be retrieved here via SVN:
https://opensvn.csie.org/CodeLite (https://opensvn.csie.org/CodeLite)
Latest revision (at the time of typing this message): 140

With regards,
Eran


Eran
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: tiwag on October 10, 2006, 01:06:30 pm
ctags is obviously not good enough to parse wxwidgets
and gets confused with the heavy usage of macros

when parsing .\CodeLiteEditor\LiteEditor\frame.cpp

it shows WXUNUSED(event) instead of
OnUseExternalDatabase(wxCommandEvent& WXUNUSED(event))

and all eventhandler functions are missing

screenshot
(http://img223.imageshack.us/img223/3590/codelitewxzr6.png)
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: takeshimiya on October 10, 2006, 01:16:06 pm
ctags is obviously not good enough to parse wxwidgets
and gets confused with the heavy usage of macros
Yes I've noticed that about WXUNUSED.
Fortunately ctags haves a switch to specially handle identifiers like that.
See the -I identifier-list option in the manual: http://ctags.sourceforge.net/ctags.html

So we'll only need to have a user-configurable list of troublesome identifiers.
Ideal for libraries which haves heavy macro usage. Modern libraries with little-to-no-macro-usage will not need that.

Little example from the manual:
Code: cpp
CLASS Example
{
    // your content here
};

The example above uses "CLASS" as a preprocessor macro which expands to something different for each platform. For instance CLASS may be defined as "class __declspec(dllexport)" on Win32 platforms and simply "class" on UNIX. Normally, the absence of the C++ keyword "class" would cause the source file to be incorrectly parsed. Correct behavior can be restored by specifying -I CLASS=class.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on October 10, 2006, 02:00:25 pm
ctags is obviously not good enough to parse wxwidgets
and gets confused with the heavy usage of macros

when parsing .\CodeLiteEditor\LiteEditor\frame.cpp

it shows WXUNUSED(event) instead of
OnUseExternalDatabase(wxCommandEvent& WXUNUSED(event))

and all eventhandler functions are missing

they are missing in the GUI tree, but they should appear in the CodeCompletion part, if not then it is a bug inside CodeLite and not within ctags.

I chose not to display the parent(s) functions members only because it adds more complication to the GUI tree, which if a plugin will be implemented, and a requirment will arise, I will add it.

Like Takeshi mentioned, a dialog with a list of pre-processor arguments can be added and be passed to ctags (ctags command line are stored inside a map, and can be changed) to resolve such issues.

Another problem, one can think of, is that in the GNU header files (specially the STL implementation), the vector class is located inside namespace _GNUCXX_STD (or something similar) while map is inside std, so typing std:: (obvioulsly one is a define of the other) will yield a completion box with alot of members but vector is not one of them ...) Takeshis' solutuion will solve this one too.

There are probabaly many other bugs outhere, but I think that it is in a good position that people can work with.

Eran


Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on October 15, 2006, 11:05:13 pm
I cannot compile "Debug wxdll unicode" project under XP CB SVN 3087.

Even though readtags.cpp and readtags.h are checked to be compiled under the ctags target, they are never loaded and compiled. Note that compilation jumps from read.c to rexx.c skipping readtags.cpp

Code
-------------- Build: ctags in Debug wxdll unicode ---------------
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\args.c -o .objs\msw_wxdll_ud\sdk\ctags\args.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\asm.c -o .objs\msw_wxdll_ud\sdk\ctags\asm.o
...<snip>...
-IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\python.c -o .objs\msw_wxdll_ud\sdk\ctags\python.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\read.c -o .objs\msw_wxdll_ud\sdk\ctags\read.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\rexx.c -o .objs\msw_wxdll_ud\sdk\ctags\rexx.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\routines.c -o .objs\msw_wxdll_ud\sdk\ctags\routines.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\ruby.c -o .objs\msw_wxdll_ud\sdk\ctags\ruby.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\scheme.c -o .objs\msw_wxdll_ud\sdk\ctags\scheme.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\sh.c -o .objs\msw_wxdll_ud\sdk\ctags\sh.o
mingw32-gcc.exe -Wall -g -pipe -fmessage-length=0 -mthreads -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE  -I.objs\msw_wxdll_ud\CodeLite -I- -I.objs\msw_wxdll_ud\CodeLite -I. -IC:\Usr\Proj\wxWidgets263\include -IC:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu -Isdk\ctags -IC:\MinGW\include -Isdk\ctags -IC:\Usr\Proj\cbCodeLite\ -c sdk\ctags\slang.c -o .objs\msw_wxdll_ud\sdk\ctags\slang.o
...<snip>...
.objs\msw_wxdll_ud\sdk\ctags\sql.o .objs\msw_wxdll_ud\sdk\ctags\strlist.o .objs\msw_wxdll_ud\sdk\ctags\tcl.o .objs\msw_wxdll_ud\sdk\ctags\verilog.o .objs\msw_wxdll_ud\sdk\ctags\vim.o .objs\msw_wxdll_ud\sdk\ctags\vstring.o .objs\msw_wxdll_ud\sdk\ctags\yacc.o    -lwxmsw26u
mingw32-g++.exe: .objs\msw_wxdll_ud\sdk\ctags\readtags.o: No such file or directory
Process terminated with status 1 (0 minutes, 3 seconds)
0 errors, 0 warnings

(http://img236.imageshack.us/img236/7766/graphic1015200644809pmcu0.png)
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on October 15, 2006, 11:12:45 pm
MM, maybe I am not udnerstanding something here, but:

Why does readtags.cpp/h are under ctags target? they should be under CodeLite.

They are the interface the tags files (although I developed my own API for it, they still there just incase)

Eran

Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on October 15, 2006, 11:43:04 pm
MM, maybe I am not udnerstanding something here, but:

Why does readtags.cpp/h are under ctags target? they should be under CodeLite.

They are the interface the tags files (although I developed my own API for it, they still there just incase)

Eran



You are correct. I unchecked readtags.cpp/h from the ctags target and it compiled and is running just fine.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on October 16, 2006, 12:24:53 am
(http://img181.imageshack.us/img181/9680/graphic1015200662006pmcx9.png)

 The tree label is missing the "wxke"
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on October 16, 2006, 12:41:57 am
For my education:

How is this program any better than the symbol tree and function lister box already included in CB?

Who would use it (as opposed to those already using the current plugin) ?

Does it provide a means for code completion?

(Yes. I've read the whole thread twice, but I'm still wondering if it's worth the time to convert this to a plugin).

Is anyone else working to turn this into a plugin?

Even if it was turned into a plugin, would it ever replace the current tree,function box, code completion?

Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on October 16, 2006, 01:00:36 am
I dont think it will replace to current tree.
The tree is not a must, u can still use the current tree, (unless the current implementation cant be removed from the current CodeCompletion).

How is it better?

Stability - I dont think this will rarely cause C::B to freeze/hangs/crash since it uses well matured product (ctags) to perform its parsing tasks.
Speed - compare parsing of huge files with this implementation and the current one (I havnt got to do it myself, but I got feedback from people)
Comment parsing - I dont think that the current implementation supports comments parsing, this implementation does (and acheived with minimum effort)
Local variable parsing

this implementation is a suggestion, as stated in the topic and not a must, I cant point out who will use it, maybe it will swift the croud and maybe it will not have even a single user, BUT I still think an alternative to the current implementation should exist.

I myself, didnt invest too much time in invistigating the reasons why people are not happy with the current implementation, (half of the solution to C::B hangs/freezs/crushes are caused because of the current CodeCompletion "disable codecompletion").

Eran


Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: tiwag on October 16, 2006, 07:34:35 am
MM, maybe I am not udnerstanding something here, but:
Why does readtags.cpp/h are under ctags target? they should be under CodeLite.
They are the interface the tags files (although I developed my own API for it, they still there just incase)
Eran

You are correct. I unchecked readtags.cpp/h from the ctags target and it compiled and is running just fine.

the problem is, that the source file, which belongs to ctags target, is named readtags.c  (instead of cpp)
i don't understand why it built without errors in the past  :shock: (can't find anything related to this in the svn log)
after changing the filename in the projectfile it builds fine again.

sorry for the inconvenience, fixed in svn rev142

brgds, tiwag
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: joubertdj on November 04, 2006, 12:04:24 am
Are you guys busy with a plugin to get ctags & sqlite up and running in code::blocks?
If so do you perhaps have a Nightly which I can test?
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: tiwag on November 04, 2006, 12:31:13 am
Are you guys busy with a plugin to get ctags & sqlite up and running in code::blocks?
If so do you perhaps have a Nightly which I can test?

you can checkout and test what's available so far ...

svn repository
https://opensvn.csie.org/CodeLite


there is no intent to use it in CB, as long ctags isn't able to parse C++ code correctly,
although eranif said, that it would be possible somehow...
brgds,
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on November 04, 2006, 12:48:40 am
Quote from: tiwag
as long ctags isn't able to parse C++ code correctly
Please dont spread wrong information, ctags is pretty much capabale of parsing C++. The fact that a single define was inserted into a function list (and can be easily fixed, using list of ignored marcros, as Takeshi suggested), does not mean it cant parse C++.

ctags purpose's is not to be a replacement for the compiler but as an assitant for code writing, so it can miss a complex expression here and there nothing wrong with that -
I didnt see that the current implementation is prefect, and still you are not going around and spreading that it cant parse C++...

-Eran
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: joubertdj on November 04, 2006, 12:50:31 am
I played around with Eclipse's CDT... not bad... the only thing I like more in Eclipse is its Indexing (Code Completion & Symbol Browser)... for the rest I will be sticking to Code::Blocks thank you very much!
(Although it is done in Java  :x ) Is it possible to glimpse how they implement the parsing (How they get all the info) ?

BTW ... Thanks

Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: joubertdj on November 04, 2006, 12:58:18 am
Uh... well... I actually thought it did more than the current code completion plugin and thought somebody will be working on it... no need to flame one another  :? But you can always continue... (Just let us know where you stay, we will bring beer and snax, and you guys can have at one another) and it will not help the code completion  :lol:
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: tiwag on November 04, 2006, 01:29:27 am
Quote from: tiwag
as long ctags isn't able to parse C++ code correctly
Please dont spread wrong information..

i do not spread wrong information,

the actual implementation of CodeLite and CodeLiteEditor as it is in svn repository
is unusable, because most the functions of wxWidgets code samples are simply missing in the browser,
because, as you told me, ctags is confused about the lots of macros used in wxWidgets ...

you said to know how to solve this issue, so please do it (if it is so simple, which i don't believe ...)

brgds,
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Alturin on November 07, 2006, 12:02:51 am
Quote from: tiwag
as long ctags isn't able to parse C++ code correctly
Please dont spread wrong information..

i do not spread wrong information,

the actual implementation of CodeLite and CodeLiteEditor as it is in svn repository
is unusable, because most the functions of wxWidgets code samples are simply missing in the browser,
because, as you told me, ctags is confused about the lots of macros used in wxWidgets ...

you said to know how to solve this issue, so please do it (if it is so simple, which i don't believe ...)

brgds,

Is that only true for wxWidgets projects, or will it just not compile/run as Code::Blocks plugin due to that?
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Szabadember on November 24, 2006, 07:16:04 pm
Project Suspended?
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: takeshimiya on November 24, 2006, 07:28:02 pm
Project Suspended?
No, I had a cb plugin in the works, the symbols tree is already integrated and working, I need to finish the integration with cbEditor, and decide a strategy to where to save the different dbs.
Now I'm working on another projects but I'll retake this when I finish them.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: joubertdj on January 09, 2007, 12:32:43 pm
@takeshi: would you mind sending me the plugin that you started with ctags? I will start play with that and see what I can do about it!

@Eranif: Shall we tackle this plugin together?
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Szabadember on March 01, 2007, 08:28:05 pm
Status?  :o
Last post is almost  months old.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Kreso on March 15, 2007, 09:53:08 pm
c'mon guys, you're almost there :) don't give up now;
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on March 15, 2007, 10:37:14 pm
Quote
c'mon guys, you're almost there Smile don't give up now;
I never gave up, so I wrote the library - CodeLite, however, I am not familiar nor have the time to learn C::B code structure and internals to create a plugin.

If anyone here is willing to create a plugin using CodeLite - I will be happy to fix any bug/request for this library (assuming it is not complicated :))

Eran
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: mitsukai on May 10, 2007, 10:07:47 pm
this looks very nice.
in time it will be a very good code completion plugin..

as for the "heavy macros";
parse all macros to a database, then when parsing a line, "dereference" the macros  till there are no macro references left.

for example.

Code
1. //used in GCC i thought
2. #define DLL_EXPORT _attribute_((export))
3. #define CLASS class DLL_EXPORT
4. CLASS someclass
5. {
6. /* some stuff */
7. };

1. { we are parsing line 4 {
2. find CLASS in macro db
3. found CLASS, {replace
4. class is not a macro
5. found DLL_EXPORT, {replace
6. _attribute_ and export are not macros } }
7. someclass is not a macro }
8. start parsing definitions, declarations etc.
line that it is parsing is 'class _attribute_((export)) someclass'}

this could fix the "heavy macro"  "bug"... just an idea :)

thought it has performance impact... but at least its correct
if you manage the database well, like ordering entries by name u can make a very fast algorithm to search for definitions and declarations.
and if u make it so it only parses on a new project and if u edit a line performance impact should not be noticable when programming (unlike intellisense, blegh)
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on June 10, 2007, 04:33:05 pm
@Eranif

In the buildinfo.txt for MSW there is an .cbp for sqlite3 and wxsqlite3.

The project for sqlite3 does not compile because there are no source files for it downloaded by SVN(url="http://svn.berlios.de/svnroot/repos/codelite/trunk")

What is the difference, and which project is correct?

Code
Code::Blocks (CB) workspace and project files are supplied

! two build methods are supplied !

1. CodeLite.workspace
    contains the CB-projects
    * sdk\wxconfig\wx-config-win.cbp
    * sdk\ctags\build\ctags.cbp
    * sdk\sqlite3\build\sqlite3.cbp
    * sdk\wxsqlite3\build\wxsqlite3_wxsqlite3.cbp
    * CodeLite\CodeLite.cbp
    * sdk\wxscintilla\build\wxscintilla.cbp
    * LiteEditor\LiteEditor.cbp


Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on June 10, 2007, 04:47:45 pm
@Eranif

Using MSW \trunk\CodeLite\CodeLite.cbp, precompiled_header.h has the following:

Quote
#ifdef __WXMSW__
   #ifdef _DEBUG
      #include <crtdbg.h>
      #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__)
   #else
      #define DEBUG_NEW new
   #endif
#endif

However I cannot find on my xpSp2 wxWidgets2.8.4 system a file named "crtdbg.h"

Was this supposed to be in the svn, or on my system somewhere.
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on June 10, 2007, 05:59:46 pm
@Eranif

Using: XpSp2 wxWidgets-2.8.4 unicode

The MSW LiteEditor.cbp gets the following errors:
Quote
-------------- Build: Debug in LiteEditor ---------------
WARNING: Can't read file's timestamp: C:\Usr\Proj\CodeLite\trunk\LiteEditor\editor_config.cpp
WARNING: Can't read file's timestamp: C:\Usr\Proj\CodeLite\trunk\LiteEditor\styled_notebook.cpp
WARNING: Can't read file's timestamp: C:\Usr\Proj\CodeLite\trunk\LiteEditor\wxFlatNotebook.cpp
mingw32-g++.exe -L..\CodeLite\lib\msw_gcc -L..\sdk\wxscintilla\lib\msw_gcc -L..\sdk\wxsqlite3\lib\msw_gcc -L..\sdk\sqlite3\lib\msw_gcc -LC:\MinGW\lib  -o bin\msw_gcc\LiteEditord.exe obj\msw_gcc\Debug\app.o obj\msw_gcc\Debug\cpp_symbol_tree.o obj\msw_gcc\Debug\editor.o obj\msw_gcc\Debug\editor_config.o obj\msw_gcc\Debug\frame.o obj\msw_gcc\Debug\resources.o obj\msw_gcc\Debug\styled_notebook.o obj\msw_gcc\Debug\wxFlatNotebook.o  obj\msw_gcc\Debug\code_parser.res  -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--add-stdcall-alias -lcodelited -lwxscintillad -lwxsqlite3d -lsqlite3   
mingw32-g++.exe: obj\msw_gcc\Debug\editor_config.o: No such file or directory
mingw32-g++.exe: obj\msw_gcc\Debug\styled_notebook.o: No such file or directory
mingw32-g++.exe: obj\msw_gcc\Debug\wxFlatNotebook.o: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings


Two of the files, editor_config.cpp and wxFlatNoteBook.cpp can be found in other svn directories. Are they the source files that LiteEditor is trying to compile?

However, "styled_notebook" is nowhere to be found within the svn structure. Where may I find this file.

Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on June 10, 2007, 06:50:06 pm
Hi Pecan,

The repository under opensvn.csie.org/CodeLite was abandoned ( I need to remove it )

I have moved all the files project to Berlios, but as part of a new project - LiteEditor, CodeLite has evolved to become a full IDE and CodeLite is only small part of it, the new repository as located at:

svn checkout http://svn.berlios.de/svnroot/repos/codelite/trunk

The C::B workspace & project are no longer updated nor maintained.
You can use the provided makefiles to built it.
If you are on linux, you can use the following command:

make -f makefile.linux type=release_unicode clean
make -f makefile.linux type=release_unicode

from the trunk directory.

Regards,
Eran
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: Pecan on June 10, 2007, 07:35:39 pm

svn checkout http://svn.berlios.de/svnroot/repos/codelite/trunk

Yes, It's the Berlios svn that I did a checkout on

The C::B workspace & project are no longer updated nor maintained.
You can use the provided makefiles to built it.
If you are on linux, you can use the following command:

make -f makefile.linux type=release_unicode clean
make -f makefile.linux type=release_unicode

from the trunk directory.


Does this mean that CodeLite will nolonger compile/run on Windows?

Or does it mean that a C::B workspace needs to be created from the makefiles?

I see there is a plugin directory. Is that for a C::B plugin?
Title: Re: Suggestion: Using ctags & sqlite for code completion
Post by: eranif on June 10, 2007, 08:31:16 pm
Quote
Does this mean that CodeLite will nolonger compile/run on Windows?
It does compile on Windows, however, I am using Visual Studio on Windows (the solution file is CodeLite.sln)

Quote
Or does it mean that a C::B workspace needs to be created from the makefiles?
Yes

Quote
I see there is a plugin directory. Is that for a C::B plugin?
No. As I mentioned before, I am creating my own IDE based on CodeLite, the plugin directory is for this purpose.

I know Takeshi Miya started working on a pluing for Code::Blocks based on CodeLite but, IIRC, he was banned from Code::Block forum, or at least he felt unwanted.

Eran