[gnome-builder] libide/lsp: handle workspace/configuration fallback more gracefully



commit a0a19314af04ba39e9fcbd7b04d5b975f631ff02
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 6 16:47:37 2022 -0700

    libide/lsp: handle workspace/configuration fallback more gracefully
    
    This should be sending an [LSPAny?] back, so do that if we fail to load
    a configuration from the subclass/etc.
    
    This really needs to change going forward though, as the clients are
    expected to reply to various requests in the params, and we are not
    providing those when emitting the signal.

 src/libide/lsp/ide-lsp-client.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/lsp/ide-lsp-client.c b/src/libide/lsp/ide-lsp-client.c
index 8ee205b77..357cf2d38 100644
--- a/src/libide/lsp/ide-lsp-client.c
+++ b/src/libide/lsp/ide-lsp-client.c
@@ -1090,18 +1090,26 @@ ide_lsp_client_handle_call (IdeLspClient  *self,
     {
       g_autoptr(GVariant) config = NULL;
 
+      /* TODO: Subclasses will really need the params to be able to handle
+       *       workspace/configuration correctly.
+       */
+
       g_signal_emit (self, signals [LOAD_CONFIGURATION], 0, &config);
 
-      if (config != NULL)
+      if (config == NULL)
         {
-          /* Ensure we didn't get anything floating */
-          g_variant_take_ref (config);
+          GVariantBuilder builder;
 
-          jsonrpc_client_reply_async (client, id, config, NULL, NULL, NULL);
-          IDE_RETURN (TRUE);
+          g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}"));
+          config = g_variant_builder_end (&builder);
         }
 
-      g_debug ("No configuration provided, ignoring \"workspace/configuration\" request");
+      /* Ensure we didn't get anything floating */
+      g_variant_take_ref (config);
+
+      jsonrpc_client_reply_async (client, id, config, NULL, NULL, NULL);
+
+      IDE_RETURN (TRUE);
     }
   else if (strcmp (method, "workspace/applyEdit") == 0)
     {


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