[gnome-builder/1200-gvls-provide-meson-build-commands: 10/10] GVls: provide meson build commands
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/1200-gvls-provide-meson-build-commands: 10/10] GVls: provide meson build commands
- Date: Mon, 11 May 2020 23:23:34 +0000 (UTC)
commit 9830cb54933ab43ce07f268d5d4185bd32b487ed
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date: Tue May 5 00:04:44 2020 -0500
GVls: provide meson build commands
Fix issue #1200
src/plugins/gvls/gvls_plugin.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/gvls/gvls_plugin.py b/src/plugins/gvls/gvls_plugin.py
index 1311109ef..1ff1557fc 100644
--- a/src/plugins/gvls/gvls_plugin.py
+++ b/src/plugins/gvls/gvls_plugin.py
@@ -55,6 +55,7 @@ class GVlsService(Ide.Object):
ide_config = None
source_file = None
build_monitor = None
+ meson_compile_commands = ""
@classmethod
def from_context(klass, context):
@@ -174,6 +175,7 @@ class GVlsService(Ide.Object):
b.add_value(self.create_dict_entry_string('libraryVapi', self.library_vapidir))
b.add_value(self.create_dict_entry_string('systemVapi', self.system_vapidir))
b.add_value(self.create_dict_entry_string('valaApiVersion', self.vala_api_version))
+ b.add_value(self.create_dict_entry_string('mesonCompileCommands', self.meson_compile_commands))
ad = GLib.Variant.new_string ('valaArgs')
vadi = self.dict_to_array_variant(self.vala_args)
adi = GLib.Variant.new_dict_entry(ad, GLib.Variant.new_variant (vadi))
@@ -201,7 +203,13 @@ class GVlsService(Ide.Object):
self._notify_change_configuration()
if event_type == Gio.FileMonitorEvent.DELETED:
self.build_monitor = None
-
+
+ def read_meson_compile_commands(self, file):
+ ostream = Gio.MemoryOutputStream.new_resizable()
+ ostream.splice(file.read(), Gio.OutputStreamSpliceFlags.CLOSE_SOURCE, None)
+ ostream.close()
+ b = ostream.steal_as_bytes()
+ self.meson_compile_commands = str(b.get_data(),encoding='utf8')
def _parse_build_commands(self):
try:
@@ -214,6 +222,9 @@ class GVlsService(Ide.Object):
bcdir = Gio.File.new_for_path(self.pipeline.get_builddir())
if self.meson_build_system:
bcf = Gio.File.new_for_uri(bcdir.get_uri()+'/compile_commands.json')
+ if not bcf.query_exists(None):
+ return
+ self.read_meson_compile_commands(bcf)
if self.build_monitor == None:
self.build_monitor = bcf.monitor(Gio.FileMonitorFlags.NONE, None)
self.build_monitor.connect('changed', self._build_config_changed)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]