[gnome-code-assistance/wip/arch] [backends/js] Fix for new architecture



commit 65c232439813f7b66bb42e85010cbe53377ca1c1
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Nov 11 16:48:58 2013 +0100

    [backends/js] Fix for new architecture

 backends/js/main.js |   33 ++++++++-------------------------
 1 files changed, 8 insertions(+), 25 deletions(-)
---
diff --git a/backends/js/main.js b/backends/js/main.js
index 53235b5..ef64f41 100644
--- a/backends/js/main.js
+++ b/backends/js/main.js
@@ -9,7 +9,7 @@ function Document() {
 
 Document.prototype = {
     _init: function() {
-        this.errors = [];
+        this.diagnostics = [];
     },
 
     'org.gnome.CodeAssist.Document': {
@@ -17,10 +17,10 @@ Document.prototype = {
 
     'org.gnome.CodeAssist.Diagnostics': {
         diagnostics: function() {
-            return this.errors;
+            return this.diagnostics;
         }
     }
-}
+};
 
 function Service() {
     this._init();
@@ -31,26 +31,11 @@ Service.prototype = {
     
     },
 
-    _data_path: function(path, unsaved) {
-        for (var i = 0; i < unsaved.length; i++) {
-            if (unsaved[i].path == path) {
-                return unsaved[i].data_path;
-            }
-        }
-
-        return path;
-    },
-
     'org.gnome.CodeAssist.Service': {
-        parse: function(path, cursor, unsaved, options, doc) {
-            if (doc == null) {
-                doc = new Document();
-            }
+        parse: function(doc, options) {
+            var c = GLib.file_get_contents(doc.dataPath);
 
-            var p = this._data_path(path, unsaved);
-            var c = GLib.file_get_contents(p);
-
-            doc.errors = [];
+            doc.diagnostics = [];
 
             try {
                 Acorn.parse(c[1]);
@@ -62,14 +47,12 @@ Service.prototype = {
 
                 let diag = new Types.Diagnostic({
                     severity: Types.Severity.ERROR,
-                    locations: [loc.to_range({})],
+                    locations: [loc.toRange({})],
                     message: e.message
                 });
 
-                doc.errors = [diag];
+                doc.diagnostics = [diag];
             }
-
-            return doc;
         },
 
         dispose: function(doc) {


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