[gnome-builder] lsp: add deprecated flag for LSP symbol node



commit afc033b54ce7a15c05b7e63c787811f2fa7c0e68
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 3 13:22:04 2020 -0800

    lsp: add deprecated flag for LSP symbol node

 src/libide/lsp/ide-lsp-symbol-node-private.h | 15 ++++++++-------
 src/libide/lsp/ide-lsp-symbol-node.c         | 21 +++++++++++++--------
 src/libide/lsp/ide-lsp-symbol-resolver.c     |  4 +++-
 3 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/src/libide/lsp/ide-lsp-symbol-node-private.h b/src/libide/lsp/ide-lsp-symbol-node-private.h
index b20782828..729c48178 100644
--- a/src/libide/lsp/ide-lsp-symbol-node-private.h
+++ b/src/libide/lsp/ide-lsp-symbol-node-private.h
@@ -31,12 +31,13 @@ struct _IdeLspSymbolNode
 };
 
 IdeLspSymbolNode *ide_lsp_symbol_node_new (GFile       *file,
-                                                     const gchar *name,
-                                                     const gchar *parent_name,
-                                                     gint         kind,
-                                                     guint        begin_line,
-                                                     guint        begin_column,
-                                                     guint        end_line,
-                                                     guint        end_column);
+                                           const gchar *name,
+                                           const gchar *parent_name,
+                                           gint         kind,
+                                           guint        begin_line,
+                                           guint        begin_column,
+                                           guint        end_line,
+                                           guint        end_column,
+                                           gboolean     deprecated);
 
 G_END_DECLS
diff --git a/src/libide/lsp/ide-lsp-symbol-node.c b/src/libide/lsp/ide-lsp-symbol-node.c
index 4fa7d9870..58c5e1cb1 100644
--- a/src/libide/lsp/ide-lsp-symbol-node.c
+++ b/src/libide/lsp/ide-lsp-symbol-node.c
@@ -131,23 +131,28 @@ ide_lsp_symbol_node_init (IdeLspSymbolNode *self)
 
 IdeLspSymbolNode *
 ide_lsp_symbol_node_new (GFile       *file,
-                              const gchar *name,
-                              const gchar *parent_name,
-                              gint         kind,
-                              guint        begin_line,
-                              guint        begin_column,
-                              guint        end_line,
-                              guint        end_column)
+                         const gchar *name,
+                         const gchar *parent_name,
+                         gint         kind,
+                         guint        begin_line,
+                         guint        begin_column,
+                         guint        end_line,
+                         guint        end_column,
+                         gboolean     deprecated)
 {
   IdeLspSymbolNode *self;
   IdeLspSymbolNodePrivate *priv;
+  IdeSymbolFlags flags = 0;
 
   g_return_val_if_fail (G_IS_FILE (file), NULL);
 
   kind = ide_lsp_decode_symbol_kind (kind);
 
+  if (deprecated)
+    flags |= IDE_SYMBOL_FLAGS_IS_DEPRECATED;
+
   self = g_object_new (IDE_TYPE_LSP_SYMBOL_NODE,
-                       "flags", 0,
+                       "flags", flags,
                        "kind", kind,
                        "name", name,
                        NULL);
diff --git a/src/libide/lsp/ide-lsp-symbol-resolver.c b/src/libide/lsp/ide-lsp-symbol-resolver.c
index bf1da8582..bc21a16aa 100644
--- a/src/libide/lsp/ide-lsp-symbol-resolver.c
+++ b/src/libide/lsp/ide-lsp-symbol-resolver.c
@@ -380,6 +380,7 @@ ide_lsp_symbol_resolver_document_symbol_cb (GObject      *object,
       g_autoptr(IdeLspSymbolNode) symbol = NULL;
       const gchar *name = NULL;
       const gchar *container_name = NULL;
+      gboolean deprecated = FALSE;
       gboolean success;
       gint64 kind = -1;
       struct {
@@ -411,10 +412,11 @@ ide_lsp_symbol_resolver_document_symbol_cb (GObject      *object,
 
       /* Optional fields */
       JSONRPC_MESSAGE_PARSE (node, "containerName", JSONRPC_MESSAGE_GET_STRING (&container_name));
+      JSONRPC_MESSAGE_PARSE (node, "deprecated", JSONRPC_MESSAGE_GET_BOOLEAN (&deprecated));
 
       symbol = ide_lsp_symbol_node_new (file, name, container_name, kind,
                                         begin.line, begin.column,
-                                        end.line, end.column);
+                                        end.line, end.column, deprecated);
 
       g_ptr_array_add (symbols, g_steal_pointer (&symbol));
     }


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