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



commit 8f3fb838399e34312cc6430ac484761bad8cf1bd
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sun Nov 10 15:25:07 2013 +0100

    [backends/python] Fix for new architecture

 backends/python/__init__.py |   28 ++++++----------------------
 1 files changed, 6 insertions(+), 22 deletions(-)
---
diff --git a/backends/python/__init__.py b/backends/python/__init__.py
index 76dfee5..f4d5634 100644
--- a/backends/python/__init__.py
+++ b/backends/python/__init__.py
@@ -22,38 +22,22 @@ from gnome.codeassistance import transport, types
 class Service(transport.Service):
     language = 'python'
 
-    def parse(self, path, cursor, unsaved, options, doc):
-        path = self.data_path(path, unsaved)
-
-        errors = []
-        ret = None
+    def parse(self, doc, options):
+        doc.diagnostics = []
 
         try:
-            with open(path) as f:
+            with open(doc.data_path) as f:
                 source = f.read()
 
-            ret = ast.parse(source, path)
+            ast.parse(source, doc.path)
         except SyntaxError as e:
             loc = types.SourceLocation(line=e.lineno, column=e.offset)
             severity = types.Diagnostic.Severity.ERROR
 
-            errors = [types.Diagnostic(severity=severity, locations=[loc.to_range()], message=e.msg)]
-
-        if doc is None:
-            doc = self.document()
-
-        doc.errors = errors
-
-        return doc
-
-    def dispose(self, doc):
-        pass
+            doc.diagnostics = [types.Diagnostic(severity=severity, locations=[loc.to_range()], 
message=e.msg)]
 
 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]