[gnome-builder/wip/slaf/xml-pack] xml-pack: add analysis to IdeXmlPosition in service
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/slaf/xml-pack] xml-pack: add analysis to IdeXmlPosition in service
- Date: Sun, 28 May 2017 09:47:20 +0000 (UTC)
commit 14c3e7c192a7d1aa87c91306b2ff5052d571f726
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sat May 20 19:54:15 2017 +0200
xml-pack: add analysis to IdeXmlPosition in service
plugins/xml-pack/ide-xml-service.c | 38 +++++++++++++++++++----------------
1 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-service.c b/plugins/xml-pack/ide-xml-service.c
index 8387031..7e88c78 100644
--- a/plugins/xml-pack/ide-xml-service.c
+++ b/plugins/xml-pack/ide-xml-service.c
@@ -548,26 +548,28 @@ position_state_free (PositionState *state)
}
static IdeXmlPosition *
-get_position (IdeXmlService *self,
- IdeXmlSymbolNode *root_node,
- gint line,
- gint line_offset)
+get_position (IdeXmlService *self,
+ IdeXmlAnalysis *analysis,
+ gint line,
+ gint line_offset)
{
IdeXmlPosition *position = NULL;
+ IdeXmlSymbolNode *root_node;
IdeXmlPositionKind kind;
IdeXmlPositionKind candidate_kind = IDE_XML_POSITION_KIND_UNKNOW;
- IdeXmlSymbolNode *current_node = root_node;
+ IdeXmlSymbolNode *current_node;
IdeXmlSymbolNode *parent_node = NULL;
IdeXmlSymbolNode *child_node;
IdeXmlSymbolNode *candidate_node = root_node;
IdeXmlSymbolNode *previous_sibling_node = NULL;
IdeXmlSymbolNode *next_sibling_node = NULL;
- gint n_children;
+ guint n_children;
gint n = 0;
g_assert (IDE_IS_XML_SERVICE (self));
- g_assert (IDE_IS_XML_SYMBOL_NODE (root_node));
+ g_assert (analysis != NULL);
+ current_node = root_node = ide_xml_analysis_get_root_node (analysis);
while (TRUE)
{
loop:
@@ -610,6 +612,8 @@ loop:
result:
position = ide_xml_position_new (candidate_node, candidate_kind);
+ ide_xml_position_set_analysis (position, analysis);
+
if (parent_node != NULL)
{
n_children = ide_xml_symbol_node_get_n_direct_children (parent_node);
@@ -636,8 +640,8 @@ ide_xml_service_get_position_from_cursor_cb (GObject *object,
IdeXmlService *self = (IdeXmlService *)object;
PositionState *state = (PositionState *)user_data;
g_autoptr(GTask) task = state->task;
- g_autoptr(IdeXmlSymbolNode) root_node = NULL;
IdeXmlPosition *position;
+ IdeXmlAnalysis *analysis = NULL;
GError *error = NULL;
IDE_ENTRY;
@@ -645,10 +649,10 @@ ide_xml_service_get_position_from_cursor_cb (GObject *object,
g_assert (G_IS_TASK (task));
g_assert (IDE_IS_XML_SERVICE (self));
- root_node = ide_xml_service_get_root_node_finish (self, result, &error);
- if (root_node != NULL)
+ analysis = ide_xml_service_get_analysis_finish (self, result, &error);
+ if (analysis != NULL)
{
- position = get_position (self, root_node, state->line, state->line_offset);
+ position = get_position (self, analysis, state->line, state->line_offset);
g_task_return_pointer (task, position, g_object_unref);
}
else
@@ -688,12 +692,12 @@ ide_xml_service_get_position_from_cursor_async (IdeXmlService *self,
state->line = line;
state->line_offset = line_offset;
- ide_xml_service_get_root_node_async (self,
- ifile,
- buffer,
- cancellable,
- ide_xml_service_get_position_from_cursor_cb,
- state);
+ ide_xml_service_get_analysis_async (self,
+ ifile,
+ buffer,
+ cancellable,
+ ide_xml_service_get_position_from_cursor_cb,
+ state);
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]