[gnome-builder/1351-gvls-server-is-started-even-is-there-is-not-a-vala-project] GVls: plugin starts the server at pipeline loaded



commit f8c3eea9cda75fa5fe5714eee6f24f44fd70643f
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Sun Nov 29 11:13:11 2020 -0600

    GVls: plugin starts the server at pipeline loaded

 src/plugins/gvls/gvls_plugin.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/gvls/gvls_plugin.py b/src/plugins/gvls/gvls_plugin.py
index 1c925344e..77864237f 100644
--- a/src/plugins/gvls/gvls_plugin.py
+++ b/src/plugins/gvls/gvls_plugin.py
@@ -127,7 +127,8 @@ class GVlsService(Ide.Object):
             self._supervisor = Ide.SubprocessSupervisor()
             self._supervisor.connect('spawned', self._gvls_spawned)
             self._supervisor.set_launcher(launcher)
-            self._supervisor.start()
+            Ide.debug('GVls server supervisor has been prepared')
+            #self._supervisor.start()
 
     def list_to_variant(self, l):
         b = GLib.VariantBuilder(GLib.VariantType.new('av'))
@@ -399,11 +400,19 @@ class GVlsService(Ide.Object):
                 break
         return self.create_configuration_variant()
     
+    def _on_pipeline_loaded(self, obj):
+        try:
+            Ide.debug('GVls: Pipeline loaded')
+            self._supervisor.stop()
+            self._supervisor.start()
+        except BaseException as exc:
+            Ide.debug('On Pipeline Loaded start get build flags error: {}'.format(exc.args))
+
     def _on_pipeline_diagnostic(self, obj, diagnostic):
         try:
             self.source_file = diagnostic.get_file()
         except BaseException as exc:
-            Ide.debug('On Pipeline Loaded start get build flags error: {}'.format(exc.args))
+            Ide.debug('On Pipeline diagnostics start get build flags error: {}'.format(exc.args))
 
     def on_get_vala_data_dir(self, vdp, cancellable, data):
         try:
@@ -515,8 +524,8 @@ class GVlsService(Ide.Object):
         self._client.connect('load-configuration', self._on_load_configuration)
         self.append(self._client)
         self._client.add_language('vala')
-        self._client.start()
         self.notify('client')
+        self._client.start()
         try:
             ctx = self._client.ref_context()
             self.build_system = Ide.BuildSystem.from_context (ctx)
@@ -526,6 +535,7 @@ class GVlsService(Ide.Object):
                 self.meson_build_system = False
             buildmgr = Ide.BuildManager.from_context (ctx)
             self.pipeline = buildmgr.get_pipeline ()
+            self.pipeline.connect('loaded', self._on_pipeline_loaded)
             self.pipeline.connect('diagnostic', self._on_pipeline_diagnostic)
             cfgmgr = Ide.ConfigManager.from_context(ctx)
             cfgmgr.connect('notify::current', self.on_config_changed_cb)
@@ -551,10 +561,6 @@ class GVlsService(Ide.Object):
 
     @classmethod
     def bind_client(klass, provider):
-        """
-        This helper tracks changes to our client as it might happen when
-        our `org.gnome.gvls.Server` process has crashed.
-        """
         context = provider.get_context()
         self = GVlsService.from_context(context)
         self._ensure_started()


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