[gnome-code-assistance/wip/completion] Add CompletionTriggers method



commit adf6dc616c8a779a60f2290e02bb34800d1212b0
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Jan 12 09:11:32 2015 +0100

    Add CompletionTriggers method

 backends/c/service.py                              |    3 +++
 .../gnome/codeassistance/transport_dbus.py         |   11 +++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/backends/c/service.py b/backends/c/service.py
index 8c16a99..11401fc 100644
--- a/backends/c/service.py
+++ b/backends/c/service.py
@@ -159,6 +159,9 @@ class Service(transport.Service, transport.Project,
 
         return items
 
+    def completion_triggers(self):
+        return ['.', '->', '#']
+
     def complete_all(self, doc, docs, options):
         unsaved = [(d.path, open(d.data_path, 'rb')) for d in docs if d.data_path != d.path]
         return self._complete(doc, docs, unsaved, options)
diff --git a/backends/pycommon/gnome/codeassistance/transport_dbus.py 
b/backends/pycommon/gnome/codeassistance/transport_dbus.py
index eceb92e..556c046 100644
--- a/backends/pycommon/gnome/codeassistance/transport_dbus.py
+++ b/backends/pycommon/gnome/codeassistance/transport_dbus.py
@@ -141,6 +141,10 @@ class Completion:
         """
         pass
 
+    def completion_triggers(self):
+        """return a list of triggers that activate completion."""
+        pass
+
 class ProjectCompletion:
     def complete_all(self, doc, docs, options):
         """compute completions at the cursor of a document.
@@ -314,6 +318,13 @@ class ServeCompletion(dbus.service.Object):
 
         return [x.to_tuple() for x in app.service.complete(doc, options)]
 
+    @dbus.service.method('org.gnome.CodeAssist.v1.Completion',
+                         in_signature='', out_signature='as',
+                         sender_keyword='sender')
+    def CompletionTriggers(self, sender=None):
+        app = self.ensure_app(sender)
+        return app.service.completion_triggers()
+
 class ServeProjectCompletion(dbus.service.Object):
     @dbus.service.method('org.gnome.CodeAssist.v1.ProjectCompletion',
                          in_signature='sa(ss)(xx)a{sv}', out_signature='a' + types.Completion.signature,


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