Author Topic: Suggestion: Using ctags & sqlite for code completion  (Read 85195 times)

takeshimiya

  • Guest
Re: CodeCompletion - what is the status?
« Reply #15 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


"Hovering tooltips"


And for the Tree view


Honestly these are the only things I still miss from the days of Visual Studio + Visual Assist X.
« Last Edit: August 29, 2006, 03:29:57 pm by Takeshi Miya »

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: CodeCompletion - what is the status?
« Reply #16 on: August 29, 2006, 03:59:03 pm »
can you post the cb project file please

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: CodeCompletion - what is the status?
« Reply #17 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

takeshimiya

  • Guest
Re: CodeCompletion - what is the status?
« Reply #18 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. :)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: CodeCompletion - what is the status?
« Reply #19 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 .


takeshimiya

  • Guest
Re: CodeCompletion - what is the status?
« Reply #20 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]

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: CodeCompletion - what is the status?
« Reply #21 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

takeshimiya

  • Guest
Re: CodeCompletion - what is the status?
« Reply #22 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.
« Last Edit: August 29, 2006, 06:18:15 pm by Takeshi Miya »

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: CodeCompletion - what is the status?
« Reply #23 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

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

takeshimiya

  • Guest
Re: CodeCompletion - what is the status?
« Reply #24 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?

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: CodeCompletion - what is the status?
« Reply #25 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

takeshimiya

  • Guest
Re: CodeCompletion - what is the status?
« Reply #26 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, this and this. Uncompress them in the same folder. That's it.  :D


Alturin

  • Guest
Re: CodeCompletion - what is the status?
« Reply #27 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.

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: CodeCompletion - what is the status?
« Reply #28 on: September 02, 2006, 12:49:30 am »
Holla !  :D

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

Eran



Alturin

  • Guest
Re: CodeCompletion - what is the status?
« Reply #29 on: September 02, 2006, 09:59:32 am »
Sure thing!
The offending code is around line 150 btw.

[attachment deleted by admin]