[gnome-builder] libide/lsp: Add lsp-inherit-stderr property to inherit stderr from language servers



commit b7dfe3c702aaef465670fb7f3aca6a8526ca2d8d
Author: JCWasmx86 <JCWasmx86 t-online de>
Date:   Thu Oct 6 07:14:32 2022 +0200

    libide/lsp: Add lsp-inherit-stderr property to inherit stderr from language servers

 data/gsettings/org.gnome.builder.gschema.xml |  5 +++++
 src/libide/lsp/ide-lsp-service.c             |  4 +++-
 src/plugins/buildui/tweaks.ui                | 12 ++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/data/gsettings/org.gnome.builder.gschema.xml b/data/gsettings/org.gnome.builder.gschema.xml
index a1418fadb..0260cf372 100644
--- a/data/gsettings/org.gnome.builder.gschema.xml
+++ b/data/gsettings/org.gnome.builder.gschema.xml
@@ -64,5 +64,10 @@
       <summary>Default License</summary>
       <description>The default license to use for new projects</description>
     </key>
+    <key name="lsp-inherit-stderr" type="b">
+      <default>false</default>
+      <summary>Inherit Language Server stderr</summary>
+      <description>If enabled, stderr of language servers will be redirected to the console.</description>
+    </key>
   </schema>
 </schemalist>
diff --git a/src/libide/lsp/ide-lsp-service.c b/src/libide/lsp/ide-lsp-service.c
index 9bc44b9b5..4c013bda6 100644
--- a/src/libide/lsp/ide-lsp-service.c
+++ b/src/libide/lsp/ide-lsp-service.c
@@ -564,6 +564,7 @@ ensure_started (IdeLspService *self,
   IdeLspServicePrivate *priv = ide_lsp_service_get_instance_private (self);
   g_autoptr(IdeSubprocessLauncher) launcher = NULL;
   g_autoptr(IdeSubprocessSupervisor) supervisor = NULL;
+  g_autoptr(GSettings) settings = NULL;
   IdeBuildManager *build_manager;
   IdeLspServiceClass *klass;
   IdePipeline *pipeline = NULL;
@@ -584,13 +585,14 @@ ensure_started (IdeLspService *self,
   klass = IDE_LSP_SERVICE_GET_CLASS (self);
   build_manager = ide_build_manager_from_context (context);
   pipeline = ide_build_manager_get_pipeline (build_manager);
+  settings = g_settings_new ("org.gnome.builder");
 
   /* Delay until pipeline is ready */
   if (!ide_pipeline_is_ready (pipeline))
     IDE_EXIT;
 
   flags = G_SUBPROCESS_FLAGS_STDIN_PIPE | G_SUBPROCESS_FLAGS_STDOUT_PIPE;
-  if (!priv->inherit_stderr)
+  if (!priv->inherit_stderr && !g_settings_get_boolean (settings, "lsp-inherit-stderr"))
     flags |= G_SUBPROCESS_FLAGS_STDERR_SILENCE;
 
   /* Allow subclasses to control launcher creation */
diff --git a/src/plugins/buildui/tweaks.ui b/src/plugins/buildui/tweaks.ui
index f4b48b455..8d04ec3b7 100644
--- a/src/plugins/buildui/tweaks.ui
+++ b/src/plugins/buildui/tweaks.ui
@@ -140,6 +140,18 @@
                     </property>
                   </object>
                 </child>
+                <child>
+                  <object class="IdeTweaksSwitch">
+                    <property name="title" translatable="yes">Inherit Language Server stderr</property>
+                    <property name="subtitle" translatable="yes">If enabled, stderr of language servers will 
be redirected to the console.</property>
+                    <property name="binding">
+                      <object class="IdeTweaksSetting">
+                        <property name="schema-id">org.gnome.builder</property>
+                        <property name="schema-key">lsp-inherit-stderr</property>
+                      </object>
+                    </property>
+                  </object>
+                </child>
               </object>
             </child>
             <child>


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