[gnome-builder] lsp: provide information via workspaceFolders



commit fa7aa04acb145323c2157e0a0be183fab4a65ea6
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 3 21:08:36 2021 -0800

    lsp: provide information via workspaceFolders
    
    This is a duplication of other information, but it seems to get things
    going further for newer LSPs.

 src/libide/lsp/ide-lsp-client.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/libide/lsp/ide-lsp-client.c b/src/libide/lsp/ide-lsp-client.c
index 1645498f7..3fd20efdf 100644
--- a/src/libide/lsp/ide-lsp-client.c
+++ b/src/libide/lsp/ide-lsp-client.c
@@ -1506,6 +1506,7 @@ ide_lsp_client_start (IdeLspClient *self)
   g_autoptr(GVariant) params = NULL;
   g_autofree gchar *root_path = NULL;
   g_autofree gchar *root_uri = NULL;
+  g_autofree gchar *basename = NULL;
   const gchar *trace_string;
   IdeContext *context;
   GFile *workdir;
@@ -1527,6 +1528,7 @@ ide_lsp_client_start (IdeLspClient *self)
 
   priv->rpc_client = jsonrpc_client_new (priv->io_stream);
 
+  basename = ide_context_dup_title (context);
   workdir = ide_context_ref_workdir (context);
   root_path = g_file_get_path (workdir);
   root_uri = g_strdup (priv->root_uri);
@@ -1559,6 +1561,12 @@ ide_lsp_client_start (IdeLspClient *self)
     "processId", JSONRPC_MESSAGE_PUT_INT64 (getpid ()),
     "rootUri", JSONRPC_MESSAGE_PUT_STRING (root_uri),
     "rootPath", JSONRPC_MESSAGE_PUT_STRING (root_path),
+    "workspaceFolders", "[",
+      "{",
+        "uri", JSONRPC_MESSAGE_PUT_STRING (root_uri),
+        "name", JSONRPC_MESSAGE_PUT_STRING (basename),
+      "}",
+    "]",
     "trace", JSONRPC_MESSAGE_PUT_STRING (trace_string),
     "capabilities", "{",
       "workspace", "{",


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