[gnome-builder] vala: cleanup adding a file to the index
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vala: cleanup adding a file to the index
- Date: Sat, 26 Sep 2015 08:29:57 +0000 (UTC)
commit e101c84339b81d24499c1f952b59fa03ae7e4fbc
Author: Christian Hergert <christian hergert me>
Date: Sat Sep 26 01:28:55 2015 -0700
vala: cleanup adding a file to the index
plugins/vala-pack/ide-vala-index.vala | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/plugins/vala-pack/ide-vala-index.vala b/plugins/vala-pack/ide-vala-index.vala
index d03526d..899101e 100644
--- a/plugins/vala-pack/ide-vala-index.vala
+++ b/plugins/vala-pack/ide-vala-index.vala
@@ -107,26 +107,27 @@ namespace Ide
Vala.CodeContext.pop ();
}
+ void add_file (GLib.File file)
+ {
+ var path =file.get_path ();
+ if (path == null)
+ return;
+
+ var source_file = new Ide.ValaSourceFile (this.code_context,
Vala.SourceFileType.SOURCE, path, null, false);
+ this.code_context.add_source_file (source_file);
+
+ this.source_files [file] = source_file;
+ }
+
public async void add_files (ArrayList<GLib.File> files,
GLib.Cancellable? cancellable)
{
Ide.ThreadPool.push (Ide.ThreadPoolKind.COMPILER, () => {
lock (this.code_context) {
Vala.CodeContext.push (this.code_context);
-
- foreach (var file in files) {
- var path = file.get_path ();
- if (path == null)
- continue;
-
- var source_file = new Ide.ValaSourceFile (this.code_context,
Vala.SourceFileType.SOURCE, path, null, false);
- this.code_context.add_source_file (source_file);
-
- this.source_files[file] = source_file;
- }
-
+ foreach (var file in files)
+ this.add_file (file);
Vala.CodeContext.pop ();
-
GLib.Idle.add(add_files.callback);
}
});
@@ -150,6 +151,9 @@ namespace Ide
lock (this.code_context) {
Vala.CodeContext.push (this.code_context);
+ if (!this.source_files.contains (file))
+ this.add_file (file);
+
this.apply_unsaved_files (unsaved_files_copy);
this.reparse ();
this.code_context.check ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]