-
Notifications
You must be signed in to change notification settings - Fork 35
Guanako
Dominique Lasserre edited this page Sep 2, 2013
·
1 revision
Guanako's central class is Guanako.project, which provides completion proposals based on included files and packages.
Initiate Guanako:
- Create your instance of
Guanako.Project
. - Add all source files to the project (using
add_source_file_by_name (..)
). - Add all required Vala packages (using
add_packages (..)
). - Call update to initially build completion information.
Then, you can retrieve your completion proposals (using propose_symbols (..)
).
Every time the user changes the file, call update_file (..)
and pass the new content so Guanako stays up to date.
- Adds source_file to the project. You have to call
update()
yourself afterwards.
void add_source_file_by_name (string filename)
- Removes an included SourceFile from the project, then updates Guanako.
void remove_file (SourceFile file)
- Returns all currently included source files.
SourceFile[] get_source_files()
- Adds all Vala packages in
package_names
as references to the project. Return missing packages. Ifauto_update
istrue
update Guanako.
string[] add_packages (string[] package_names, bool auto_update)
- Removes the Vala package
package_name
from the project's references.
void remove_package (string package_name)
- Updates completion info of the entire project; where possible, use the faster
update_file (..)
method.
void update()
- Returns completion proposals for a given position inside the code as a HashSet of Vala.Symbol's. The position is specified by file (the current source file), line and col (cursor position inside the file by line and column).
Gee.HashSet<Symbol>? propose_symbols (SourceFile file, int line, int col, string written)
- Returns symbols accessible from a given position in the code.
Symbol[] get_accessible_symbols (SourceFile file, int line, int col)
- Returns the symbol found at a given position in the code.
Symbol? get_symbol_at_pos (SourceFile source_file, int line, int col)
- Helper function that returns all packages the given packages depend on.
string[] get_package_dependencies (string[] package_names)
- If a file has been changed, call this function to update completion info of a given source file. Pass the file's altered content as new_content.
void update_file (Vala.SourceFile file, string? new_content = null)
To install Guanako without Valama you only need guanako/
subdirectory and place cmake/
directory right into it (and you can use fancy git sparsecheckout (requires git >= 1.7.0)):
git clone git://github.com/Valama/valama.git
cd valama
git config core.sparsecheckout true # only required for sparsecheckout
echo cmake >> .git/info/sparse-checkout # only required for sparsecheckout
echo guanako >> .git/info/sparse-checkout # only required for sparsecheckout
cd guanako
ln -s ../cmake cmake
echo guanako/cmake >> ../.git/info/exclude
mkdir build
cd build
cmake ..
make -j2
Then install it with root permissions:
make install
- cmake (>= 2.8.5)
- valac (>= 0.17)
- pkg-config
- gobject-2.0
- glib-2.0
- gee-0.8
- libvala-0.22 (recommended) or libvala-0.20 or libvala-0.18
- gtk+-3.0