[gnome-builder] vala: ues project working directory as basedir for vala code context



commit 25e72ff7cec8215fb7aaa9c00d5d2c2323a624a5
Author: Christian Hergert <chergert redhat com>
Date:   Sun Apr 17 07:18:51 2016 -0700

    vala: ues project working directory as basedir for vala code context
    
    This should help with relative paths that we somehow might have missed
    translating.

 plugins/vala-pack/ide-vala-index.vala   |    9 +++++++--
 plugins/vala-pack/ide-vala-service.vala |    3 ++-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/plugins/vala-pack/ide-vala-index.vala b/plugins/vala-pack/ide-vala-index.vala
index 73b88d6..ede43f2 100644
--- a/plugins/vala-pack/ide-vala-index.vala
+++ b/plugins/vala-pack/ide-vala-index.vala
@@ -33,15 +33,20 @@ namespace Ide
 {
        public class ValaIndex: GLib.Object
        {
+               Ide.Context context;
                Vala.CodeContext code_context;
                Vala.Parser parser;
                HashMap<GLib.File,Ide.ValaSourceFile> source_files;
                Ide.ValaDiagnostics report;
 
-               public ValaIndex ()
+               public ValaIndex (Ide.Context context)
                {
+                       var vcs = context.get_vcs();
+                       var workdir = vcs.get_working_directory();
+
                        this.source_files = new HashMap<GLib.File,Ide.ValaSourceFile> (GLib.File.hash, 
(GLib.EqualFunc)GLib.File.equal);
 
+                       this.context = context;
                        this.code_context = new Vala.CodeContext ();
 
                        Vala.CodeContext.push (this.code_context);
@@ -65,7 +70,7 @@ namespace Ide
                        this.code_context.compile_only = true;
                        this.code_context.use_header = false;
                        this.code_context.includedir = null;
-                       this.code_context.basedir = GLib.Environment.get_current_dir ();
+                       this.code_context.basedir = workdir.get_path ();
                        this.code_context.directory = GLib.Environment.get_current_dir ();
                        this.code_context.debug = false;
                        this.code_context.thread = true;
diff --git a/plugins/vala-pack/ide-vala-service.vala b/plugins/vala-pack/ide-vala-service.vala
index 8bba1c0..e05f1cc 100644
--- a/plugins/vala-pack/ide-vala-service.vala
+++ b/plugins/vala-pack/ide-vala-service.vala
@@ -27,7 +27,6 @@ namespace Ide
                Ide.ValaIndex _index;
 
                construct {
-                       this._index = new Ide.ValaIndex ();
                }
 
                public ValaIndex index {
@@ -39,6 +38,8 @@ namespace Ide
                }
 
                public void start () {
+                       this._index = new Ide.ValaIndex (this.get_context ());
+
                        Ide.ThreadPool.push (Ide.ThreadPoolKind.INDEXER, () => {
                                Ide.Vcs vcs = this.get_context ().get_vcs ();
                                var files = new ArrayList<GLib.File> ();


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