[gnome-code-assistance] [backends/sh] Fix for new architecture



commit 35280b63a64212b6bd4c0f9b957f8cb1044a8f33
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Nov 11 17:16:48 2013 +0100

    [backends/sh] Fix for new architecture

 backends/sh/__init__.py |   28 +++++++++-------------------
 1 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/backends/sh/__init__.py b/backends/sh/__init__.py
index 0f62081..5dab918 100644
--- a/backends/sh/__init__.py
+++ b/backends/sh/__init__.py
@@ -31,13 +31,12 @@ class Service(transport.Service):
 
     pattern = re.compile("^.*line ([0-9]+).*: (.*)$")
 
-    def parse(self, path, cursor, unsaved, options, doc):
-        path = self.data_path(path, unsaved)
-
-        errors = []
+    def parse(self, doc, options):
+        doc.diagnostics = []
 
         try:
-            p = subprocess.Popen(["/bin/sh", "-n", path], stdout=DEVNULL, stderr=subprocess.PIPE)
+            p = subprocess.Popen(["/bin/sh", "-n", doc.data_path], stdout=DEVNULL, stderr=subprocess.PIPE)
+
             for l in iter(p.stderr.readline, ''):
                 if not l:
                     break
@@ -45,27 +44,18 @@ class Service(transport.Service):
                 m = Service.pattern.match(l.decode())
                 if m:
                     loc = types.SourceLocation(line=m.group(1))
-                    errors.append(types.Diagnostic(severity=types.Diagnostic.Severity.ERROR,
-                                                   locations=[loc.to_range()],
-                                                    message=m.group(2)))
+
+                    doc.diagnostics.append(types.Diagnostic(severity=types.Diagnostic.Severity.ERROR,
+                                                            locations=[loc.to_range()],
+                                                            message=m.group(2)))
         except Error as e:
             pass
 
-        if doc is None:
-            doc = self.document()
-
-        doc.errors = errors
-
-        return doc
-
     def dispose(self, doc):
         pass
 
 class Document(transport.Document, transport.Diagnostics):
-    errors = None
-
-    def diagnostics(self):
-        return self.errors
+    pass
 
 def run():
     transport.Transport(Service, Document).run()


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