[gnome-builder] lsp: save capabilities for future use by plugins
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] lsp: save capabilities for future use by plugins
- Date: Fri, 22 Nov 2019 22:39:16 +0000 (UTC)
commit b9bc77d7df09991760dbafb74c6b2adb955f99ff
Author: Christian Hergert <chergert redhat com>
Date: Fri Nov 22 13:09:08 2019 -0800
lsp: save capabilities for future use by plugins
src/libide/lsp/ide-lsp-client.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/lsp/ide-lsp-client.c b/src/libide/lsp/ide-lsp-client.c
index 6a698e7cd..b3578debf 100644
--- a/src/libide/lsp/ide-lsp-client.c
+++ b/src/libide/lsp/ide-lsp-client.c
@@ -43,6 +43,7 @@ typedef struct
GIOStream *io_stream;
GHashTable *diagnostics_by_file;
GPtrArray *languages;
+ GVariant *capabilities;
IdeLspTrace trace;
} IdeLspClientPrivate;
@@ -687,6 +688,7 @@ ide_lsp_client_finalize (GObject *object)
g_assert (IDE_IS_MAIN_THREAD ());
g_clear_pointer (&priv->diagnostics_by_file, g_hash_table_unref);
+ g_clear_pointer (&priv->capabilities, g_variant_unref);
g_clear_pointer (&priv->languages, g_ptr_array_unref);
g_clear_object (&priv->rpc_client);
g_clear_object (&priv->buffer_manager_signals);
@@ -927,6 +929,7 @@ ide_lsp_client_initialize_cb (GObject *object,
{
JsonrpcClient *rpc_client = (JsonrpcClient *)object;
g_autoptr(IdeLspClient) self = user_data;
+ IdeLspClientPrivate *priv = ide_lsp_client_get_instance_private (self);
g_autoptr(GVariant) reply = NULL;
g_autoptr(GVariant) initialized_param = NULL;
g_autoptr(GError) error = NULL;
@@ -946,7 +949,10 @@ ide_lsp_client_initialize_cb (GObject *object,
IDE_EXIT;
}
- /* TODO: Check for server capabilities */
+ /* Extract capabilities for future use */
+ g_clear_pointer (&priv->capabilities, g_variant_unref);
+ if (g_variant_is_of_type (reply, G_VARIANT_TYPE_VARDICT))
+ priv->capabilities = g_variant_lookup_value (reply, "capabilities", G_VARIANT_TYPE_VARDICT);
initialized_param = JSONRPC_MESSAGE_NEW ("initializedParams", "{", "}");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]