[gnome-builder: 134/139] xml-pack: port to libide-code



commit 28159bc28ed93eaeb3b4224638adcfcad58c63fe
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:44:45 2019 -0800

    xml-pack: port to libide-code
    
    Mostly straightforward port of components to libide-code and friends.

 src/plugins/xml-pack/ide-xml-analysis.c            |  16 +-
 src/plugins/xml-pack/ide-xml-analysis.h            |   5 +-
 .../xml-pack/ide-xml-completion-attributes.c       |   3 +-
 .../xml-pack/ide-xml-completion-attributes.h       |   2 +-
 src/plugins/xml-pack/ide-xml-completion-provider.c |  17 +-
 src/plugins/xml-pack/ide-xml-completion-provider.h |   2 +-
 src/plugins/xml-pack/ide-xml-completion-values.c   |   2 +
 src/plugins/xml-pack/ide-xml-completion-values.h   |   2 +-
 src/plugins/xml-pack/ide-xml-diagnostic-provider.c |  15 +-
 src/plugins/xml-pack/ide-xml-diagnostic-provider.h |   2 +-
 src/plugins/xml-pack/ide-xml-hash-table.c          |   3 +-
 src/plugins/xml-pack/ide-xml-highlighter.h         |   2 +-
 src/plugins/xml-pack/ide-xml-indenter.c            |   4 +-
 src/plugins/xml-pack/ide-xml-indenter.h            |   2 +-
 src/plugins/xml-pack/ide-xml-parser-generic.c      |   6 +-
 src/plugins/xml-pack/ide-xml-parser-ui.c           |  29 +-
 src/plugins/xml-pack/ide-xml-parser.c              |  44 +--
 src/plugins/xml-pack/ide-xml-position.c            |   2 +
 src/plugins/xml-pack/ide-xml-proposal.c            |   4 +-
 src/plugins/xml-pack/ide-xml-proposal.h            |   2 +-
 src/plugins/xml-pack/ide-xml-rng-define.c          |   2 +
 src/plugins/xml-pack/ide-xml-rng-parser.c          |   1 +
 src/plugins/xml-pack/ide-xml-rng-parser.h          |   2 +-
 src/plugins/xml-pack/ide-xml-service.c             | 315 ++++++++-------------
 src/plugins/xml-pack/ide-xml-service.h             |  14 +-
 src/plugins/xml-pack/ide-xml-stack.c               |   4 +-
 src/plugins/xml-pack/ide-xml-symbol-node.c         |  22 +-
 src/plugins/xml-pack/ide-xml-symbol-node.h         |   2 +-
 src/plugins/xml-pack/ide-xml-symbol-resolver.c     |  13 +-
 src/plugins/xml-pack/ide-xml-symbol-resolver.h     |   2 +-
 src/plugins/xml-pack/ide-xml-symbol-tree.c         |   2 -
 src/plugins/xml-pack/ide-xml-symbol-tree.h         |   2 +-
 .../xml-pack/ide-xml-tree-builder-utils-private.h  |   2 +-
 src/plugins/xml-pack/ide-xml-tree-builder-utils.c  |   1 +
 src/plugins/xml-pack/ide-xml-tree-builder.c        |  44 +--
 src/plugins/xml-pack/ide-xml-tree-builder.h        |   2 +-
 src/plugins/xml-pack/ide-xml-validator.c           |  34 +--
 src/plugins/xml-pack/ide-xml-validator.h           |   3 +-
 src/plugins/xml-pack/meson.build                   |  21 +-
 src/plugins/xml-pack/xml-pack-plugin.c             |  30 +-
 src/plugins/xml-pack/xml-pack.gresource.xml        |   4 +-
 src/plugins/xml-pack/xml-pack.plugin               |  26 +-
 42 files changed, 313 insertions(+), 399 deletions(-)
---
diff --git a/src/plugins/xml-pack/ide-xml-analysis.c b/src/plugins/xml-pack/ide-xml-analysis.c
index 4198ffc5c..71fe8bc1f 100644
--- a/src/plugins/xml-pack/ide-xml-analysis.c
+++ b/src/plugins/xml-pack/ide-xml-analysis.c
@@ -17,6 +17,7 @@
  *
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
+
 #include "ide-xml-analysis.h"
 
 G_DEFINE_BOXED_TYPE (IdeXmlAnalysis, ide_xml_analysis, ide_xml_analysis_ref, ide_xml_analysis_unref)
@@ -35,8 +36,6 @@ ide_xml_analysis_get_sequence (IdeXmlAnalysis *self)
  *
  * Returns: (nullable) (transfer none): The #IdeDiagnostics contained by the analysis.
  *
- *
- * Since: 3.32
  */
 IdeDiagnostics *
 ide_xml_analysis_get_diagnostics (IdeXmlAnalysis *self)
@@ -52,8 +51,6 @@ ide_xml_analysis_get_diagnostics (IdeXmlAnalysis *self)
  *
  * Returns: (nullable) (transfer none): The #IdeXmlSymbolNode root node contained by the analysis.
  *
- *
- * Since: 3.32
  */
 IdeXmlSymbolNode *
 ide_xml_analysis_get_root_node (IdeXmlAnalysis *self)
@@ -69,8 +66,6 @@ ide_xml_analysis_get_root_node (IdeXmlAnalysis *self)
  *
  * Returns: (nullable) (transfer none): The schemas entries #GPtrArray contained by the analysis.
  *
- *
- * Since: 3.32
  */
 GPtrArray *
 ide_xml_analysis_get_schemas (IdeXmlAnalysis *self)
@@ -87,11 +82,7 @@ ide_xml_analysis_set_diagnostics (IdeXmlAnalysis *self,
   g_return_if_fail (self != NULL);
   g_return_if_fail (diagnostics != NULL);
 
-  if (diagnostics != self->diagnostics)
-    {
-      g_clear_pointer (&self->diagnostics, ide_diagnostics_unref);
-      self->diagnostics = ide_diagnostics_ref (diagnostics);
-    }
+  g_set_object (&self->diagnostics, diagnostics);
 }
 
 void
@@ -146,8 +137,7 @@ ide_xml_analysis_free (IdeXmlAnalysis *self)
   g_assert_cmpint (self->ref_count, ==, 0);
 
   g_clear_object (&self->root_node);
-  g_clear_pointer (&self->diagnostics, ide_diagnostics_unref);
-
+  g_clear_object (&self->diagnostics);
   g_slice_free (IdeXmlAnalysis, self);
 }
 
diff --git a/src/plugins/xml-pack/ide-xml-analysis.h b/src/plugins/xml-pack/ide-xml-analysis.h
index 1671b6f4c..0eb019acc 100644
--- a/src/plugins/xml-pack/ide-xml-analysis.h
+++ b/src/plugins/xml-pack/ide-xml-analysis.h
@@ -20,10 +20,9 @@
 
 #pragma once
 
-#include "diagnostics/ide-diagnostics.h"
-#include "ide-xml-symbol-node.h"
+#include <libide-code.h>
 
-#include <glib-object.h>
+#include "ide-xml-symbol-node.h"
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-completion-attributes.c 
b/src/plugins/xml-pack/ide-xml-completion-attributes.c
index 253f7d837..6e14cfe21 100644
--- a/src/plugins/xml-pack/ide-xml-completion-attributes.c
+++ b/src/plugins/xml-pack/ide-xml-completion-attributes.c
@@ -18,8 +18,9 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "ide-xml-completion-attributes.h"
+#include <dazzle.h>
 
+#include "ide-xml-completion-attributes.h"
 #include "ide-xml-position.h"
 
 typedef struct _MatchingState
diff --git a/src/plugins/xml-pack/ide-xml-completion-attributes.h 
b/src/plugins/xml-pack/ide-xml-completion-attributes.h
index 1057467b2..ca2f97665 100644
--- a/src/plugins/xml-pack/ide-xml-completion-attributes.h
+++ b/src/plugins/xml-pack/ide-xml-completion-attributes.h
@@ -22,7 +22,7 @@
 
 #include <glib.h>
 
-#include <ide.h>
+#include <libide-code.h>
 
 #include "ide-xml-rng-define.h"
 #include "ide-xml-symbol-node.h"
diff --git a/src/plugins/xml-pack/ide-xml-completion-provider.c 
b/src/plugins/xml-pack/ide-xml-completion-provider.c
index 3d0263952..b69005566 100644
--- a/src/plugins/xml-pack/ide-xml-completion-provider.c
+++ b/src/plugins/xml-pack/ide-xml-completion-provider.c
@@ -23,6 +23,7 @@
 #include <dazzle.h>
 #include <gtksourceview/gtksource.h>
 #include <libpeas/peas.h>
+#include <libide-sourceview.h>
 
 #include "ide-xml-completion-attributes.h"
 #include "ide-xml-completion-provider.h"
@@ -66,9 +67,9 @@ typedef struct _StateStackItem
 
 typedef struct
 {
-  IdeFile *ifile;
-  gint     line;
-  gint     line_offset;
+  GFile *file;
+  gint   line;
+  gint   line_offset;
 } PopulateState;
 
 typedef struct
@@ -91,7 +92,7 @@ populate_state_free (PopulateState *state)
 {
   g_assert (state != NULL);
 
-  g_clear_object (&state->ifile);
+  g_clear_object (&state->file);
   g_slice_free (PopulateState, state);
 }
 
@@ -997,7 +998,7 @@ populate_cb (GObject      *object,
           items = g_ptr_array_new_with_free_func ((GDestroyNotify)completion_item_free);
           if (child_pos != -1)
             {
-              candidate_node = ide_xml_symbol_node_new ("internal", NULL, "", IDE_SYMBOL_XML_ELEMENT);
+              candidate_node = ide_xml_symbol_node_new ("internal", NULL, "", IDE_SYMBOL_KIND_XML_ELEMENT);
               ide_xml_position_set_child_node (position, candidate_node);
             }
 
@@ -1043,20 +1044,20 @@ ide_xml_completion_provider_populate_async (IdeCompletionProvider *provider,
   ide_task_set_source_tag (task, ide_xml_completion_provider_populate_async);
 
   ide_context = ide_object_get_context (IDE_OBJECT (self));
-  service = ide_context_get_service_typed (ide_context, IDE_TYPE_XML_SERVICE);
+  service = ide_xml_service_from_context (ide_context);
 
   buffer = ide_completion_context_get_buffer (context);
   ide_completion_context_get_bounds (context, &iter, NULL);
 
   state = g_slice_new0 (PopulateState);
-  state->ifile = g_object_ref (ide_buffer_get_file (IDE_BUFFER (buffer)));
+  state->file = g_object_ref (ide_buffer_get_file (IDE_BUFFER (buffer)));
   state->line = gtk_text_iter_get_line (&iter) + 1;
   state->line_offset = gtk_text_iter_get_line_offset (&iter) + 1;
 
   ide_task_set_task_data (task, state, populate_state_free);
 
   ide_xml_service_get_position_from_cursor_async (service,
-                                                  state->ifile,
+                                                  state->file,
                                                   IDE_BUFFER (buffer),
                                                   state->line,
                                                   state->line_offset,
diff --git a/src/plugins/xml-pack/ide-xml-completion-provider.h 
b/src/plugins/xml-pack/ide-xml-completion-provider.h
index 26881fcf4..5f33cff78 100644
--- a/src/plugins/xml-pack/ide-xml-completion-provider.h
+++ b/src/plugins/xml-pack/ide-xml-completion-provider.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-completion-values.c 
b/src/plugins/xml-pack/ide-xml-completion-values.c
index 4047302da..51e7c3216 100644
--- a/src/plugins/xml-pack/ide-xml-completion-values.c
+++ b/src/plugins/xml-pack/ide-xml-completion-values.c
@@ -18,6 +18,8 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include <dazzle.h>
+
 #include "ide-xml-completion-values.h"
 #include "ide-xml-position.h"
 
diff --git a/src/plugins/xml-pack/ide-xml-completion-values.h 
b/src/plugins/xml-pack/ide-xml-completion-values.h
index ab06a9055..4d1cd4244 100644
--- a/src/plugins/xml-pack/ide-xml-completion-values.h
+++ b/src/plugins/xml-pack/ide-xml-completion-values.h
@@ -22,7 +22,7 @@
 
 #include <glib.h>
 
-#include <ide.h>
+#include <libide-code.h>
 
 #include "ide-xml-rng-define.h"
 #include "ide-xml-symbol-node.h"
diff --git a/src/plugins/xml-pack/ide-xml-diagnostic-provider.c 
b/src/plugins/xml-pack/ide-xml-diagnostic-provider.c
index f2ca7358e..d2e90eee7 100644
--- a/src/plugins/xml-pack/ide-xml-diagnostic-provider.c
+++ b/src/plugins/xml-pack/ide-xml-diagnostic-provider.c
@@ -55,15 +55,16 @@ ide_xml_diagnostic_provider_diagnose_cb (GObject      *object,
   else
     ide_task_return_pointer (task,
                              g_steal_pointer (&ret),
-                             (GDestroyNotify)ide_diagnostics_unref);
+                             g_object_unref);
 
   IDE_EXIT;
 }
 
 static void
 ide_xml_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *provider,
-                                            IdeFile               *file,
-                                            IdeBuffer             *buffer,
+                                            GFile                 *file,
+                                            GBytes                *contents,
+                                            const gchar           *lang_id,
                                             GCancellable          *cancellable,
                                             GAsyncReadyCallback    callback,
                                             gpointer               user_data)
@@ -76,19 +77,19 @@ ide_xml_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *provider,
   IDE_ENTRY;
 
   g_return_if_fail (IDE_IS_XML_DIAGNOSTIC_PROVIDER (self));
-  g_return_if_fail (IDE_IS_FILE (file));
-  g_return_if_fail (IDE_IS_BUFFER (buffer));
+  g_return_if_fail (G_IS_FILE (file));
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, ide_xml_diagnostic_provider_diagnose_async);
 
   context = ide_object_get_context (IDE_OBJECT (provider));
-  service = ide_context_get_service_typed (context, IDE_TYPE_XML_SERVICE);
+  service = ide_xml_service_from_context (context);
 
   ide_xml_service_get_diagnostics_async (service,
                                          file,
-                                         buffer,
+                                         contents,
+                                         lang_id,
                                          cancellable,
                                          ide_xml_diagnostic_provider_diagnose_cb,
                                          g_steal_pointer (&task));
diff --git a/src/plugins/xml-pack/ide-xml-diagnostic-provider.h 
b/src/plugins/xml-pack/ide-xml-diagnostic-provider.h
index 267c8f65c..d0169a774 100644
--- a/src/plugins/xml-pack/ide-xml-diagnostic-provider.h
+++ b/src/plugins/xml-pack/ide-xml-diagnostic-provider.h
@@ -21,7 +21,7 @@
 #pragma once
 
 #include <glib-object.h>
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-hash-table.c b/src/plugins/xml-pack/ide-xml-hash-table.c
index 77572ca0e..108920116 100644
--- a/src/plugins/xml-pack/ide-xml-hash-table.c
+++ b/src/plugins/xml-pack/ide-xml-hash-table.c
@@ -18,7 +18,8 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include <ide.h>
+#include <dazzle.h>
+#include <libide-code.h>
 
 #include "ide-xml-hash-table.h"
 
diff --git a/src/plugins/xml-pack/ide-xml-highlighter.h b/src/plugins/xml-pack/ide-xml-highlighter.h
index 63459c08c..41c7fc130 100644
--- a/src/plugins/xml-pack/ide-xml-highlighter.h
+++ b/src/plugins/xml-pack/ide-xml-highlighter.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-indenter.c b/src/plugins/xml-pack/ide-xml-indenter.c
index aedcb8f86..fedb05ce8 100644
--- a/src/plugins/xml-pack/ide-xml-indenter.c
+++ b/src/plugins/xml-pack/ide-xml-indenter.c
@@ -20,8 +20,10 @@
 
 #define G_LOG_DOMAIN "ide-xml-indenter"
 
-#include <libpeas/peas.h>
 #include <gtksourceview/gtksource.h>
+#include <libpeas/peas.h>
+#include <libide-code.h>
+#include <libide-sourceview.h>
 #include <string.h>
 
 #include "ide-xml-indenter.h"
diff --git a/src/plugins/xml-pack/ide-xml-indenter.h b/src/plugins/xml-pack/ide-xml-indenter.h
index ac61d1af3..23c5d112f 100644
--- a/src/plugins/xml-pack/ide-xml-indenter.h
+++ b/src/plugins/xml-pack/ide-xml-indenter.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-parser-generic.c b/src/plugins/xml-pack/ide-xml-parser-generic.c
index 27b830fb6..378b7e8c9 100644
--- a/src/plugins/xml-pack/ide-xml-parser-generic.c
+++ b/src/plugins/xml-pack/ide-xml-parser-generic.c
@@ -69,7 +69,7 @@ ide_xml_parser_generic_start_element_sax_cb (ParserState    *state,
   attr = collect_attributes (self, (const gchar **)attributes);
   label = g_strconcat ((const gchar *)name, attr, NULL);
 
-  node = ide_xml_symbol_node_new (label, NULL, (gchar *)name, IDE_SYMBOL_XML_ELEMENT);
+  node = ide_xml_symbol_node_new (label, NULL, (gchar *)name, IDE_SYMBOL_KIND_XML_ELEMENT);
   g_object_set (node, "use-markup", TRUE, NULL);
 
   state->attributes = (const gchar **)attributes;
@@ -87,7 +87,7 @@ ide_xml_parser_generic_comment_sax_cb (ParserState   *state,
   g_assert (IDE_IS_XML_PARSER (self));
 
   strip_name = g_strstrip (g_strdup ((const gchar *)name));
-  node = ide_xml_symbol_node_new (strip_name, NULL, NULL, IDE_SYMBOL_XML_COMMENT);
+  node = ide_xml_symbol_node_new (strip_name, NULL, NULL, IDE_SYMBOL_KIND_XML_COMMENT);
   ide_xml_parser_state_processing (self, state, "comment", node, IDE_XML_SAX_CALLBACK_TYPE_COMMENT, FALSE);
 }
 
@@ -101,7 +101,7 @@ ide_xml_parser_generic_cdata_sax_cb (ParserState   *state,
 
   g_assert (IDE_IS_XML_PARSER (self));
 
-  node = ide_xml_symbol_node_new ("cdata", NULL, NULL, IDE_SYMBOL_XML_CDATA);
+  node = ide_xml_symbol_node_new ("cdata", NULL, NULL, IDE_SYMBOL_KIND_XML_CDATA);
   ide_xml_parser_state_processing (self, state, "cdata", node, IDE_XML_SAX_CALLBACK_TYPE_CDATA, FALSE);
 }
 
diff --git a/src/plugins/xml-pack/ide-xml-parser-ui.c b/src/plugins/xml-pack/ide-xml-parser-ui.c
index 33b36b99b..5c77695f4 100644
--- a/src/plugins/xml-pack/ide-xml-parser-ui.c
+++ b/src/plugins/xml-pack/ide-xml-parser-ui.c
@@ -21,6 +21,7 @@
 #define G_LOG_DOMAIN "ide-xml-parser-ui"
 
 #include <dazzle.h>
+#include <libide-code.h>
 
 #include "ide-xml-parser-ui.h"
 #include "ide-xml-parser.h"
@@ -69,7 +70,7 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
           dzl_str_equal0 (parent_name, "template"))
         {
           value = get_attribute (attributes, "name", NULL);
-          node = ide_xml_symbol_node_new (value, NULL, "property", IDE_SYMBOL_UI_PROPERTY);
+          node = ide_xml_symbol_node_new (value, NULL, "property", IDE_SYMBOL_KIND_UI_PROPERTY);
           is_internal = TRUE;
           state->build_state = BUILD_STATE_GET_CONTENT;
         }
@@ -81,7 +82,7 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
           dzl_str_equal0 (parent_name, "item"))
         {
           value = get_attribute (attributes, "name", NULL);
-          node = ide_xml_symbol_node_new (value, NULL, "attribute", IDE_SYMBOL_UI_MENU_ATTRIBUTE);
+          node = ide_xml_symbol_node_new (value, NULL, "attribute", IDE_SYMBOL_KIND_UI_MENU_ATTRIBUTE);
           is_internal = TRUE;
           state->build_state = BUILD_STATE_GET_CONTENT;
         }
@@ -89,7 +90,7 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
   else if (dzl_str_equal0 (name, "class") && dzl_str_equal0 (parent_name, "style"))
     {
       value = get_attribute (attributes, "name", NULL);
-      node = ide_xml_symbol_node_new (value, NULL, "class", IDE_SYMBOL_UI_STYLE_CLASS);
+      node = ide_xml_symbol_node_new (value, NULL, "class", IDE_SYMBOL_KIND_UI_STYLE_CLASS);
       is_internal = TRUE;
     }
   else if (dzl_str_equal0 (name, "child"))
@@ -110,7 +111,7 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
           g_string_append (string, value);
         }
 
-      node = ide_xml_symbol_node_new (string->str, NULL, "child", IDE_SYMBOL_UI_CHILD);
+      node = ide_xml_symbol_node_new (string->str, NULL, "child", IDE_SYMBOL_KIND_UI_CHILD);
       g_object_set (node, "use-markup", TRUE, NULL);
     }
   else if (dzl_str_equal0 (name, "object"))
@@ -128,7 +129,7 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
           g_string_append (string, value);
         }
 
-      node = ide_xml_symbol_node_new (string->str, NULL, "object", IDE_SYMBOL_UI_OBJECT);
+      node = ide_xml_symbol_node_new (string->str, NULL, "object", IDE_SYMBOL_KIND_UI_OBJECT);
       g_object_set (node, "use-markup", TRUE, NULL);
     }
   else if (dzl_str_equal0 (name, "template"))
@@ -144,16 +145,16 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
       g_string_append (string, label);
       g_string_append (string, value);
 
-      node = ide_xml_symbol_node_new (string->str, NULL, (const gchar *)name, IDE_SYMBOL_UI_TEMPLATE);
+      node = ide_xml_symbol_node_new (string->str, NULL, (const gchar *)name, IDE_SYMBOL_KIND_UI_TEMPLATE);
       g_object_set (node, "use-markup", TRUE, NULL);
     }
   else if (dzl_str_equal0 (name, "packing"))
     {
-      node = ide_xml_symbol_node_new ("packing", NULL, "packing", IDE_SYMBOL_UI_PACKING);
+      node = ide_xml_symbol_node_new ("packing", NULL, "packing", IDE_SYMBOL_KIND_UI_PACKING);
     }
   else if (dzl_str_equal0 (name, "style"))
     {
-      node = ide_xml_symbol_node_new ("style", NULL, "style", IDE_SYMBOL_UI_STYLE);
+      node = ide_xml_symbol_node_new ("style", NULL, "style", IDE_SYMBOL_KIND_UI_STYLE);
     }
   else if (dzl_str_equal0 (name, "menu"))
     {
@@ -162,7 +163,7 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
       g_string_append (string, label);
       g_string_append (string, value);
 
-      node = ide_xml_symbol_node_new (string->str, NULL, "menu", IDE_SYMBOL_UI_MENU);
+      node = ide_xml_symbol_node_new (string->str, NULL, "menu", IDE_SYMBOL_KIND_UI_MENU);
       g_object_set (node, "use-markup", TRUE, NULL);
     }
   else if (dzl_str_equal0 (name, "submenu"))
@@ -172,7 +173,7 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
       g_string_append (string, label);
       g_string_append (string, value);
 
-      node = ide_xml_symbol_node_new (string->str, NULL, "submenu", IDE_SYMBOL_UI_SUBMENU);
+      node = ide_xml_symbol_node_new (string->str, NULL, "submenu", IDE_SYMBOL_KIND_UI_SUBMENU);
       g_object_set (node, "use-markup", TRUE, NULL);
     }
   else if (dzl_str_equal0 (name, "section"))
@@ -182,12 +183,12 @@ ide_xml_parser_ui_start_element_sax_cb (ParserState    *state,
       g_string_append (string, label);
       g_string_append (string, value);
 
-      node = ide_xml_symbol_node_new (string->str, NULL, "section", IDE_SYMBOL_UI_SECTION);
+      node = ide_xml_symbol_node_new (string->str, NULL, "section", IDE_SYMBOL_KIND_UI_SECTION);
       g_object_set (node, "use-markup", TRUE, NULL);
     }
   else if (dzl_str_equal0 (name, "item"))
     {
-      node = ide_xml_symbol_node_new ("item", NULL, "item", IDE_SYMBOL_UI_ITEM);
+      node = ide_xml_symbol_node_new ("item", NULL, "item", IDE_SYMBOL_KIND_UI_ITEM);
     }
 
   state->attributes = (const gchar **)attributes;
@@ -207,7 +208,7 @@ get_menu_attribute_value (IdeXmlSymbolNode *node,
   for (gint i = 0; i < n_children; ++i)
     {
       child = IDE_XML_SYMBOL_NODE (ide_xml_symbol_node_get_nth_internal_child (node, i));
-      if (ide_symbol_node_get_kind (IDE_SYMBOL_NODE (child)) == IDE_SYMBOL_UI_MENU_ATTRIBUTE &&
+      if (ide_symbol_node_get_kind (IDE_SYMBOL_NODE (child)) == IDE_SYMBOL_KIND_UI_MENU_ATTRIBUTE &&
           dzl_str_equal0 (ide_symbol_node_get_name (IDE_SYMBOL_NODE (child)), name))
         {
           return ide_xml_symbol_node_get_value (child);
@@ -236,7 +237,7 @@ node_post_processing_collect_style_classes (IdeXmlParser      *self,
       const gchar *name;
 
       child = IDE_XML_SYMBOL_NODE (ide_xml_symbol_node_get_nth_internal_child (node, i));
-      if (ide_symbol_node_get_kind (IDE_SYMBOL_NODE (child)) == IDE_SYMBOL_UI_STYLE_CLASS)
+      if (ide_symbol_node_get_kind (IDE_SYMBOL_NODE (child)) == IDE_SYMBOL_KIND_UI_STYLE_CLASS)
         {
           name = ide_symbol_node_get_name (IDE_SYMBOL_NODE (child));
           if (dzl_str_empty0 (name))
diff --git a/src/plugins/xml-pack/ide-xml-parser.c b/src/plugins/xml-pack/ide-xml-parser.c
index 98b3aa9a2..1b0cfa802 100644
--- a/src/plugins/xml-pack/ide-xml-parser.c
+++ b/src/plugins/xml-pack/ide-xml-parser.c
@@ -18,6 +18,7 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 #include <glib-object.h>
 
@@ -113,11 +114,9 @@ ide_xml_parser_create_diagnostic (ParserState            *state,
                                   IdeDiagnosticSeverity   severity)
 {
   IdeXmlParser *self = (IdeXmlParser *)state->self;
-  IdeContext *context;
+  g_autoptr(IdeLocation) start_loc = NULL;
+  g_autoptr(IdeLocation) end_loc = NULL;
   IdeDiagnostic *diagnostic;
-  g_autoptr(IdeSourceLocation) start_loc = NULL;
-  g_autoptr(IdeSourceLocation) end_loc = NULL;
-  g_autoptr(IdeFile) ifile = NULL;
   gint start_line;
   gint start_line_offset;
   gint end_line;
@@ -126,29 +125,25 @@ ide_xml_parser_create_diagnostic (ParserState            *state,
 
   g_assert (IDE_IS_XML_PARSER (self));
 
-  context = ide_object_get_context (IDE_OBJECT (self));
   ide_xml_sax_get_location (state->sax_parser,
                             &start_line, &start_line_offset,
                             &end_line, &end_line_offset,
                             NULL,
                             &size);
 
-  ifile = ide_file_new (context, state->file);
-  start_loc = ide_source_location_new (ifile,
-                                       start_line - 1,
-                                       start_line_offset - 1,
-                                       0);
+  start_loc = ide_location_new (state->file,
+                                start_line - 1,
+                                start_line_offset - 1);
 
   if (size > 0)
     {
-      IdeSourceRange *range;
+      IdeRange *range;
 
-      end_loc = ide_source_location_new (ifile,
-                                         end_line - 1,
-                                         end_line_offset - 1,
-                                         0);
+      end_loc = ide_location_new (state->file,
+                                  end_line - 1,
+                                  end_line_offset - 1);
 
-      range = ide_source_range_new (start_loc, end_loc);
+      range = ide_range_new (start_loc, end_loc);
       diagnostic = ide_diagnostic_new (severity, msg, NULL);
       ide_diagnostic_take_range (diagnostic, range);
     }
@@ -212,7 +207,7 @@ ide_xml_parser_state_processing (IdeXmlParser          *self,
     {
       if (callback_type == IDE_XML_SAX_CALLBACK_TYPE_START_ELEMENT)
         {
-          node = ide_xml_symbol_node_new ("internal", NULL, element_name, IDE_SYMBOL_XML_ELEMENT);
+          node = ide_xml_symbol_node_new ("internal", NULL, element_name, IDE_SYMBOL_KIND_XML_ELEMENT);
           ide_xml_symbol_node_set_location (node, g_object_ref (state->file),
                                             start_line, start_line_offset,
                                             end_line, end_line_offset,
@@ -385,7 +380,7 @@ ide_xml_parser_error_sax_cb (ParserState    *state,
           if (prev >= base && *prev == '<')
             {
               /* '<' only case, no name tag, node not created, we need to do it ourself */
-              node = ide_xml_symbol_node_new ("internal", NULL, NULL, IDE_SYMBOL_XML_ELEMENT);
+              node = ide_xml_symbol_node_new ("internal", NULL, NULL, IDE_SYMBOL_KIND_XML_ELEMENT);
               ide_xml_symbol_node_set_state (node, IDE_XML_SYMBOL_NODE_STATE_NOT_CLOSED);
               ide_xml_symbol_node_take_internal_child (state->parent_node, node);
 
@@ -590,14 +585,19 @@ ide_xml_parser_get_analysis_worker (IdeTask      *task,
       return;
     }
 
-  diagnostics = ide_diagnostics_new (IDE_PTR_ARRAY_STEAL_FULL (&state->diagnostics_array));
+  diagnostics = ide_diagnostics_new ();
+  if (state->diagnostics_array)
+    {
+      for (guint i = 0; i < state->diagnostics_array->len; i++)
+        ide_diagnostics_add (diagnostics, g_ptr_array_index (state->diagnostics_array, i));
+    }
   ide_xml_analysis_set_diagnostics (analysis, diagnostics);
 
   if (state->file_is_ui)
     {
       entry = ide_xml_schema_cache_entry_new ();
       entry->kind = SCHEMA_KIND_RNG;
-      entry->file = g_file_new_for_uri 
("resource:///org/gnome/builder/plugins/xml-pack-plugin/schemas/gtkbuilder.rng");
+      entry->file = g_file_new_for_uri ("resource:///plugins/xml-pack/schemas/gtkbuilder.rng");
       g_object_set_data (G_OBJECT (entry->file), "kind", GUINT_TO_POINTER (entry->kind));
       g_ptr_array_add (state->schemas, entry);
     }
@@ -633,7 +633,7 @@ ide_xml_parser_get_analysis_async (IdeXmlParser        *self,
   state->file = g_object_ref (file);
   state->content = g_bytes_ref (content);
   state->sequence = sequence;
-  state->diagnostics_array = g_ptr_array_new_with_free_func ((GDestroyNotify)ide_diagnostic_unref);
+  state->diagnostics_array = g_ptr_array_new_with_free_func (g_object_unref);
   state->schemas = g_ptr_array_new_with_free_func (g_object_unref);
   state->sax_parser = ide_xml_sax_new ();
   state->stack = ide_xml_stack_new ();
@@ -641,7 +641,7 @@ ide_xml_parser_get_analysis_async (IdeXmlParser        *self,
   state->build_state = BUILD_STATE_NORMAL;
 
   state->analysis = ide_xml_analysis_new (-1);
-  state->root_node = ide_xml_symbol_node_new ("root", NULL, "root", IDE_SYMBOL_NONE);
+  state->root_node = ide_xml_symbol_node_new ("root", NULL, "root", IDE_SYMBOL_KIND_NONE);
   ide_xml_analysis_set_root_node (state->analysis, state->root_node);
 
   state->parent_node = state->root_node;
diff --git a/src/plugins/xml-pack/ide-xml-position.c b/src/plugins/xml-pack/ide-xml-position.c
index 72e063f45..e2e98c078 100644
--- a/src/plugins/xml-pack/ide-xml-position.c
+++ b/src/plugins/xml-pack/ide-xml-position.c
@@ -18,6 +18,8 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include <dazzle.h>
+
 #include "ide-xml-position.h"
 
 G_DEFINE_BOXED_TYPE (IdeXmlPosition, ide_xml_position, ide_xml_position_ref, ide_xml_position_unref)
diff --git a/src/plugins/xml-pack/ide-xml-proposal.c b/src/plugins/xml-pack/ide-xml-proposal.c
index 703ac0966..2814bdc25 100644
--- a/src/plugins/xml-pack/ide-xml-proposal.c
+++ b/src/plugins/xml-pack/ide-xml-proposal.c
@@ -22,6 +22,8 @@
 
 #include "config.h"
 
+#include <libide-sourceview.h>
+
 #include "ide-xml-proposal.h"
 
 struct _IdeXmlProposal
@@ -63,7 +65,7 @@ ide_xml_proposal_new (const gchar *text,
                       const gchar *label)
 {
   IdeXmlProposal *self;
-  
+
   self = g_object_new (IDE_TYPE_XML_PROPOSAL, NULL);
   self->text = g_strdup (text);
   self->label = g_strdup (label);
diff --git a/src/plugins/xml-pack/ide-xml-proposal.h b/src/plugins/xml-pack/ide-xml-proposal.h
index f6ad39fd6..59c717bf9 100644
--- a/src/plugins/xml-pack/ide-xml-proposal.h
+++ b/src/plugins/xml-pack/ide-xml-proposal.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-rng-define.c b/src/plugins/xml-pack/ide-xml-rng-define.c
index 4c2beff2f..e8d2ef2cf 100644
--- a/src/plugins/xml-pack/ide-xml-rng-define.c
+++ b/src/plugins/xml-pack/ide-xml-rng-define.c
@@ -18,6 +18,8 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include <dazzle.h>
+
 #include "ide-xml-rng-define.h"
 
 G_DEFINE_BOXED_TYPE (IdeXmlRngDefine, ide_xml_rng_define, ide_xml_rng_define_ref, ide_xml_rng_define_unref)
diff --git a/src/plugins/xml-pack/ide-xml-rng-parser.c b/src/plugins/xml-pack/ide-xml-rng-parser.c
index c099ab917..150178b66 100644
--- a/src/plugins/xml-pack/ide-xml-rng-parser.c
+++ b/src/plugins/xml-pack/ide-xml-rng-parser.c
@@ -23,6 +23,7 @@
  * Whole refactoring to match the GNOME Builder needs.
  */
 
+#include <dazzle.h>
 #include <libxml/tree.h>
 #include <libxml/uri.h>
 
diff --git a/src/plugins/xml-pack/ide-xml-rng-parser.h b/src/plugins/xml-pack/ide-xml-rng-parser.h
index 801189483..ad039e68a 100644
--- a/src/plugins/xml-pack/ide-xml-rng-parser.h
+++ b/src/plugins/xml-pack/ide-xml-rng-parser.h
@@ -21,7 +21,7 @@
 #pragma once
 
 #include <glib.h>
-#include <ide.h>
+#include <libide-code.h>
 
 #include "ide-xml-schema.h"
 
diff --git a/src/plugins/xml-pack/ide-xml-service.c b/src/plugins/xml-pack/ide-xml-service.c
index 882295d96..715871dd6 100644
--- a/src/plugins/xml-pack/ide-xml-service.c
+++ b/src/plugins/xml-pack/ide-xml-service.c
@@ -45,10 +45,7 @@ struct _IdeXmlService
   GCancellable      *cancellable;
 };
 
-static void service_iface_init (IdeServiceInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (IdeXmlService, ide_xml_service, IDE_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (IDE_TYPE_SERVICE, service_iface_init))
+G_DEFINE_TYPE (IdeXmlService, ide_xml_service, IDE_TYPE_OBJECT)
 
 static void
 ide_xml_service_build_tree_cb2 (GObject      *object,
@@ -77,19 +74,16 @@ ide_xml_service_build_tree_cb (DzlTaskCache  *cache,
                                gpointer       user_data)
 {
   IdeXmlService *self = user_data;
-  g_autofree gchar *path = NULL;
-  IdeFile *ifile = (IdeFile *)key;
-  GFile *gfile;
+  GFile *file = (GFile *)key;
 
   IDE_ENTRY;
 
   g_assert (DZL_IS_TASK_CACHE (cache));
   g_assert (IDE_IS_XML_SERVICE (self));
-  g_assert (IDE_IS_FILE (ifile));
+  g_assert (G_IS_FILE (file));
   g_assert (G_IS_TASK (task));
 
-  if (NULL == (gfile = ide_file_get_file (ifile)) ||
-      NULL == (path = g_file_get_path (gfile)))
+  if (!g_file_is_native (file))
     {
       g_task_return_new_error (task,
                                G_IO_ERROR,
@@ -99,7 +93,7 @@ ide_xml_service_build_tree_cb (DzlTaskCache  *cache,
     }
 
   ide_xml_tree_builder_build_tree_async (self->tree_builder,
-                                         gfile,
+                                         file,
                                          g_task_get_cancellable (task),
                                          ide_xml_service_build_tree_cb2,
                                          g_object_ref (task));
@@ -269,97 +263,29 @@ ide_xml_service_get_analysis_cb (GObject      *object,
     g_task_return_pointer (task, g_steal_pointer (&analysis), (GDestroyNotify)ide_xml_analysis_unref);
 }
 
-typedef struct
-{
-  IdeXmlService *self;
-  GTask         *task;
-  GCancellable  *cancellable;
-  IdeFile       *ifile;
-  IdeBuffer     *buffer;
-} TaskState;
-
-static void
-ide_xml_service__buffer_loaded_cb (IdeBuffer *buffer,
-                                   TaskState *state)
-{
-  IdeXmlService *self = (IdeXmlService *)state->self;
-
-  g_assert (IDE_IS_XML_SERVICE (self));
-  g_assert (G_IS_TASK (state->task));
-  g_assert (state->cancellable == NULL || G_IS_CANCELLABLE (state->cancellable));
-  g_assert (IDE_IS_FILE (state->ifile));
-  g_assert (IDE_IS_BUFFER (state->buffer));
-
-  g_signal_handlers_disconnect_by_func (buffer, ide_xml_service__buffer_loaded_cb, state);
-
-  dzl_task_cache_get_async (self->analyses,
-                            state->ifile,
-                            TRUE,
-                            state->cancellable,
-                            ide_xml_service_get_analysis_cb,
-                            g_steal_pointer (&state->task));
-
-  g_object_unref (state->buffer);
-  g_object_unref (state->ifile);
-  g_slice_free (TaskState, state);
-}
-
 static void
 ide_xml_service_get_analysis_async (IdeXmlService       *self,
-                                    IdeFile             *ifile,
-                                    IdeBuffer           *buffer,
+                                    GFile               *file,
+                                    GBytes              *contents,
                                     GCancellable        *cancellable,
                                     GAsyncReadyCallback  callback,
                                     gpointer             user_data)
 {
   g_autoptr(GTask) task = NULL;
-  IdeContext *context;
-  IdeBufferManager *manager;
-  GFile *gfile;
 
   g_assert (IDE_IS_XML_SERVICE (self));
-  g_assert (IDE_IS_FILE (ifile));
-  g_assert (IDE_IS_BUFFER (buffer));
+  g_assert (G_IS_FILE (file));
   g_assert (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
 
   task = g_task_new (self, cancellable, callback, user_data);
-  context = ide_object_get_context (IDE_OBJECT (self));
-  manager = ide_context_get_buffer_manager (context);
-  gfile = ide_file_get_file (ifile);
-
-  if (!ide_buffer_manager_has_file (manager, gfile))
-    {
-      TaskState *state;
+  g_task_set_source_tag (task, ide_xml_service_get_analysis_async);
 
-      if (!ide_buffer_get_loading (buffer))
-        {
-          g_task_return_new_error (task,
-                                   G_IO_ERROR,
-                                   G_IO_ERROR_NOT_SUPPORTED,
-                                   _("Buffer loaded but not in the buffer manager."));
-          return;
-        }
-
-      /* Wait for the buffer to be fully loaded */
-      state = g_slice_new0 (TaskState);
-      state->self = self;
-      state->task = g_steal_pointer (&task);
-      state->cancellable = cancellable;
-      state->ifile = g_object_ref (ifile);
-      state->buffer = g_object_ref (buffer);
-
-      g_signal_connect (buffer,
-                        "loaded",
-                        G_CALLBACK (ide_xml_service__buffer_loaded_cb),
-                        state);
-    }
-  else
-    dzl_task_cache_get_async (self->analyses,
-                              ifile,
-                              TRUE,
-                              cancellable,
-                              ide_xml_service_get_analysis_cb,
-                              g_steal_pointer (&task));
+  dzl_task_cache_get_async (self->analyses,
+                            file,
+                            TRUE,
+                            cancellable,
+                            ide_xml_service_get_analysis_cb,
+                            g_steal_pointer (&task));
 }
 
 static IdeXmlAnalysis *
@@ -413,13 +339,11 @@ ide_xml_service_get_root_node_cb (GObject      *object,
  *
  * The xml service is meant to be used with buffers, that is,
  * by extension, loaded views.
- *
- * Since: 3.32
  */
 void
 ide_xml_service_get_root_node_async (IdeXmlService       *self,
-                                     IdeFile             *ifile,
-                                     IdeBuffer           *buffer,
+                                     GFile               *file,
+                                     GBytes              *contents,
                                      GCancellable        *cancellable,
                                      GAsyncReadyCallback  callback,
                                      gpointer             user_data)
@@ -428,8 +352,7 @@ ide_xml_service_get_root_node_async (IdeXmlService       *self,
   IdeXmlAnalysis *cached;
 
   g_return_if_fail (IDE_IS_XML_SERVICE (self));
-  g_return_if_fail (IDE_IS_FILE (ifile));
-  g_return_if_fail (IDE_IS_BUFFER (buffer));
+  g_return_if_fail (G_IS_FILE (file));
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   task = g_task_new (self, cancellable, callback, user_data);
@@ -438,19 +361,17 @@ ide_xml_service_get_root_node_async (IdeXmlService       *self,
    * If we have a cached analysis with a valid root_node,
    * and it is new enough, then re-use it.
    */
-  if (NULL != (cached = dzl_task_cache_peek (self->analyses, ifile)))
+  if ((cached = dzl_task_cache_peek (self->analyses, file)))
     {
       IdeContext *context;
       IdeUnsavedFiles *unsaved_files;
       IdeUnsavedFile *uf;
       IdeXmlSymbolNode *root_node;
-      GFile *gfile;
 
-      gfile = ide_file_get_file (ifile);
       context = ide_object_get_context (IDE_OBJECT (self));
-      unsaved_files = ide_context_get_unsaved_files (context);
+      unsaved_files = ide_unsaved_files_from_context (context);
 
-      if (NULL != (uf = ide_unsaved_files_get_unsaved_file (unsaved_files, gfile)) &&
+      if (NULL != (uf = ide_unsaved_files_get_unsaved_file (unsaved_files, file)) &&
           ide_xml_analysis_get_sequence (cached) == ide_unsaved_file_get_sequence (uf))
         {
           root_node = g_object_ref (ide_xml_analysis_get_root_node (cached));
@@ -462,8 +383,8 @@ ide_xml_service_get_root_node_async (IdeXmlService       *self,
     }
 
   ide_xml_service_get_analysis_async (self,
-                                      ifile,
-                                      buffer,
+                                      file,
+                                      contents,
                                       cancellable,
                                       ide_xml_service_get_root_node_cb,
                                       g_steal_pointer (&task));
@@ -476,8 +397,6 @@ ide_xml_service_get_root_node_async (IdeXmlService       *self,
  * See ide_xml_service_get_root_node_async() for more information.
  *
  * Returns: (transfer full): An #IdeXmlSymbolNode or %NULL up on failure.
- *
- * Since: 3.32
  */
 IdeXmlSymbolNode *
 ide_xml_service_get_root_node_finish (IdeXmlService  *self,
@@ -512,8 +431,8 @@ ide_xml_service_get_diagnostics_cb (GObject      *object,
     g_task_return_error (task, g_steal_pointer (&error));
   else
     {
-      diagnostics = ide_diagnostics_ref (ide_xml_analysis_get_diagnostics (analysis));
-      g_task_return_pointer (task, diagnostics, (GDestroyNotify)ide_diagnostics_unref);
+      diagnostics = g_object_ref (ide_xml_analysis_get_diagnostics (analysis));
+      g_task_return_pointer (task, diagnostics, g_object_unref);
     }
 }
 
@@ -531,13 +450,12 @@ ide_xml_service_get_diagnostics_cb (GObject      *object,
  *
  * The xml service is meant to be used with buffers, that is,
  * by extension, loaded views.
- *
- * Since: 3.32
  */
 void
 ide_xml_service_get_diagnostics_async (IdeXmlService       *self,
-                                       IdeFile             *ifile,
-                                       IdeBuffer           *buffer,
+                                       GFile               *file,
+                                       GBytes              *contents,
+                                       const gchar         *lang_id,
                                        GCancellable        *cancellable,
                                        GAsyncReadyCallback  callback,
                                        gpointer             user_data)
@@ -547,8 +465,7 @@ ide_xml_service_get_diagnostics_async (IdeXmlService       *self,
 
   g_return_if_fail (IDE_IS_MAIN_THREAD ());
   g_return_if_fail (IDE_IS_XML_SERVICE (self));
-  g_return_if_fail (IDE_IS_FILE (ifile));
-  g_return_if_fail (IDE_IS_BUFFER (buffer) || buffer == NULL);
+  g_return_if_fail (G_IS_FILE (file));
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   task = g_task_new (self, cancellable, callback, user_data);
@@ -558,33 +475,31 @@ ide_xml_service_get_diagnostics_async (IdeXmlService       *self,
    * If we have a cached analysis with some diagnostics,
    * and it is new enough, then re-use it.
    */
-  if ((cached = dzl_task_cache_peek (self->analyses, ifile)))
+  if ((cached = dzl_task_cache_peek (self->analyses, file)))
     {
       IdeContext *context;
       IdeUnsavedFiles *unsaved_files;
       IdeUnsavedFile *uf;
       IdeDiagnostics *diagnostics;
-      GFile *gfile;
 
-      gfile = ide_file_get_file (ifile);
       context = ide_object_get_context (IDE_OBJECT (self));
-      unsaved_files = ide_context_get_unsaved_files (context);
+      unsaved_files = ide_unsaved_files_from_context (context);
 
-      if ((uf = ide_unsaved_files_get_unsaved_file (unsaved_files, gfile)) &&
+      if ((uf = ide_unsaved_files_get_unsaved_file (unsaved_files, file)) &&
           ide_xml_analysis_get_sequence (cached) == ide_unsaved_file_get_sequence (uf))
         {
           diagnostics = ide_xml_analysis_get_diagnostics (cached);
           g_assert (diagnostics != NULL);
           g_task_return_pointer (task,
-                                 ide_diagnostics_ref (diagnostics),
-                                 (GDestroyNotify)ide_diagnostics_unref);
+                                 g_object_ref (diagnostics),
+                                 g_object_unref);
           return;
         }
     }
 
   ide_xml_service_get_analysis_async (self,
-                                      ifile,
-                                      buffer,
+                                      file,
+                                      contents,
                                       cancellable,
                                       ide_xml_service_get_diagnostics_cb,
                                       g_steal_pointer (&task));
@@ -597,8 +512,6 @@ ide_xml_service_get_diagnostics_async (IdeXmlService       *self,
  * See ide_xml_service_get_diagnostics_async() for more information.
  *
  * Returns: (transfer full): An #IdeDiagnostics or %NULL on failure.
- *
- * Since: 3.32
  */
 IdeDiagnostics *
 ide_xml_service_get_diagnostics_finish (IdeXmlService  *self,
@@ -613,40 +526,72 @@ ide_xml_service_get_diagnostics_finish (IdeXmlService  *self,
 }
 
 static void
-ide_xml_service_context_loaded (IdeService *service)
+ide_xml_service_parent_set (IdeObject *object,
+                            IdeObject *parent)
 {
-  IdeXmlService *self = (IdeXmlService *)service;
-  IdeContext *context;
+  IdeXmlService *self = (IdeXmlService *)object;
 
   IDE_ENTRY;
 
+  g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (IDE_IS_XML_SERVICE (self));
+  g_assert (!parent || IDE_IS_OBJECT (parent));
 
-  context = ide_object_get_context (IDE_OBJECT (self));
+  if (parent == NULL)
+    return;
 
   if (self->tree_builder == NULL)
     self->tree_builder = g_object_new (IDE_TYPE_XML_TREE_BUILDER,
-                                       "context", context,
+                                       "parent", self,
                                        NULL);
 
+  self->analyses = dzl_task_cache_new ((GHashFunc)g_file_hash,
+                                       (GEqualFunc)g_file_equal,
+                                       g_object_ref,
+                                       g_object_unref,
+                                       (GBoxedCopyFunc)ide_xml_analysis_ref,
+                                       (GBoxedFreeFunc)ide_xml_analysis_unref,
+                                       DEFAULT_EVICTION_MSEC,
+                                       ide_xml_service_build_tree_cb,
+                                       self,
+                                       NULL);
+
+  dzl_task_cache_set_name (self->analyses, "xml analysis cache");
+
+  /* There's no eviction time on this cache */
+  self->schemas = dzl_task_cache_new ((GHashFunc)g_file_hash,
+                                      (GEqualFunc)g_file_equal,
+                                      g_object_ref,
+                                      g_object_unref,
+                                      (GBoxedCopyFunc)ide_xml_schema_cache_entry_ref,
+                                      (GBoxedFreeFunc)ide_xml_schema_cache_entry_unref,
+                                      0,
+                                      ide_xml_service_load_schema_cb,
+                                      self,
+                                      NULL);
+
+  dzl_task_cache_set_name (self->schemas, "xml schemas cache");
+
   IDE_EXIT;
 }
 
 typedef struct
 {
-  IdeFile   *ifile;
+  GFile     *file;
   IdeBuffer *buffer;
   gint       line;
   gint       line_offset;
 } PositionState;
 
 static void
-position_state_free (PositionState *state)
+position_state_free (gpointer data)
 {
-  g_assert (state != NULL);
+  PositionState *state = data;
+
   g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (state != NULL);
 
-  g_clear_object (&state->ifile);
+  g_clear_object (&state->file);
   g_clear_object (&state->buffer);
   g_slice_free (PositionState, state);
 }
@@ -1009,7 +954,7 @@ ide_xml_service_get_position_from_cursor_cb (GObject      *object,
 
 void
 ide_xml_service_get_position_from_cursor_async (IdeXmlService       *self,
-                                                IdeFile             *ifile,
+                                                GFile               *file,
                                                 IdeBuffer           *buffer,
                                                 gint                 line,
                                                 gint                 line_offset,
@@ -1018,12 +963,13 @@ ide_xml_service_get_position_from_cursor_async (IdeXmlService       *self,
                                                 gpointer             user_data)
 {
   g_autoptr(IdeTask) task = NULL;
+  g_autoptr(GBytes) content = NULL;
   PositionState *state;
 
   IDE_ENTRY;
 
   g_return_if_fail (IDE_IS_XML_SERVICE (self));
-  g_return_if_fail (IDE_IS_FILE (ifile));
+  g_return_if_fail (G_IS_FILE (file));
   g_return_if_fail (IDE_IS_BUFFER (buffer) || buffer == NULL);
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
@@ -1031,16 +977,18 @@ ide_xml_service_get_position_from_cursor_async (IdeXmlService       *self,
   ide_task_set_source_tag (task, ide_xml_service_get_position_from_cursor_async);
 
   state = g_slice_new0 (PositionState);
-  state->ifile = g_object_ref (ifile);
+  state->file = g_object_ref (file);
   state->buffer = g_object_ref (buffer);
   state->line = line;
   state->line_offset = line_offset;
 
   ide_task_set_task_data (task, state, position_state_free);
 
+  content = ide_buffer_dup_content (buffer);
+
   ide_xml_service_get_analysis_async (self,
-                                      ifile,
-                                      buffer,
+                                      file,
+                                      content,
                                       cancellable,
                                       ide_xml_service_get_position_from_cursor_cb,
                                       g_steal_pointer (&task));
@@ -1060,53 +1008,20 @@ ide_xml_service_get_position_from_cursor_finish (IdeXmlService  *self,
 }
 
 static void
-ide_xml_service_start (IdeService *service)
+ide_xml_service_destroy (IdeObject *object)
 {
-  IdeXmlService *self = (IdeXmlService *)service;
-
-  g_assert (IDE_IS_XML_SERVICE (self));
-
-  self->analyses = dzl_task_cache_new ((GHashFunc)ide_file_hash,
-                                       (GEqualFunc)ide_file_equal,
-                                       g_object_ref,
-                                       g_object_unref,
-                                       (GBoxedCopyFunc)ide_xml_analysis_ref,
-                                       (GBoxedFreeFunc)ide_xml_analysis_unref,
-                                       DEFAULT_EVICTION_MSEC,
-                                       ide_xml_service_build_tree_cb,
-                                       self,
-                                       NULL);
-
-  dzl_task_cache_set_name (self->analyses, "xml analysis cache");
-
-  /* There's no eviction time on this cache */
-  self->schemas = dzl_task_cache_new ((GHashFunc)g_file_hash,
-                                      (GEqualFunc)g_file_equal,
-                                      g_object_ref,
-                                      g_object_unref,
-                                      (GBoxedCopyFunc)ide_xml_schema_cache_entry_ref,
-                                      (GBoxedFreeFunc)ide_xml_schema_cache_entry_unref,
-                                      0,
-                                      ide_xml_service_load_schema_cb,
-                                      self,
-                                      NULL);
-
-  dzl_task_cache_set_name (self->schemas, "xml schemas cache");
-}
-
-static void
-ide_xml_service_stop (IdeService *service)
-{
-  IdeXmlService *self = (IdeXmlService *)service;
+  IdeXmlService *self = (IdeXmlService *)object;
 
   g_assert (IDE_IS_XML_SERVICE (self));
 
-  if (self->cancellable && !g_cancellable_is_cancelled (self->cancellable))
+  if (!g_cancellable_is_cancelled (self->cancellable))
     g_cancellable_cancel (self->cancellable);
 
   g_clear_object (&self->cancellable);
   g_clear_object (&self->analyses);
   g_clear_object (&self->schemas);
+
+  IDE_OBJECT_CLASS (ide_xml_service_parent_class)->destroy (object);
 }
 
 static void
@@ -1116,7 +1031,6 @@ ide_xml_service_finalize (GObject *object)
 
   IDE_ENTRY;
 
-  ide_xml_service_stop (IDE_SERVICE (self));
   g_clear_object (&self->tree_builder);
 
   G_OBJECT_CLASS (ide_xml_service_parent_class)->finalize (object);
@@ -1128,16 +1042,12 @@ static void
 ide_xml_service_class_init (IdeXmlServiceClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  IdeObjectClass *i_object_class = IDE_OBJECT_CLASS (klass);
 
   object_class->finalize = ide_xml_service_finalize;
-}
 
-static void
-service_iface_init (IdeServiceInterface *iface)
-{
-  iface->context_loaded = ide_xml_service_context_loaded;
-  iface->start = ide_xml_service_start;
-  iface->stop = ide_xml_service_stop;
+  i_object_class->parent_set = ide_xml_service_parent_set;
+  i_object_class->destroy = ide_xml_service_destroy;
 }
 
 static void
@@ -1151,20 +1061,18 @@ ide_xml_service_init (IdeXmlService *self)
  * Gets the #IdeXmlSymbolNode root node for the corresponding file.
  *
  * Returns: (transfer NULL): A xml symbol node.
- *
- * Since: 3.32
  */
 IdeXmlSymbolNode *
 ide_xml_service_get_cached_root_node (IdeXmlService *self,
-                                      GFile         *gfile)
+                                      GFile         *file)
 {
   IdeXmlAnalysis *analysis;
   IdeXmlSymbolNode *cached;
 
   g_return_val_if_fail (IDE_IS_XML_SERVICE (self), NULL);
-  g_return_val_if_fail (IDE_IS_FILE (gfile), NULL);
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
 
-  if (NULL != (analysis = dzl_task_cache_peek (self->analyses, gfile)) &&
+  if (NULL != (analysis = dzl_task_cache_peek (self->analyses, file)) &&
       NULL != (cached = ide_xml_analysis_get_root_node (analysis)))
     return g_object_ref (cached);
 
@@ -1177,22 +1085,20 @@ ide_xml_service_get_cached_root_node (IdeXmlService *self,
  * Gets the #IdeDiagnostics for the corresponding file.
  *
  * Returns: (transfer NULL): an #IdeDiagnostics.
- *
- * Since: 3.32
  */
 IdeDiagnostics *
 ide_xml_service_get_cached_diagnostics (IdeXmlService *self,
-                                        GFile         *gfile)
+                                        GFile         *file)
 {
   IdeXmlAnalysis *analysis;
   IdeDiagnostics *cached;
 
   g_return_val_if_fail (IDE_IS_XML_SERVICE (self), NULL);
-  g_return_val_if_fail (IDE_IS_FILE (gfile), NULL);
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
 
-  if (NULL != (analysis = dzl_task_cache_peek (self->analyses, gfile)) &&
+  if (NULL != (analysis = dzl_task_cache_peek (self->analyses, file)) &&
       NULL != (cached = ide_xml_analysis_get_diagnostics (analysis)))
-    return ide_diagnostics_ref (cached);
+    return g_object_ref (cached);
 
   return NULL;
 }
@@ -1203,8 +1109,6 @@ ide_xml_service_get_cached_diagnostics (IdeXmlService *self,
  * Gets the #DzlTaskCache for the xml schemas.
  *
  * Returns: (transfer NULL): a #DzlTaskCache.
- *
- * Since: 3.32
  */
 DzlTaskCache *
 ide_xml_service_get_schemas_cache (IdeXmlService *self)
@@ -1213,3 +1117,22 @@ ide_xml_service_get_schemas_cache (IdeXmlService *self)
 
   return self->schemas;
 }
+
+/**
+ * ide_xml_service_from_context:
+ * @context: an #IdeContext
+ *
+ * Returns: (transfer none): an #IdeXmlService
+ *
+ * Since: 3.32
+ */
+IdeXmlService *
+ide_xml_service_from_context (IdeContext *context)
+{
+  g_autoptr(IdeXmlService) child = NULL;
+
+  g_return_val_if_fail (IDE_IS_CONTEXT (context), NULL);
+
+  child = ide_object_ensure_child_typed (IDE_OBJECT (context), IDE_TYPE_XML_SERVICE);
+  return ide_context_peek_child_typed (context, IDE_TYPE_XML_SERVICE);
+}
diff --git a/src/plugins/xml-pack/ide-xml-service.h b/src/plugins/xml-pack/ide-xml-service.h
index fa8401eba..40ec05699 100644
--- a/src/plugins/xml-pack/ide-xml-service.h
+++ b/src/plugins/xml-pack/ide-xml-service.h
@@ -24,7 +24,7 @@
 #include <gtksourceview/gtksource.h>
 #include "ide-xml-position.h"
 #include "ide-xml-symbol-node.h"
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IdeXmlService, ide_xml_service, IDE, XML_SERVICE, IdeObject)
 
+IdeXmlService      *ide_xml_service_from_context                       (IdeContext           *context);
 IdeDiagnostics     *ide_xml_service_get_cached_diagnostics             (IdeXmlService        *self,
                                                                         GFile                *gfile);
 IdeXmlSymbolNode   *ide_xml_service_get_cached_root_node               (IdeXmlService        *self,
@@ -40,13 +41,14 @@ IdeDiagnostics     *ide_xml_service_get_diagnostics_finish             (IdeXmlSe
                                                                         GAsyncResult         *result,
                                                                         GError              **error);
 void                ide_xml_service_get_diagnostics_async              (IdeXmlService        *self,
-                                                                        IdeFile              *ifile,
-                                                                        IdeBuffer            *buffer,
+                                                                        GFile                *file,
+                                                                        GBytes               *contents,
+                                                                        const gchar          *lang_id,
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
 void                ide_xml_service_get_position_from_cursor_async     (IdeXmlService        *self,
-                                                                        IdeFile              *ifile,
+                                                                        GFile                *file,
                                                                         IdeBuffer            *buffer,
                                                                         gint                  line,
                                                                         gint                  line_offset,
@@ -57,8 +59,8 @@ IdeXmlPosition     *ide_xml_service_get_position_from_cursor_finish    (IdeXmlSe
                                                                         GAsyncResult         *result,
                                                                         GError              **error);
 void                ide_xml_service_get_root_node_async                (IdeXmlService        *self,
-                                                                        IdeFile              *ifile,
-                                                                        IdeBuffer            *buffer,
+                                                                        GFile                *file,
+                                                                        GBytes               *contents,
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
diff --git a/src/plugins/xml-pack/ide-xml-stack.c b/src/plugins/xml-pack/ide-xml-stack.c
index 17b07c597..6b55607dd 100644
--- a/src/plugins/xml-pack/ide-xml-stack.c
+++ b/src/plugins/xml-pack/ide-xml-stack.c
@@ -18,8 +18,10 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include <dazzle.h>
+#include <libide-code.h>
+
 #include "ide-xml-stack.h"
-#include <ide.h>
 
 typedef struct _StackItem
 {
diff --git a/src/plugins/xml-pack/ide-xml-symbol-node.c b/src/plugins/xml-pack/ide-xml-symbol-node.c
index d7f25f45b..6c1f982de 100644
--- a/src/plugins/xml-pack/ide-xml-symbol-node.c
+++ b/src/plugins/xml-pack/ide-xml-symbol-node.c
@@ -21,6 +21,8 @@
 
 #define G_LOG_DOMAIN "ide-xml-symbol-node"
 
+#include <dazzle.h>
+
 #include "ide-xml-symbol-node.h"
 
 typedef struct _Attribute
@@ -81,9 +83,7 @@ ide_xml_symbol_node_get_location_async (IdeSymbolNode       *node,
 {
   IdeXmlSymbolNode *self = (IdeXmlSymbolNode *)node;
   g_autoptr(IdeTask) task = NULL;
-  IdeContext *context;
-  g_autoptr(IdeFile) ifile = NULL;
-  IdeSourceLocation *ret;
+  IdeLocation *ret;
 
   g_return_if_fail (IDE_IS_XML_SYMBOL_NODE (self));
   g_return_if_fail (G_IS_FILE (self->file));
@@ -92,18 +92,14 @@ ide_xml_symbol_node_get_location_async (IdeSymbolNode       *node,
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, ide_xml_symbol_node_get_location_async);
 
-  context = ide_object_get_context (IDE_OBJECT (self));
-  ifile = ide_file_new (context, self->file);
-
-  ret = ide_source_location_new (ifile,
-                                 self->start_tag.start_line - 1,
-                                 self->start_tag.start_line_offset - 1,
-                                 0);
+  ret = ide_location_new (self->file,
+                          self->start_tag.start_line - 1,
+                          self->start_tag.start_line_offset - 1);
 
-  ide_task_return_pointer (task, ret, (GDestroyNotify)ide_source_location_unref);
+  ide_task_return_pointer (task, ret, g_object_unref);
 }
 
-static IdeSourceLocation *
+static IdeLocation *
 ide_xml_symbol_node_get_location_finish (IdeSymbolNode  *node,
                                          GAsyncResult   *result,
                                          GError        **error)
@@ -452,8 +448,6 @@ ide_xml_symbol_node_set_location (IdeXmlSymbolNode *self,
  * Gets the location of an xml node.
  *
  * Returns: (transfer none): Gets the location of an xml node.
- *
- * Since: 3.32
  */
 GFile *
 ide_xml_symbol_node_get_location (IdeXmlSymbolNode *self,
diff --git a/src/plugins/xml-pack/ide-xml-symbol-node.h b/src/plugins/xml-pack/ide-xml-symbol-node.h
index e641246fe..3b1c5e462 100644
--- a/src/plugins/xml-pack/ide-xml-symbol-node.h
+++ b/src/plugins/xml-pack/ide-xml-symbol-node.h
@@ -23,7 +23,7 @@
 #include "ide-xml-types.h"
 #include "ide-xml-symbol-resolver.h"
 
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-symbol-resolver.c b/src/plugins/xml-pack/ide-xml-symbol-resolver.c
index 9f7b5e996..52cc4a607 100644
--- a/src/plugins/xml-pack/ide-xml-symbol-resolver.c
+++ b/src/plugins/xml-pack/ide-xml-symbol-resolver.c
@@ -37,7 +37,7 @@ G_DEFINE_TYPE_WITH_CODE (IdeXmlSymbolResolver, ide_xml_symbol_resolver, IDE_TYPE
 
 static void
 ide_xml_symbol_resolver_lookup_symbol_async (IdeSymbolResolver   *resolver,
-                                             IdeSourceLocation   *location,
+                                             IdeLocation   *location,
                                              GCancellable        *cancellable,
                                              GAsyncReadyCallback  callback,
                                              gpointer             user_data)
@@ -105,7 +105,7 @@ ide_xml_symbol_resolver_get_symbol_tree_cb (GObject      *object,
 static void
 ide_xml_symbol_resolver_get_symbol_tree_async (IdeSymbolResolver   *resolver,
                                                GFile               *file,
-                                               IdeBuffer           *buffer,
+                                               GBytes              *contents,
                                                GCancellable        *cancellable,
                                                GAsyncReadyCallback  callback,
                                                gpointer             user_data)
@@ -114,7 +114,6 @@ ide_xml_symbol_resolver_get_symbol_tree_async (IdeSymbolResolver   *resolver,
   g_autoptr(IdeTask) task = NULL;
   IdeContext *context;
   IdeXmlService *service;
-  g_autoptr(IdeFile) ifile = NULL;
 
   IDE_ENTRY;
 
@@ -123,17 +122,15 @@ ide_xml_symbol_resolver_get_symbol_tree_async (IdeSymbolResolver   *resolver,
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  service = ide_context_get_service_typed (context, IDE_TYPE_XML_SERVICE);
+  service = ide_xml_service_from_context (context);
 
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_task_data (task, g_object_ref (file), g_object_unref);
   ide_task_set_source_tag (task, ide_xml_symbol_resolver_get_symbol_tree_async);
 
-  ifile = ide_file_new (context, file);
-
   ide_xml_service_get_root_node_async (service,
-                                       ifile,
-                                       buffer,
+                                       file,
+                                       contents,
                                        cancellable,
                                        ide_xml_symbol_resolver_get_symbol_tree_cb,
                                        g_object_ref (task));
diff --git a/src/plugins/xml-pack/ide-xml-symbol-resolver.h b/src/plugins/xml-pack/ide-xml-symbol-resolver.h
index 4e6b936b3..0d4f6e1fb 100644
--- a/src/plugins/xml-pack/ide-xml-symbol-resolver.h
+++ b/src/plugins/xml-pack/ide-xml-symbol-resolver.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-code.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/xml-pack/ide-xml-symbol-tree.c b/src/plugins/xml-pack/ide-xml-symbol-tree.c
index e599f4f2f..533a36653 100644
--- a/src/plugins/xml-pack/ide-xml-symbol-tree.c
+++ b/src/plugins/xml-pack/ide-xml-symbol-tree.c
@@ -86,8 +86,6 @@ symbol_tree_iface_init (IdeSymbolTreeInterface *iface)
  * Create a new #IdeXmlSymbolTree
  *
  * Returns: (transfer full): A newly allocated #IdeXmlSymbolTree.
- *
- * Since: 3.32
  */
 IdeXmlSymbolTree *
 ide_xml_symbol_tree_new (IdeXmlSymbolNode *root_node)
diff --git a/src/plugins/xml-pack/ide-xml-symbol-tree.h b/src/plugins/xml-pack/ide-xml-symbol-tree.h
index 17e126b0a..86f4644a7 100644
--- a/src/plugins/xml-pack/ide-xml-symbol-tree.h
+++ b/src/plugins/xml-pack/ide-xml-symbol-tree.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-code.h>
 #include "ide-xml-symbol-node.h"
 
 G_BEGIN_DECLS
diff --git a/src/plugins/xml-pack/ide-xml-tree-builder-utils-private.h 
b/src/plugins/xml-pack/ide-xml-tree-builder-utils-private.h
index a8c7c62c4..5682ae420 100644
--- a/src/plugins/xml-pack/ide-xml-tree-builder-utils-private.h
+++ b/src/plugins/xml-pack/ide-xml-tree-builder-utils-private.h
@@ -20,7 +20,7 @@
 #pragma once
 
 #include <glib.h>
-#include <ide.h>
+#include <libide-code.h>
 
 #include "ide-xml-schema-cache-entry.h"
 #include "ide-xml-symbol-node.h"
diff --git a/src/plugins/xml-pack/ide-xml-tree-builder-utils.c 
b/src/plugins/xml-pack/ide-xml-tree-builder-utils.c
index 0c78f6818..4b10d9894 100644
--- a/src/plugins/xml-pack/ide-xml-tree-builder-utils.c
+++ b/src/plugins/xml-pack/ide-xml-tree-builder-utils.c
@@ -18,6 +18,7 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include <dazzle.h>
 #include <string.h>
 
 #include "ide-xml-tree-builder-utils-private.h"
diff --git a/src/plugins/xml-pack/ide-xml-tree-builder.c b/src/plugins/xml-pack/ide-xml-tree-builder.c
index 65ffcb1d2..ee2d2d3c9 100644
--- a/src/plugins/xml-pack/ide-xml-tree-builder.c
+++ b/src/plugins/xml-pack/ide-xml-tree-builder.c
@@ -85,17 +85,12 @@ create_diagnostic (IdeContext            *context,
                    gint                   col,
                    IdeDiagnosticSeverity  severity)
 {
-  g_autoptr(IdeSourceLocation) loc = NULL;
-  g_autoptr(IdeFile) ifile = NULL;
+  g_autoptr(IdeLocation) loc = NULL;
 
   g_assert (IDE_IS_CONTEXT (context));
   g_assert (G_IS_FILE (file));
 
-  ifile = ide_file_new (context, file);
-  loc = ide_source_location_new (ifile,
-                                 line - 1,
-                                 col - 1,
-                                 0);
+  loc = ide_location_new (file, line - 1, col - 1);
 
   return ide_diagnostic_new (severity, msg, loc);
 }
@@ -115,12 +110,12 @@ ide_xml_tree_builder_get_file_content (IdeXmlTreeBuilder *self,
   g_assert (G_IS_FILE (file));
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  manager = ide_context_get_buffer_manager (context);
+  manager = ide_buffer_manager_from_context (context);
   buffer = ide_buffer_manager_find_buffer (manager, file);
 
   if (buffer != NULL)
     {
-      content = ide_buffer_get_content (buffer);
+      content = ide_buffer_dup_content (buffer);
       sequence_tmp = ide_buffer_get_change_count (buffer);
     }
 
@@ -233,7 +228,7 @@ fetch_schemas_async (IdeXmlTreeBuilder   *self,
   schemas_copy = g_ptr_array_new_with_free_func ((GDestroyNotify)ide_xml_schema_cache_entry_unref);
 
   context = ide_object_get_context (IDE_OBJECT (self));
-  service = ide_context_get_service_typed (context, IDE_TYPE_XML_SERVICE);
+  service = ide_xml_service_from_context (context);
   schemas_cache = ide_xml_service_get_schemas_cache (service);
 
   for (guint i = 0; i < schemas->len; i++)
@@ -556,40 +551,47 @@ ide_xml_tree_builder_build_tree_finish (IdeXmlTreeBuilder  *self,
 }
 
 static void
-ide_xml_tree_builder_finalize (GObject *object)
+ide_xml_tree_builder_destroy (IdeObject *object)
 {
   IdeXmlTreeBuilder *self = (IdeXmlTreeBuilder *)object;
 
-  g_clear_object (&self->parser);
-  g_clear_object (&self->validator);
+  ide_clear_and_destroy_object (&self->parser);
+  ide_clear_and_destroy_object (&self->validator);
 
-  G_OBJECT_CLASS (ide_xml_tree_builder_parent_class)->finalize (object);
+  IDE_OBJECT_CLASS (ide_xml_tree_builder_parent_class)->destroy (object);
 }
 
 static void
-ide_xml_tree_builder_constructed (GObject *object)
+ide_xml_tree_builder_parent_set (IdeObject *object,
+                                 IdeObject *parent)
 {
   IdeXmlTreeBuilder *self = (IdeXmlTreeBuilder *)object;
   IdeContext *context;
 
-  G_OBJECT_CLASS (ide_xml_tree_builder_parent_class)->constructed (object);
+  g_assert (IDE_IS_XML_TREE_BUILDER (self));
+  g_assert (!parent || IDE_IS_OBJECT (parent));
+
+  if (parent == NULL)
+    return;
 
   context = ide_object_get_context (IDE_OBJECT (self));
   g_assert (IDE_IS_CONTEXT (context));
 
   self->parser = g_object_new (IDE_TYPE_XML_PARSER,
-                               "context", context,
+                               "parent", self,
                                NULL);
-  self->validator = ide_xml_validator_new (context);
+  self->validator = g_object_new (IDE_TYPE_XML_VALIDATOR,
+                                  "parent", self,
+                                  NULL);
 }
 
 static void
 ide_xml_tree_builder_class_init (IdeXmlTreeBuilderClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  IdeObjectClass *i_object_class = IDE_OBJECT_CLASS (klass);
 
-  object_class->constructed = ide_xml_tree_builder_constructed;
-  object_class->finalize = ide_xml_tree_builder_finalize;
+  i_object_class->parent_set = ide_xml_tree_builder_parent_set;
+  i_object_class->destroy = ide_xml_tree_builder_destroy;
 }
 
 static void
diff --git a/src/plugins/xml-pack/ide-xml-tree-builder.h b/src/plugins/xml-pack/ide-xml-tree-builder.h
index 94e939ce2..5f5159403 100644
--- a/src/plugins/xml-pack/ide-xml-tree-builder.h
+++ b/src/plugins/xml-pack/ide-xml-tree-builder.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-code.h>
 
 #include "ide-xml-analysis.h"
 #include "ide-xml-symbol-node.h"
diff --git a/src/plugins/xml-pack/ide-xml-validator.c b/src/plugins/xml-pack/ide-xml-validator.c
index 6fa405ac5..294b3db6e 100644
--- a/src/plugins/xml-pack/ide-xml-validator.c
+++ b/src/plugins/xml-pack/ide-xml-validator.c
@@ -66,24 +66,17 @@ create_diagnostic (IdeXmlValidator        *self,
                    xmlError               *error,
                    IdeDiagnosticSeverity   severity)
 {
-  IdeContext *context;
-  IdeDiagnostic *diagnostic;
-  g_autoptr(IdeSourceLocation) loc = NULL;
-  g_autoptr(IdeFile) ifile = NULL;
+  g_autoptr(IdeLocation) loc = NULL;
   gint line;
 
   g_assert (IDE_IS_XML_VALIDATOR (self));
   g_assert (G_IS_FILE (file));
   g_assert (error != NULL);
 
-  context = ide_object_get_context (IDE_OBJECT (self));
-  ifile = ide_file_new (context, file);
-  line = (error->line > 0) ? error->line - 1 : 0;
-  loc = ide_source_location_new (ifile, line, 0, 0);
-
-  diagnostic = ide_diagnostic_new (severity, error->message, loc);
+  line = error->line - 1;
+  loc = ide_location_new (file, line, -1);
 
-  return diagnostic;
+  return ide_diagnostic_new (severity, error->message, loc);
 }
 
 static void
@@ -133,8 +126,6 @@ ide_xml_valid_warning (ValidState  *state,
  * @diagnostics: (out) (nullable): a location to store a #IdeDiagnostics object
  *
  * Returns: %TRUE if the validation succeeded, %FALSE otherwise
- *
- * Since: 3.32
  */
 gboolean
 ide_xml_validator_validate (IdeXmlValidator   *self,
@@ -205,11 +196,10 @@ ide_xml_validator_validate (IdeXmlValidator   *self,
 
 end:
   if (diagnostics != NULL)
-    *diagnostics = ide_diagnostics_new (IDE_PTR_ARRAY_STEAL_FULL (&self->diagnostics_array));
-  else
-    g_clear_pointer (&self->diagnostics_array, g_ptr_array_unref);
+    *diagnostics = ide_diagnostics_new_from_array (self->diagnostics_array);
 
-  self->diagnostics_array = g_ptr_array_new_with_free_func ((GDestroyNotify)ide_diagnostic_unref);
+  g_clear_pointer (&self->diagnostics_array, g_ptr_array_unref);
+  self->diagnostics_array = g_ptr_array_new_with_free_func (g_object_unref);
 
   return ret;
 }
@@ -266,14 +256,6 @@ ide_xml_validator_set_schema (IdeXmlValidator  *self,
   return ret;
 }
 
-IdeXmlValidator *
-ide_xml_validator_new (IdeContext *context)
-{
-  return g_object_new (IDE_TYPE_XML_VALIDATOR,
-                       "context", context,
-                       NULL);
-}
-
 static void
 ide_xml_validator_finalize (GObject *object)
 {
@@ -298,5 +280,5 @@ ide_xml_validator_class_init (IdeXmlValidatorClass *klass)
 static void
 ide_xml_validator_init (IdeXmlValidator *self)
 {
-  self->diagnostics_array = g_ptr_array_new_with_free_func ((GDestroyNotify)ide_diagnostic_unref);
+  self->diagnostics_array = g_ptr_array_new_with_free_func (g_object_unref);
 }
diff --git a/src/plugins/xml-pack/ide-xml-validator.h b/src/plugins/xml-pack/ide-xml-validator.h
index c03db96a2..d4d967c94 100644
--- a/src/plugins/xml-pack/ide-xml-validator.h
+++ b/src/plugins/xml-pack/ide-xml-validator.h
@@ -23,7 +23,7 @@
 #include <glib-object.h>
 #include <libxml/parser.h>
 
-#include <ide.h>
+#include <libide-code.h>
 #include "ide-xml-schema-cache-entry.h"
 
 G_BEGIN_DECLS
@@ -32,7 +32,6 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IdeXmlValidator, ide_xml_validator, IDE, XML_VALIDATOR, IdeObject)
 
-IdeXmlValidator       *ide_xml_validator_new        (IdeContext       *context);
 IdeXmlSchemaKind       ide_xml_validator_get_kind   (IdeXmlValidator  *self);
 gboolean               ide_xml_validator_set_schema (IdeXmlValidator  *self,
                                                      IdeXmlSchemaKind  kind,
diff --git a/src/plugins/xml-pack/meson.build b/src/plugins/xml-pack/meson.build
index 5ae92897d..9338eae07 100644
--- a/src/plugins/xml-pack/meson.build
+++ b/src/plugins/xml-pack/meson.build
@@ -1,12 +1,6 @@
-if get_option('with_xml_pack')
+if get_option('plugin_xml_pack')
 
-xml_pack_resources = gnome.compile_resources(
-  'xml-pack-resources',
-  'xml-pack.gresource.xml',
-  c_name: 'ide_xml'
-)
-
-xml_pack_sources = [
+plugins_sources += files([
   'ide-xml-analysis.c',
   'ide-xml-completion-attributes.c',
   'ide-xml-completion-values.c',
@@ -38,9 +32,14 @@ xml_pack_sources = [
   'ide-xml-validator.c',
   'ide-xml.c',
   'xml-pack-plugin.c',
-]
+])
+
+plugin_xml_pack_resources = gnome.compile_resources(
+  'gbp-xml-pack-resources',
+  'xml-pack.gresource.xml',
+  c_name: 'gbp_xml_pack',
+)
 
-gnome_builder_plugins_sources += files(xml_pack_sources)
-gnome_builder_plugins_sources += xml_pack_resources[0]
+plugins_sources += plugin_xml_pack_resources[0]
 
 endif
diff --git a/src/plugins/xml-pack/xml-pack-plugin.c b/src/plugins/xml-pack/xml-pack-plugin.c
index 248981ecb..d2c8fb037 100644
--- a/src/plugins/xml-pack/xml-pack-plugin.c
+++ b/src/plugins/xml-pack/xml-pack-plugin.c
@@ -18,22 +18,34 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include "config.h"
+
 #include <libpeas/peas.h>
+#include <libide-code.h>
+#include <libide-sourceview.h>
 
 #include "ide-xml-completion-provider.h"
 #include "ide-xml-diagnostic-provider.h"
 #include "ide-xml-highlighter.h"
 #include "ide-xml-indenter.h"
-#include "ide-xml-service.h"
 #include "ide-xml-symbol-resolver.h"
 
-void
-ide_xml_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_ide_xml_register_types (PeasObjectModule *module)
 {
-  peas_object_module_register_extension_type (module, IDE_TYPE_COMPLETION_PROVIDER, 
IDE_TYPE_XML_COMPLETION_PROVIDER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_DIAGNOSTIC_PROVIDER, 
IDE_TYPE_XML_DIAGNOSTIC_PROVIDER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_HIGHLIGHTER, IDE_TYPE_XML_HIGHLIGHTER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_INDENTER, IDE_TYPE_XML_INDENTER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_SYMBOL_RESOLVER, 
IDE_TYPE_XML_SYMBOL_RESOLVER);
-  peas_object_module_register_extension_type (module, IDE_TYPE_SERVICE, IDE_TYPE_XML_SERVICE);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_COMPLETION_PROVIDER,
+                                              IDE_TYPE_XML_COMPLETION_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_DIAGNOSTIC_PROVIDER,
+                                              IDE_TYPE_XML_DIAGNOSTIC_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_HIGHLIGHTER,
+                                              IDE_TYPE_XML_HIGHLIGHTER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_INDENTER,
+                                              IDE_TYPE_XML_INDENTER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_SYMBOL_RESOLVER,
+                                              IDE_TYPE_XML_SYMBOL_RESOLVER);
 }
diff --git a/src/plugins/xml-pack/xml-pack.gresource.xml b/src/plugins/xml-pack/xml-pack.gresource.xml
index 510405d94..e54ca183d 100644
--- a/src/plugins/xml-pack/xml-pack.gresource.xml
+++ b/src/plugins/xml-pack/xml-pack.gresource.xml
@@ -1,9 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/xml-pack">
     <file>xml-pack.plugin</file>
-  </gresource>
-  <gresource prefix="/org/gnome/builder/plugins/xml-pack-plugin">
     <file>schemas/gtkbuilder.rng</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/xml-pack/xml-pack.plugin b/src/plugins/xml-pack/xml-pack.plugin
index 0b5530d7d..2a5e3d1f0 100644
--- a/src/plugins/xml-pack/xml-pack.plugin
+++ b/src/plugins/xml-pack/xml-pack.plugin
@@ -1,18 +1,18 @@
 [Plugin]
-Module=xml-pack-plugin
-Name=XML Auto-Indenter, completion, highlighter, resolver, diagnostics
-Description=Provides language support features for XML
 Authors=Christian Hergert <christian hergert me>
-Copyright=Copyright © 2015 Christian Hergert
 Builtin=true
-X-Indenter-Languages=xml,html
+Copyright=Copyright © 2015-2018 Christian Hergert
+Description=Provides language support features for XML
+Embedded=_ide_xml_register_types
+Module=xml-pack
+Name=XML Auto-Indenter, completion, highlighter, resolver, diagnostics
+X-Completion-Provider-Languages-Priority=0
+X-Completion-Provider-Languages=xml,html
+X-Diagnostic-Provider-Languages-Priority=0
+X-Diagnostic-Provider-Languages=xml,html
+X-Highlighter-Languages-Priority=0
+X-Highlighter-Languages=xml,html
 X-Indenter-Languages-Priority=0
-X-Symbol-Resolver-Languages=xml,html
+X-Indenter-Languages=xml,html
 X-Symbol-Resolver-Languages-Priority=0
-X-Highlighter-Languages=xml,html
-X-Highlighter-Languages-Priority=0
-X-Diagnostic-Provider-Languages=xml,html
-X-Diagnostic-Provider-Languages-Priority=0
-X-Completion-Provider-Languages=xml,html
-X-Completion-Provider-Languages-Priority=0
-Embedded=ide_xml_register_types
+X-Symbol-Resolver-Languages=xml,html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]