[gedit-code-assistance] Make cursor a SourceLocation



commit 63fc4b44f37fd5eccd85886d36726d0abb96bb30
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Nov 11 23:44:59 2013 +0100

    Make cursor a SourceLocation

 src/gca-backend.vala         |   14 ++++++++++++--
 src/gca-dbus.vala            |    4 ++--
 src/gca-document.vala        |    7 +++++--
 src/gca-source-location.vala |    2 +-
 src/gca-source-range.vala    |    2 +-
 5 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/src/gca-backend.vala b/src/gca-backend.vala
index 691dc96..6d365a8 100644
--- a/src/gca-backend.vala
+++ b/src/gca-backend.vala
@@ -184,7 +184,12 @@ class Backend : Object
                                data_path = path;
                        }
 
-                       d_service.parse.begin(path, cursor, data_path, options, (obj, res) => {
+                       var dbuscurs = DBus.SourceLocation() {
+                               line = cursor.line,
+                               column = cursor.column
+                       };
+
+                       d_service.parse.begin(path, data_path, dbuscurs, options, (obj, res) => {
                                ObjectPath ret;
 
                                try
@@ -212,7 +217,12 @@ class Backend : Object
 
                        var options = new HashTable<string, Variant>(str_hash, str_equal);
 
-                       d_project.parse_all.begin(path, cursor, docs, options, (obj, res) => {
+                       var dbuscurs = DBus.SourceLocation() {
+                               line = cursor.line,
+                               column = cursor.column
+                       };
+
+                       d_project.parse_all.begin(path, docs, dbuscurs, options, (obj, res) => {
                                DBus.RemoteDocument[] ret;
 
                                try
diff --git a/src/gca-dbus.vala b/src/gca-dbus.vala
index 2647ec5..f7c7eef 100644
--- a/src/gca-dbus.vala
+++ b/src/gca-dbus.vala
@@ -70,8 +70,8 @@ interface Introspectable : Object
 interface Service : Object
 {
        public abstract async ObjectPath parse(string                     path,
-                                              int64                      cursor,
                                               string                     data_path,
+                                              SourceLocation             cursor,
                                               HashTable<string, Variant> options) throws DBusError;
 
        public abstract async void dispose(string path) throws DBusError;
@@ -83,8 +83,8 @@ interface Project : Object
 {
        public abstract async RemoteDocument[]
        parse_all(string                     path,
-                 int64                      cursor,
                  OpenDocument[]             documents,
+                 SourceLocation             cursor,
                  HashTable<string, Variant> options) throws DBusError;
 }
 
diff --git a/src/gca-document.vala b/src/gca-document.vala
index 9e24c02..3b3a071 100644
--- a/src/gca-document.vala
+++ b/src/gca-document.vala
@@ -179,7 +179,7 @@ public class Document : Object
                get { return d_modified; }
        }
 
-       public int64 cursor
+       public SourceLocation cursor
        {
                get
                {
@@ -188,7 +188,10 @@ public class Document : Object
 
                        d_document.get_iter_at_mark(out iter, mark);
 
-                       return iter.get_offset();
+                       return SourceLocation() {
+                               line = iter.get_line() + 1,
+                               column = iter.get_line_offset() + 1
+                       };
                }
        }
 
diff --git a/src/gca-source-location.vala b/src/gca-source-location.vala
index 15b9db8..39793f5 100644
--- a/src/gca-source-location.vala
+++ b/src/gca-source-location.vala
@@ -22,7 +22,7 @@ using Gtk;
 namespace Gca
 {
 
-struct SourceLocation
+public struct SourceLocation
 {
 //     public File? file;
        public int line;
diff --git a/src/gca-source-range.vala b/src/gca-source-range.vala
index 421cf43..3fef9bb 100644
--- a/src/gca-source-range.vala
+++ b/src/gca-source-range.vala
@@ -20,7 +20,7 @@
 namespace Gca
 {
 
-struct SourceRange
+public struct SourceRange
 {
        public SourceLocation start;
        public SourceLocation end;


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