Commit 619b3dba authored by Christian Hergert's avatar Christian Hergert
Browse files

libide: make a few classes bind better into vala vapi

parent 7efd3daa
......@@ -96,12 +96,6 @@ void _ide_source_view_set_count (IdeSourceView
guint count);
void _ide_source_view_set_modifier (IdeSourceView *self,
gunichar modifier);
IdeSymbol *_ide_symbol_new (const gchar *name,
IdeSymbolKind kind,
IdeSymbolFlags flags,
IdeSourceLocation *declaration_location,
IdeSourceLocation *definition_location,
IdeSourceLocation *canonical_location);
void _ide_thread_pool_init (void);
IdeUnsavedFile *_ide_unsaved_file_new (GFile *file,
GBytes *content,
......
......@@ -177,6 +177,13 @@ ide_symbol_node_get_kind (IdeSymbolNode *self)
return priv->kind;
}
/**
* ide_symbol_node_get_location:
*
* Gets the location for the symbol node.
*
* Returns: (transfer full) (nullable): An #IdeSourceLocation or %NULL.
*/
IdeSourceLocation *
ide_symbol_node_get_location (IdeSymbolNode *self)
{
......
......@@ -83,6 +83,16 @@ ide_symbol_resolver_lookup_symbol_finish (IdeSymbolResolver *self,
return IDE_SYMBOL_RESOLVER_GET_IFACE (self)->lookup_symbol_finish (self, result, error);
}
/**
* ide_symbol_resolver_get_symbol_tree_async:
* @self: An #IdeSymbolResolver
* @file: A #GFile
* @cancellable: (allow-none): a #GCancellable or %NULL.
* @callback: (allow-none): a callback to execute upon completion
* @user_data: user data for @callback
*
* Asynchronously fetch an up to date symbol tree for @file.
*/
void
ide_symbol_resolver_get_symbol_tree_async (IdeSymbolResolver *self,
GFile *file,
......@@ -101,7 +111,7 @@ ide_symbol_resolver_get_symbol_tree_async (IdeSymbolResolver *self,
*
* Completes an asynchronous request to get the symbol tree for the requested file.
*
* Returns: (transfer full): An #IdeSymbolTree; otherwise %NULL and @error is set.
* Returns: (nullable) (transfer full): An #IdeSymbolTree; otherwise %NULL and @error is set.
*/
IdeSymbolTree *
ide_symbol_resolver_get_symbol_tree_finish (IdeSymbolResolver *self,
......
......@@ -32,6 +32,8 @@ struct _IdeSymbolResolverInterface
{
GTypeInterface parent_interface;
void (*set_context) (IdeSymbolResolver *self,
IdeContext *context);
void (*lookup_symbol_async) (IdeSymbolResolver *self,
IdeSourceLocation *location,
GCancellable *cancellable,
......
......@@ -45,6 +45,9 @@ ide_symbol_tree_get_n_children (IdeSymbolTree *self,
/**
* ide_symbol_tree_get_nth_child:
* @self: An #IdeSymbolTree.
* @node: (nullable): an #IdeSymboNode
* @nth: the nth child to retrieve.
*
* Gets the @nth child node of @node.
*
......
......@@ -41,12 +41,12 @@ G_DEFINE_BOXED_TYPE (IdeSymbol, ide_symbol, ide_symbol_ref, ide_symbol_unref)
EGG_DEFINE_COUNTER (instances, "IdeSymbol", "Instances", "Number of symbol instances")
IdeSymbol *
_ide_symbol_new (const gchar *name,
IdeSymbolKind kind,
IdeSymbolFlags flags,
IdeSourceLocation *declaration_location,
IdeSourceLocation *definition_location,
IdeSourceLocation *canonical_location)
ide_symbol_new (const gchar *name,
IdeSymbolKind kind,
IdeSymbolFlags flags,
IdeSourceLocation *declaration_location,
IdeSourceLocation *definition_location,
IdeSourceLocation *canonical_location)
{
IdeSymbol *ret;
......
......@@ -57,6 +57,12 @@ const gchar *ide_symbol_get_name (IdeSymbol *self);
IdeSourceLocation *ide_symbol_get_canonical_location (IdeSymbol *self);
IdeSourceLocation *ide_symbol_get_declaration_location (IdeSymbol *self);
IdeSourceLocation *ide_symbol_get_definition_location (IdeSymbol *self);
IdeSymbol *ide_symbol_new (const gchar *name,
IdeSymbolKind kind,
IdeSymbolFlags flags,
IdeSourceLocation *declaration_location,
IdeSourceLocation *definition_location,
IdeSourceLocation *canonical_location);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeSymbol, ide_symbol_unref)
......
......@@ -952,8 +952,8 @@ ide_clang_translation_unit_lookup_symbol (IdeClangTranslationUnit *self,
symkind = get_symbol_kind (cursor, &symflags);
cxstr = clang_getCursorDisplayName (cursor);
ret = _ide_symbol_new (clang_getCString (cxstr), symkind, symflags,
declaration, definition, canonical);
ret = ide_symbol_new (clang_getCString (cxstr), symkind, symflags,
declaration, definition, canonical);
/*
* TODO: We should also get information about the defintion of the symbol.
......@@ -985,7 +985,7 @@ create_symbol (CXCursor cursor,
symkind = get_symbol_kind (cursor, &symflags);
symbol = _ide_symbol_new (name, symkind, symflags, NULL, NULL, srcloc);
symbol = ide_symbol_new (name, symkind, symflags, NULL, NULL, srcloc);
return symbol;
}
......
......@@ -24,6 +24,7 @@
#include "ide-ctags-util.h"
#include "ide-internal.h"
#include "ide-line-reader.h"
#include "ide-symbol.h"
struct _IdeCtagsSymbolResolver
{
......@@ -123,9 +124,7 @@ create_symbol (IdeCtagsSymbolResolver *self,
NULL);
loc = ide_source_location_new (file, line, line_offset, offset);
return _ide_symbol_new (entry->name,
transform_kind (entry->kind),
0, loc, loc, loc);
return ide_symbol_new (entry->name, transform_kind (entry->kind), 0, loc, loc, loc);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment