how to enable code auto-complete feature ?

General questions regarding the usage of CodeLite
varnie
CodeLite Veteran
Posts: 64
Joined: Wed Jun 11, 2008 3:48 am
Contact:

how to enable code auto-complete feature ?

Post by varnie » Wed Jun 11, 2008 3:53 am

hell-o!

i've just installed CodeLite (codelite-r1599_1 version, to be exactly) on my FreeBSD 7.0 for my personal C++ programming tasks and i am wondering how to enable "code auto-complete feature"? i've found out i have to select some external database with "tags" set but i couldn't find any.

could you please point me out what i have to do to enable this? thanks in advance!

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

Re: how to enable code auto-complete feature ?

Post by eranif » Wed Jun 11, 2008 5:40 am

Hi,

CodeLite CodeCompletion (CC for short) uses tags database for auto-complete.
There are acutally 2 of them:
- the workspace DB
- the external DB

First of all, you will need to have a workspace open in order to have CC enabled. You can't just open a C++ file and expect it to work.
Once you have a workspace opened with some projects / files in it, CodeLite will automatically create the workspace database which contains all the symbols of all the workspace's files.

The second database (AKA the 'External Database') has to be created by the user. The external database, contains the symbols which are unlikely to be modified (for example, symbols from stdio.h). On platforms which I package (unlike BSD which is done by Pietro) I also provide an external database which contains symbols from /usr/include/c++, and wxWidgets.

To create one, is fairly easy:
From the menu bar, select: 'Tags -> Create External database...'
A wizard dialog starts, which asks you the root path of your include files, select /usr/include/c++/4.1/bits (or the equivalent path on FreeBSD) and click 'Next'
In the next page, check the directories you want CodeLite to scan, and click Next, at the last page, give the database a name and select 'Finish'.
At this point CodeLite will parse all the files it found at the directories you selected and will store them into a database, once completed the database will be attached to CodeLite and will be used from hereon, unless detached explicitly.
If you whish to another symbols from different path, simply run the wizard again, select the new path (e.g. /usr/include/sys) check the directories you want, and last, but most important, select the same database name as before (it will be suggested by CodeLite), this will make sure that the new symbols are appended to the previous ones.

this is in general all you need to know for how to create external tags database.

Other things you need to remember:
CC can be triggered in several cases:
- User typed ClassName followed by '::'
- You typed partial word, followed by Ctrl+SPACE
- you typed '.', '->' on an identifier (for example: std::string *s; s->)

But, as I mentioned before, you *must* have a workspace open.
The files which are under the workspace and being tagged automatically once saved, so you dont need to re-tag them.

At the status bar, CodeLite displays the name of the tags databases which it uses (usually there are 2, the workspace & the external)

Hope it clears it,
Eran
Make sure you have read the HOW TO POST thread

varnie
CodeLite Veteran
Posts: 64
Joined: Wed Jun 11, 2008 3:48 am
Contact:

Re: how to enable code auto-complete feature ?

Post by varnie » Wed Jun 11, 2008 4:58 pm

eranif, many thanks for reply. now i figured out and it works well.
but nevertheless i have several features which cause problems:
1 problem:
suppose i have:

Code: Select all

class Foo{
public:
   void bar(){};
};
then when i type below in my code "Foo foo; f." CodeLite doesn't show me tooltips with all available methods of class Foo. i want CodeBlocks "recognize" method bar() and show me its name within a tooltip. how to make this work?

2 problem: suppose i have created workplace with project in it. thereafter i create two configurations: Debug and Release. okey... then in "workspace" folder i choose my current project, change its configuration to Release and press "F7". and it builds my project using "Debug" settings not the "Release" ones.
Building: "/usr/local/bin/gmake" -j 2 -f "work_wsp.mk" type=Release
----------Building project:[ testing - Debug ]----------
g++ -o ./Debug/testing ./Debug/testing.o
----------Build Ended----------
where testing is a name of my project. i don't understand why CodeLite invokes "g++ -o /Debug/testing ./Debug/testing.o" instead if "g++ -o /Release/testing ./Release/testing.o" ?

thanks for help.

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

Re: how to enable code auto-complete feature ?

Post by eranif » Wed Jun 11, 2008 5:13 pm

varnie wrote:i want CodeBlocks
Well, then you come to the wrong place ;)
varnie wrote: then when i type below in my code "Foo foo; f." CodeLite doesn't show me tooltips with all available methods of class Foo. i want CodeBlocks "recognize" method bar() and show me its name within a tooltip. how to make this work?
Two things to check:

Save the file - CodeLite parse the file only when it is saved.

Is the file is part of the workspace? (i.e. can you do this: Ctrl+Shift+R and then type the file name and CodeLite will find it?)
varnie wrote: 2 problem: suppose i have created workplace with project in it. thereafter i create two configurations: Debug and Release. okey... then in "workspace" folder i choose my current project, change its configuration to Release and press "F7". and it builds my project using "Debug" settings not the "Release" ones.
The problem is that the Project's 'Release' is not associated with the workspace 'Release' target.
To fix this:
'Build -> Configuration Manager...'

You will get the build matrix for your workspace. Select the workspace 'Release' configuration, if there is no such cofiguration, create it.
And now, select the project's configuration that you want to be associated with the Workspace's 'Release' configuration.

Eran
Make sure you have read the HOW TO POST thread

varnie
CodeLite Veteran
Posts: 64
Joined: Wed Jun 11, 2008 3:48 am
Contact:

Re: how to enable code auto-complete feature ?

Post by varnie » Wed Jun 11, 2008 8:11 pm

good day!
eranif wrote: Save the file - CodeLite parse the file only when it is saved.
wow! after i've saved my files, CodeLite begins to recognize my classes' member functions! thanks for idea!
eranif wrote: Is the file is part of the workspace? (i.e. can you do this: Ctrl+Shift+R and then type the file name and CodeLite will find it?)
yes, it is.
eranif wrote: The problem is that the Project's 'Release' is not associated with the workspace 'Release' target.
To fix this:
'Build -> Configuration Manager...' <skipped>
thanks for information, now it works!

i appreciate your efforts!

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

Re: how to enable code auto-complete feature ?

Post by eranif » Wed Jun 11, 2008 9:49 pm

eranif wrote:thanks for information, now it works!
Great to hear it!
eranif wrote:i appreciate your efforts!
Anytime.

Eran
Make sure you have read the HOW TO POST thread

varnie
CodeLite Veteran
Posts: 64
Joined: Wed Jun 11, 2008 3:48 am
Contact:

Re: how to enable code auto-complete feature ?

Post by varnie » Wed Jun 11, 2008 10:16 pm

few unrelated questions:
1. how to delete some projects presented in "workspace" area?
suppose, i have several useless projects in "workspace" area. how to completely remove them from this workspace and physically from hard drive? thanks for help.
2. in "Build"-->"Build settings"-->Build Systems-->Build tool i've set up using "/usr/local/bin/gmake" instead of "/usr/bin/make" and clicked "okay" button. trouble is that when i'm running CodeLite another time this setting seems to be returned back to "/usr/bin/make" and i have to set it up again and again. have no idea how to fix that.
Last edited by varnie on Wed Jun 11, 2008 10:28 pm, edited 1 time in total.

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

Re: how to enable code auto-complete feature ?

Post by eranif » Wed Jun 11, 2008 10:28 pm

varnie wrote:one more question -- how to delete some projects presented in "workspace" area?
suppose, i have several useless projects in "workspace" area. how to completely remove them from this workspace and physically from hard drive? thanks for help.
CodeLite does not do massive delete from disk - too risky.

It only remove disconnect the project and it associated files from the workspace (and remove their symbols from the tags database), so Right Click on a project and selecting "Remove Project" will only disconnect it from the workspace.

Eran
Make sure you have read the HOW TO POST thread

varnie
CodeLite Veteran
Posts: 64
Joined: Wed Jun 11, 2008 3:48 am
Contact:

Re: how to enable code auto-complete feature ?

Post by varnie » Thu Jun 12, 2008 1:27 pm

thank you, eranif.
and what about this problem:
in "Build"-->"Build settings"-->Build Systems-->Build tool i've set up using "/usr/local/bin/gmake" instead of "/usr/bin/make" and clicked "okay" button. trouble is that when i'm running CodeLite another time this setting seems to be returned back to "/usr/bin/make" and i have to set it back again and again. have no idea how to fix that.

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

Re: how to enable code auto-complete feature ?

Post by eranif » Thu Jun 12, 2008 1:43 pm

Hi,

After you close CodeLite, please open the file under ~/.codelite/config/build_settings.xml with vi, vim or whatever

Search for the entry: <BuildSystem Name="GNU makefile for g++/gcc" ToolPath="C:/MinGW/bin/mingw32-make.EXE" Options="-f" Jobs="2"/>
What is the value that you have there?

If this is the correct value that you are expecting, (i.e. /usr/local/bin/gmake), then the problems lies in the startup procedure (there is a method that supposed to fix invalid tools paths).
For some reason CodeLite thinks that /usr/local/bin/gmake does not exist
this how I test it:
I simply run '

Code: Select all

which /usr/local/bin/gmake
' and examine the output

Can you post here the output of the above command?

Eran
Make sure you have read the HOW TO POST thread

Post Reply