[gnome-builder] lsp: connect to notifications sooner



commit 0e9687b7a97162e0b45829357ad178cd53b71a18
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 22 10:55:03 2019 -0800

    lsp: connect to notifications sooner
    
    We might get messages immediately, so try to handle them more gracefully.

 src/libide/lsp/ide-lsp-client.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/src/libide/lsp/ide-lsp-client.c b/src/libide/lsp/ide-lsp-client.c
index 4e2e738f8..8a04f9800 100644
--- a/src/libide/lsp/ide-lsp-client.c
+++ b/src/libide/lsp/ide-lsp-client.c
@@ -926,21 +926,6 @@ ide_lsp_client_initialize_cb (GObject      *object,
       IDE_EXIT;
     }
 
-  /*
-   * Now that we are connected and have initialized the peer, setup our
-   * buffer_manager and project signals so that we can notify the peer
-   * of open documents and such.
-   *
-   * We connect this before sending initialized because we don't want
-   * to lose any possible messages in-between the async calls.
-   */
-
-  g_signal_connect_object (rpc_client,
-                           "notification",
-                           G_CALLBACK (ide_lsp_client_send_notification),
-                           self,
-                           G_CONNECT_SWAPPED);
-
   /* TODO: Check for server capabilities */
 
   initialized_param = JSONRPC_MESSAGE_NEW ("initializedParams", "{", "}");
@@ -1009,6 +994,16 @@ ide_lsp_client_start (IdeLspClient *self)
     "capabilities", "{", "}"
   );
 
+  /*
+   * We connect this before sending initialized because we don't want
+   * to lose any possible messages in-between the async calls.
+   */
+  g_signal_connect_object (priv->rpc_client,
+                           "notification",
+                           G_CALLBACK (ide_lsp_client_send_notification),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   jsonrpc_client_call_async (priv->rpc_client,
                              "initialize",
                              params,


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