How to update the code completion database?

General questions regarding the usage of CodeLite
Satervalley
CodeLite Curious
Posts: 3
Joined: Tue Mar 18, 2008 7:32 pm
Contact:

How to update the code completion database?

Post by Satervalley »

Hi, I noticed that CL shipped with a code completion database which includes the preparsed wxWidgets 2.8.7 code completion information, and it's assume that the wxWidgets path is C:\\..., these are not the facts of my system since I use wxwdigets 2.8.9 and it's on Logical disk E. I wonder if CL can parse the source code on my system and refresh the code completion database.
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to update the code completion database?

Post by eranif »

You can do this in 3 ways:

1) create your own version of tags database:
- tags -> close external database
- tags -> create external database
Follow the wizard instructions (very simple)

2) quicker option to add tags:
- tags -> close external database
- switch to the 'explorer' tab in the workspace view and locate the directory E:\wxWidgets (or wherever you installed it), right click and select 'Add Tags...'

3)
Since most of the files/API are in fact the same, you can only update the paths:
- tags -> fix external database...
- select the tags file (usually it is common.tags)
- you will get a table with 'value' and 'name', update the value to the correct path on your machine

If you choose option 1 or 2, you will probably want to specify different name to your exteranl database name otherwise, the new tags will be added to the existing one

Also:

If you choose option 1 or 2, you will probably want to get STL completion as well:
Parse the '/path/to/mingw/include/c++' directory


Eran
Make sure you have read the HOW TO POST thread
denk_mal
CodeLite Enthusiast
Posts: 16
Joined: Mon Oct 13, 2008 6:20 pm
Contact:

Re: How to update the code completion database?

Post by denk_mal »

Is it necessary to retag the project?
(done by the context menu on the workspace IIRC)
or would this be done automatically ?

denk_mal
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to update the code completion database?

Post by eranif »

denk_mal wrote:Is it necessary to retag the project?
(done by the context menu on the workspace IIRC)
or would this be done automatically ?
CodeLite manages 2 databases.

The first database, also knows as "external database" is created once and codelite does not update it automatically at all. Its all purpose is to hold symbols from external libraries which are unlikely to be modified by the user (e.g. wxWidgets, /usr/include, Qt etc.)

The second database is updated automatically whenever you:
- add file
- remove fie
- save file
- add project
- remove project
- etc.

This database holds the symbols from the workspace files.
Usually, you dont need to retag it, unless you edited it outside of CodeLite, updated it from SVN etc.
I provided 3 levels of tagging the file:
- retag project (project context menu)
- retag workspace (workspace context menu & workspace main menu)
- retag file (available from editor's context menu, or Ctrl-Shift-G)
these methods are used when you think that codelite does not find a symbol that you know it is there, and used to work - its like a "reset" button.

You can read more here:
http://codelite.org/LiteEditor/CodeCompletion

Eran
Make sure you have read the HOW TO POST thread
asterisc
CodeLite Enthusiast
Posts: 12
Joined: Sat Dec 20, 2008 3:01 am
Contact:

Re: How to update the code completion database?

Post by asterisc »

Adding an "Additional Search Path" to the Project->Settings shouldn't tag these directories as well? (Maybe as a third level tag database).
dovoto
CodeLite Curious
Posts: 5
Joined: Sat Dec 20, 2008 8:04 am
Contact:

Re: How to update the code completion database?

Post by dovoto »

eranif wrote: CodeLite manages 2 databases.
...

The second database is updated automatically whenever you:
- add file
- remove fie
- save file
- add project
- remove project
- etc.

...
Eran
It's possible I am misreading but this seems to imply if I save a file it will be retagged.

For instance, if I create a new function in a C/C++ file and then save the file (ctrl-s) it should add this new symbol to the dynamic database after which I can should get the function hint when i type the opening "(".

While not ideal this approach would definitely be usable (ideal being the editor evaluating and populating the dynamic symbol table in real time and magically knowing if any referenced header has changed as well...obviously not a goal to be sought lightly as there are several performance issues I am certain you have already weighed) .

However, and finally to my point, saving does not seem to provide this symbol reevaluation. Only after I follow a save by a ctrl-shift-g does it retag and give me the expected results. Is this the expected behavior?

Codelite already appears to populate the code completion symbol table dynamically (ie while typing in semi-real time) as i have cntr-space access to symbols immediately after defining them. However, no context is provided until the code is retagged (context being struct/class member hints and function parameter hints). Is this an accurate depiction of the state of code parsing for auto complete? Does it automatically build a database from specified default include paths?

As an aside, my interest in the IDE is for embedded systems where i am often working back and forth between library development and application development and the thought of rebuilding a database each iteration is somewhat...well not so appealing.
sdolim
CodeLite Veteran
Posts: 69
Joined: Fri Oct 24, 2008 10:29 pm
Contact:

Re: How to update the code completion database?

Post by sdolim »

Hi dovoto,
dovoto wrote:It's possible I am misreading but this seems to imply if I save a file it will be retagged.
Yes, that is what happens. But (and it wasn't clear from your post if you are doing this) the file must be part of a CodeLite workspace and project, or it won't.
Codelite already appears to populate the code completion symbol table dynamically (ie while typing in semi-real time) as i have cntr-space access to symbols immediately after defining them.
Almost. What really happens here is that when you type, e.g. '.' or '->', CodeLite parses the preceding region of code to figure out the type of the expression to the left of the operator. If that type is already in the database, then you get code-completion for it, otherwise not. But new types aren't added to the database unless you save the file.
As an aside, my interest in the IDE is for embedded systems where i am often working back and forth between library development and application development and the thought of rebuilding a database each iteration is somewhat...well not so appealing.
If you're meaning the database of external libs that you're using, check out the tags database manager under the Tags menu. If instead you mean the database of your own code symbols, then the way CodeLite works best is for you to have one or more workspaces containing the various projects (i.e. build targets) that you are developing. Each workspace has it's own persistent database of symbols, which is updated as you save files, add files, add projects, etc.

Scott
dovoto
CodeLite Curious
Posts: 5
Joined: Sat Dec 20, 2008 8:04 am
Contact:

Re: How to update the code completion database?

Post by dovoto »

sdolim wrote:Hi dovoto,
dovoto wrote:It's possible I am misreading but this seems to imply if I save a file it will be retagged.
Yes, that is what happens. But (and it wasn't clear from your post if you are doing this) the file must be part of a CodeLite workspace and project, or it won't.
This was likely my issue, the workspace paradigm is a bit confusing at first, when I was testing I had not quite gotten it. Thank you and I will test to be certain when I am next at my PC.
sdolim wrote:
dovoto wrote:As an aside, my interest in the IDE is for embedded systems where i am often working back and forth between library development and application development and the thought of rebuilding a database each iteration is somewhat...well not so appealing.
If you're meaning the database of external libs that you're using, check out the tags database manager under the Tags menu. If instead you mean the database of your own code symbols, then the way CodeLite works best is for you to have one or more workspaces containing the various projects (i.e. build targets) that you are developing. Each workspace has it's own persistent database of symbols, which is updated as you save files, add files, add projects, etc.

Scott
Sorry, i simply meant I do a lot of work on library development AND on application development which use and test these libraries (and i do this concurrently). I will take a look at workspace options available to give me something more akin to the real time responsiveness I am used to. I imagine if i put everything in the same workspace I will get nearly what I desire.

Your product looks very promising and I appreciate your quick and helpful feedback.
Post Reply