Improved auto-completions and calltips for Python sources.

Sun, 25 Sep 2011 17:18:48 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 25 Sep 2011 17:18:48 +0200
changeset 32
68ef15fe34c3
parent 31
ed537ef44f85
child 33
4d89fb0f8b0e

Improved auto-completions and calltips for Python sources.

AssistantEric/APIsManager.py file | annotate | diff | comparison | revisions
AssistantEric/Assistant.py file | annotate | diff | comparison | revisions
AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html file | annotate | diff | comparison | revisions
AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html file | annotate | diff | comparison | revisions
AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.ConfigurationPages.AutoCompletionEricPage.html file | annotate | diff | comparison | revisions
AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.ConfigurationPages.CallTipsEricPage.html file | annotate | diff | comparison | revisions
AssistantEric/Documentation/source/Plugin_Assistant_Eric.PluginAssistantEric.html file | annotate | diff | comparison | revisions
ChangeLog file | annotate | diff | comparison | revisions
PluginAssistantEric.py file | annotate | diff | comparison | revisions
--- a/AssistantEric/APIsManager.py	Sat Jul 30 10:55:32 2011 +0200
+++ b/AssistantEric/APIsManager.py	Sun Sep 25 17:18:48 2011 +0200
@@ -397,6 +397,11 @@
         WHERE context = :context
         ORDER BY acWord
     """
+    ac_context_word_stmt = """
+        SELECT DISTINCT acWord, fullContext, pictureId FROM api
+        WHERE acWord GLOB :acWord AND context = :context
+        ORDER BY acWord
+    """
     ct_stmt = """
         SELECT DISTINCT acWord, signature, fullContext FROM api
         WHERE acWord = :acWord
@@ -606,7 +611,12 @@
             try:
                 query = None
                 
-                if start is not None:
+                if start is not None and context is not None:
+                    query = QSqlQuery(db)
+                    query.prepare(self.ac_context_word_stmt)
+                    query.bindValue(":acWord", start + '*')
+                    query.bindValue(":context", context)
+                elif start is not None:
                     query = QSqlQuery(db)
                     query.prepare(self.ac_stmt)
                     query.bindValue(":acWord", start + '*')
--- a/AssistantEric/Assistant.py	Sat Jul 30 10:55:32 2011 +0200
+++ b/AssistantEric/Assistant.py	Sun Sep 25 17:18:48 2011 +0200
@@ -9,6 +9,7 @@
 """
 
 import re
+import imp
 
 from PyQt4.QtCore import QRegExp, QObject
 
@@ -19,6 +20,7 @@
 from QScintilla.Editor import Editor
 
 import Preferences
+from Utilities.ModuleParser import Module
 
 AcsAPIs = 0x0001
 AcsDocument = 0x0002
@@ -250,6 +252,7 @@
         sep = ""
         if context:
             wc = re.sub("\w", "", editor.wordCharacters())
+            pat = re.compile("\w{0}".format(re.escape(wc)))
             text = editor.text(line)
             
             beg = text[:col]
@@ -260,8 +263,7 @@
             
             depth = 0
             while col > 0 and \
-                  (not text[col - 1].isalnum() or \
-                   (wc and text[col - 1] not in wc)):
+                  not pat.match(text[col - 1]):
                 ch = text[col - 1]
                 if ch == ')':
                     depth = 1
@@ -288,18 +290,45 @@
         else:
             self.__lastContext = None
         
+        prefix = ""
+        mod = None
+        if context:
+            beg = beg[:col + 1]
+        else:
+            beg = editor.text(line)[:col]
+        col = len(beg)
+        wsep = editor.getLexer().autoCompletionWordSeparators()
+        if wsep:
+            if beg[col - 1] in wsep:
+                col -= 1
+            else:
+                while col >= 0 and beg[col - 1] not in wsep:
+                    col -= 1
+                if col >= 0:
+                    col -= 1
+            prefix = editor.getWordLeft(line, col)
+            if editor.isPy2File() or editor.isPy3File():
+                src = editor.text()
+                fn = editor.getFileName()
+                if fn is None:
+                    fn = ""
+                mod = Module("", fn, imp.PY_SOURCE)
+                mod.scan(src)
+        
         if word:
             if self.__plugin.getPreferences("AutoCompletionSource") & AcsAPIs:
                 api = self.__apisManager.getAPIs(language)
-                apiCompletionsList = self.__getApiCompletions(api, word, context)
+                apiCompletionsList = self.__getApiCompletions(
+                    api, word, context, prefix, mod, editor)
             
             if self.__plugin.getPreferences("AutoCompletionSource") & AcsProject:
                 api = self.__apisManager.getAPIs(ApisNameProject)
-                projectCompletionList = self.__getApiCompletions(api, word, context)
+                projectCompletionList = self.__getApiCompletions(
+                    api, word, context, prefix, mod, editor)
             
             if self.__plugin.getPreferences("AutoCompletionSource") & AcsDocument:
-                docCompletionsList = \
-                    self.getCompletionsFromDocument(editor, word, context, sep)
+                docCompletionsList = self.getCompletionsFromDocument(
+                    editor, word, context, sep, prefix, mod)
             
             completionsList = list(
                 set(apiCompletionsList)
@@ -311,18 +340,59 @@
                 completionsList.sort()
                 editor.showUserList(EditorAutoCompletionListID, completionsList)
 
-    def __getApiCompletions(self, api, word, context):
+    def __getApiCompletions(self, api, word, context, prefix, module, editor):
         """
         Private method to determine a list of completions from an API object.
         
         @param api reference to the API object to be used (APIsManager.DbAPIs)
         @param word word (or wordpart) to complete (string)
         @param context flag indicating to autocomplete a context (boolean)
+        @param prefix prefix of the word to be completed (string)
+        @param module reference to the scanned module info (Module)
+        @param editor reference to the editor object (QScintilla.Editor)
         @return list of possible completions (list of strings)
         """
         completionsList = []
         if api is not None:
-            if context:
+            if prefix and module and prefix == "self":
+                line, col = editor.getCursorPosition()
+                for cl in module.classes.values():
+                    if line >= cl.lineno and \
+                       (cl.endlineno == -1 or line <= cl.endlineno):
+                        completions = []
+                        for super in cl.super:
+                            if prefix == word:
+                                completions.extend(
+                                    api.getCompletions(context=super))
+                            else:
+                                completions.extend(
+                                    api.getCompletions(start=word, context=super))
+                        for completion in completions:
+                            if not completion["context"]:
+                                entry = completion["completion"]
+                            else:
+                                entry = "{0} ({1})".format(
+                                    completion["completion"],
+                                    completion["context"]
+                                )
+                                if entry in completionsList:
+                                    completionsList.remove(entry)
+                            if completion["pictureId"]:
+                                entry += "?{0}".format(completion["pictureId"])
+                            else:
+                                cont = False
+                                re = QRegExp(QRegExp.escape(entry) + "\?\d{,2}")
+                                for comp in completionsList:
+                                    if re.exactMatch(comp):
+                                        cont = True
+                                        break
+                                if cont:
+                                    continue
+                            if entry not in completionsList:
+                                completionsList.append(entry)
+                        
+                        break
+            elif context:
                 completions = api.getCompletions(context=word)
                 for completion in completions:
                     entry = completion["completion"]
@@ -357,7 +427,7 @@
                         completionsList.append(entry)
         return completionsList
     
-    def getCompletionsFromDocument(self, editor, word, context, sep):
+    def getCompletionsFromDocument(self, editor, word, context, sep, prefix, module):
         """
         Public method to determine autocompletion proposals from the document.
         
@@ -365,36 +435,136 @@
         @param word string to be completed (string)
         @param context flag indicating to autocomplete a context (boolean)
         @param sep separator string (string)
+        @param prefix prefix of the word to be completed (string)
+        @param module reference to the scanned module info (Module)
         @return list of possible completions (list of strings)
         """
-        currentPos = editor.currentPosition()
         completionsList = []
-        if context:
-            word += sep
         
-        if editor.isUtf8():
-            sword = word.encode("utf-8")
-        else:
-            sword = word
-        res = editor.findFirstTarget(sword, False,
-            editor.autoCompletionCaseSensitivity(),
-            False, begline=0, begindex=0, ws_=True)
-        while res:
-            start, length = editor.getFoundTarget()
-            pos = start + length
-            if pos != currentPos:
-                if context:
-                    completion = ""
-                else:
-                    completion = word
-                line, index = editor.lineIndexFromPosition(pos)
-                curWord = editor.getWord(line, index, useWordChars=False)
-                completion += curWord[len(completion):]
-                if completion and completion not in completionsList:
-                    completionsList.append(
-                        "{0}?{1}".format(completion, self.__fromDocumentID))
+        prefixFound = False
+        if prefix and module:
+            line, col = editor.getCursorPosition()
+            if prefix in ["cls", "self"]:
+                prefixFound = True
+                for cl in module.classes.values():
+                    if line >= cl.lineno and \
+                       (cl.endlineno == -1 or line <= cl.endlineno):
+                        comps = []
+                        for method in cl.methods.values():
+                            if method.name == "__init__":
+                                continue
+                            # determine icon type
+                            if method.isPrivate():
+                                iconID = Editor.MethodPrivateID
+                            elif method.isProtected():
+                                iconID = Editor.MethodProtectedID
+                            else:
+                                iconID = Editor.MethodID
+                            if hasattr(method, "modifier"):
+                                if (prefix == "cls" and \
+                                    method.modifier == method.Class) or \
+                                   prefix == "self":
+                                    comps.append((method.name, iconID))
+                            else:
+                                # eric 5.1 cannot differentiate method types
+                                comps.append((method.name, iconID))
+                        if prefix != "cls":
+                            for attribute in cl.attributes.values():
+                                # determine icon type
+                                if attribute.isPrivate():
+                                    iconID = Editor.AttributePrivateID
+                                elif attribute.isProtected():
+                                    iconID = Editor.AttributeProtectedID
+                                else:
+                                    iconID = Editor.AttributePrivateID
+                                comps.append((attribute.name, iconID))
+                        for attribute in cl.globals.values():
+                            # determine icon type
+                            if attribute.isPrivate():
+                                iconID = Editor.AttributePrivateID
+                            elif attribute.isProtected():
+                                iconID = Editor.AttributeProtectedID
+                            else:
+                                iconID = Editor.AttributePrivateID
+                            comps.append((attribute.name, iconID))
+                        
+                        if word != prefix:
+                            completionsList.extend(
+                                ["{0}?{1}".format(c[0], c[1])
+                                 for c in comps if c[0].startswith(word)])
+                        else:
+                            completionsList.extend(
+                                ["{0}?{1}".format(c[0], c[1])
+                                 for c in comps])
+                        break
+            else:
+                # possibly completing a named class attribute or method
+                if prefix in module.classes:
+                    prefixFound = True
+                    cl = module.classes[prefix]
+                    comps = []
+                    for method in cl.methods.values():
+                        if method.name == "__init__":
+                            continue
+                        if not hasattr(method, "modifier"):
+                            # eric 5.1 cannot differentiate method types
+                            continue
+                        if method.modifier in [method.Class, method.Static]:
+                            # determine icon type
+                            if method.isPrivate():
+                                iconID = Editor.MethodPrivateID
+                            elif method.isProtected():
+                                iconID = Editor.MethodProtectedID
+                            else:
+                                iconID = Editor.MethodID
+                            comps.append((method.name, iconID))
+                    for attribute in cl.globals.values():
+                        # determine icon type
+                        if attribute.isPrivate():
+                            iconID = Editor.AttributePrivateID
+                        elif attribute.isProtected():
+                            iconID = Editor.AttributeProtectedID
+                        else:
+                            iconID = Editor.AttributePrivateID
+                        comps.append((attribute.name, iconID))
+                    
+                    if word != prefix:
+                        completionsList.extend(
+                            ["{0}?{1}".format(c[0], c[1])
+                             for c in comps if c[0].startswith(word)])
+                    else:
+                        completionsList.extend(
+                            ["{0}?{1}".format(c[0], c[1])
+                             for c in comps])
+        
+        if not prefixFound:
+            currentPos = editor.currentPosition()
+            if context:
+                word += sep
             
-            res = editor.findNextTarget()
+            if editor.isUtf8():
+                sword = word.encode("utf-8")
+            else:
+                sword = word
+            res = editor.findFirstTarget(sword, False,
+                editor.autoCompletionCaseSensitivity(),
+                False, begline=0, begindex=0, ws_=True)
+            while res:
+                start, length = editor.getFoundTarget()
+                pos = start + length
+                if pos != currentPos:
+                    if context:
+                        completion = ""
+                    else:
+                        completion = word
+                    line, index = editor.lineIndexFromPosition(pos)
+                    curWord = editor.getWord(line, index, useWordChars=False)
+                    completion += curWord[len(completion):]
+                    if completion and completion not in completionsList:
+                        completionsList.append(
+                            "{0}?{1}".format(completion, self.__fromDocumentID))
+                
+                res = editor.findNextTarget()
         
         completionsList.sort()
         return completionsList
@@ -434,27 +604,154 @@
         
         line, col = editor.lineIndexFromPosition(pos)
         wc = re.sub("\w", "", editor.wordCharacters())
+        pat = re.compile("\w{0}".format(re.escape(wc)))
         text = editor.text(line)
         while col > 0 and \
-              (not text[col - 1].isalnum() or \
-               (wc and text[col - 1] not in wc)):
+              not pat.match(text[col - 1]):
             col -= 1
         word = editor.getWordLeft(line, col)
         
+        prefix = ""
+        mod = None
+        beg = editor.text(line)[:col]
+        col = len(beg)
+        wsep = editor.getLexer().autoCompletionWordSeparators()
+        if wsep:
+            if beg[col - 1] in wsep:
+                col -= 1
+            else:
+                while col >= 0 and beg[col - 1] not in wsep + [" ", "\t"]:
+                    col -= 1
+                if col >= 0:
+                    col -= 1
+            prefix = editor.getWordLeft(line, col)
+            if editor.isPy2File() or editor.isPy3File():
+                src = editor.text()
+                fn = editor.getFileName()
+                if fn is None:
+                    fn = ""
+                mod = Module("", fn, imp.PY_SOURCE)
+                mod.scan(src)
+        
         apiCalltips = []
         projectCalltips = []
+        documentCalltips = []
         
         if self.__plugin.getPreferences("AutoCompletionSource") & AcsAPIs:
             api = self.__apisManager.getAPIs(language)
             if api is not None:
-                apiCalltips = api.getCalltips(word, commas, self.__lastContext,
-                    self.__lastFullContext,
-                    self.__plugin.getPreferences("CallTipsContextShown"))
+                apiCalltips = self.__getApiCalltips(
+                    api, word, commas, prefix, mod, editor)
         
         if self.__plugin.getPreferences("AutoCompletionSource") & AcsProject:
             api = self.__apisManager.getAPIs(ApisNameProject)
-            projectCalltips = api.getCalltips(word, commas, self.__lastContext,
+            projectCalltips = self.__getApiCalltips(
+                api, word, commas, prefix, mod, editor)
+        
+        if self.__plugin.getPreferences("AutoCompletionSource") & AcsDocument:
+            documentCalltips = self.__getCalltipsFromDocument(
+                word, prefix, mod, editor)
+        
+        return sorted(
+            set(apiCalltips)
+            .union(set(projectCalltips))
+            .union(set(documentCalltips))
+        )
+    
+    def __getApiCalltips(self, api, word, commas, prefix, module, editor):
+        """
+        Private method to determine calltips from APIs.
+        
+        @param api reference to the API object to be used (APIsManager.DbAPIs)
+        @param word function to get calltips for (string)
+        @param commas minimum number of commas contained in the calltip (integer)
+        @param prefix prefix of the word to be completed (string)
+        @param module reference to the scanned module info (Module)
+        @param editor reference to the editor object (QScintilla.Editor)
+        @return list of calltips (list of string)
+        """
+        calltips = []
+        if prefix and module and prefix == "self":
+            line, col = editor.getCursorPosition()
+            for cl in module.classes.values():
+                if line >= cl.lineno and \
+                   (cl.endlineno == -1 or line <= cl.endlineno):
+                    for super in cl.super:
+                        calltips.extend(api.getCalltips(word, commas, super, None,
+                            self.__plugin.getPreferences("CallTipsContextShown")))
+                    break
+        else:
+            calltips = api.getCalltips(word, commas, self.__lastContext,
                 self.__lastFullContext,
                 self.__plugin.getPreferences("CallTipsContextShown"))
         
-        return sorted(set(apiCalltips).union(set(projectCalltips)))
+        return calltips
+    
+    def __getCalltipsFromDocument(self, word, prefix, module, editor):
+        """
+        Private method to determine calltips from the document.
+        
+        @param word function to get calltips for (string)
+        @param prefix prefix of the word to be completed (string)
+        @param module reference to the scanned module info (Module)
+        @param editor reference to the editor object (QScintilla.Editor)
+        @return list of calltips (list of string)
+        """
+        calltips = []
+        if module:
+            if prefix:
+                # prefix can be 'self', 'cls' or a class name
+                sep = editor.getLexer().autoCompletionWordSeparators()[0]
+                if prefix in ["self", "cls"]:
+                    line, col = editor.getCursorPosition()
+                    for cl in module.classes.values():
+                        if line >= cl.lineno and \
+                           (cl.endlineno == -1 or line <= cl.endlineno):
+                            if word in cl.methods:
+                                method = cl.methods[word]
+                                if hasattr(method, "modifier"):
+                                    if prefix == "self" or \
+                                       (prefix == "cls" and \
+                                        method.modifier == method.Class):
+                                        calltips.append("{0}{1}{2}({3})".format(
+                                            cl.name,
+                                            sep,
+                                            word,
+                                            ', '.join(method.parameters[1:])))
+                                else:
+                                    # eric 5.1 cannot differentiate method types
+                                    calltips.append("{0}{1}{2}({3})".format(
+                                        cl.name,
+                                        sep,
+                                        word,
+                                        ', '.join(method.parameters[1:])))
+                            break
+                else:
+                    if prefix in module.classes:
+                        cl = module.classes[prefix]
+                        if word in cl.methods:
+                            method = cl.methods[word]
+                            if hasattr(method, "modifier") and \
+                               method.modifier == method.Class:
+                                # only eric 5.2 and newer can differentiate method types
+                                calltips.append("{0}{1}{2}({3})".format(
+                                    cl.name,
+                                    sep,
+                                    word,
+                                    ', '.join(method.parameters[1:])))
+            else:
+                # calltip for a module function or class
+                if word in module.functions:
+                    fun = module.functions[word]
+                    calltips.append("{0}({1})".format(
+                        word,
+                        ', '.join(fun.parameters[1:])))
+                elif word in module.classes:
+                    cl = module.classes[word]
+                    if "__init__" in cl.methods:
+                        method = cl.methods["__init__"]
+                        calltips.append("{0}({1})".format(
+                            word,
+                            ', '.join(method.parameters[1:])))
+        
+        return calltips
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html	Sat Jul 30 10:55:32 2011 +0200
+++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html	Sun Sep 25 17:18:48 2011 +0200
@@ -58,6 +58,10 @@
 <table>
 <tr><td>None</td></tr>
 </table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <h3>Methods</h3>
 <table>
 <tr>
@@ -74,6 +78,10 @@
 <td>Public slot to reload the api information.</td>
 </tr>
 </table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <a NAME="APIsManager.__init__" ID="APIsManager.__init__"></a>
 <h4>APIsManager (Constructor)</h4>
 <b>APIsManager</b>(<i>parent=None</i>)
@@ -119,7 +127,7 @@
 <h2>DbAPIs</h2>
 <p>
     Class implementing an API storage entity.
-</p><h4>Signals</h4>
+</p><h3>Signals</h3>
 <dl>
 <dt>apiPreparationCancelled()</dt>
 <dd>
@@ -137,7 +145,11 @@
 QObject
 <h3>Class Attributes</h3>
 <table>
-<tr><td>DB_VERSION</td></tr><tr><td>ac_context_stmt</td></tr><tr><td>ac_stmt</td></tr><tr><td>api_files_stmt</td></tr><tr><td>create_acWord_idx</td></tr><tr><td>create_api_stmt</td></tr><tr><td>create_context_idx</td></tr><tr><td>create_file_idx</td></tr><tr><td>create_file_stmt</td></tr><tr><td>create_fullContext_idx</td></tr><tr><td>create_mgmt_stmt</td></tr><tr><td>ct_context_stmt</td></tr><tr><td>ct_fullContext_stmt</td></tr><tr><td>ct_stmt</td></tr><tr><td>drop_acWord_idx</td></tr><tr><td>drop_api_stmt</td></tr><tr><td>drop_context_idx</td></tr><tr><td>drop_file_idx</td></tr><tr><td>drop_file_stmt</td></tr><tr><td>drop_fullContext_idx</td></tr><tr><td>drop_mgmt_stmt</td></tr><tr><td>format_select_stmt</td></tr><tr><td>mgmt_insert_stmt</td></tr>
+<tr><td>DB_VERSION</td></tr><tr><td>ac_context_stmt</td></tr><tr><td>ac_context_word_stmt</td></tr><tr><td>ac_stmt</td></tr><tr><td>api_files_stmt</td></tr><tr><td>create_acWord_idx</td></tr><tr><td>create_api_stmt</td></tr><tr><td>create_context_idx</td></tr><tr><td>create_file_idx</td></tr><tr><td>create_file_stmt</td></tr><tr><td>create_fullContext_idx</td></tr><tr><td>create_mgmt_stmt</td></tr><tr><td>ct_context_stmt</td></tr><tr><td>ct_fullContext_stmt</td></tr><tr><td>ct_stmt</td></tr><tr><td>drop_acWord_idx</td></tr><tr><td>drop_api_stmt</td></tr><tr><td>drop_context_idx</td></tr><tr><td>drop_file_idx</td></tr><tr><td>drop_file_stmt</td></tr><tr><td>drop_fullContext_idx</td></tr><tr><td>drop_mgmt_stmt</td></tr><tr><td>format_select_stmt</td></tr><tr><td>mgmt_insert_stmt</td></tr>
+</table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
 </table>
 <h3>Methods</h3>
 <table>
@@ -206,6 +218,10 @@
 <td>Public method to prepare the APIs if neccessary.</td>
 </tr>
 </table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <a NAME="DbAPIs.__init__" ID="DbAPIs.__init__"></a>
 <h4>DbAPIs (Constructor)</h4>
 <b>DbAPIs</b>(<i>language, parent=None</i>)
@@ -431,6 +447,10 @@
 <table>
 <tr><td>file_delete_id_stmt</td></tr><tr><td>file_id_stmt</td></tr><tr><td>file_loaded_stmt</td></tr><tr><td>populate_api_stmt</td></tr><tr><td>populate_del_api_stmt</td></tr><tr><td>populate_file_stmt</td></tr><tr><td>update_file_stmt</td></tr>
 </table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <h3>Methods</h3>
 <table>
 <tr>
@@ -459,6 +479,10 @@
 <td>Public method to perform the threads work.</td>
 </tr>
 </table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <a NAME="DbAPIsWorker.__init__" ID="DbAPIsWorker.__init__"></a>
 <h4>DbAPIsWorker (Constructor)</h4>
 <b>DbAPIsWorker</b>(<i>proxy, language, apiFiles, projectPath="", refresh=False</i>)
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html	Sat Jul 30 10:55:32 2011 +0200
+++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html	Sun Sep 25 17:18:48 2011 +0200
@@ -52,6 +52,10 @@
 <table>
 <tr><td>None</td></tr>
 </table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <h3>Methods</h3>
 <table>
 <tr>
@@ -67,9 +71,15 @@
 <td><a href="#Assistant.__editorOpened">__editorOpened</a></td>
 <td>Private slot called, when a new editor was opened.</td>
 </tr><tr>
+<td><a href="#Assistant.__getApiCalltips">__getApiCalltips</a></td>
+<td>Private method to determine calltips from APIs.</td>
+</tr><tr>
 <td><a href="#Assistant.__getApiCompletions">__getApiCompletions</a></td>
 <td>Private method to determine a list of completions from an API object.</td>
 </tr><tr>
+<td><a href="#Assistant.__getCalltipsFromDocument">__getCalltipsFromDocument</a></td>
+<td>Private method to determine calltips from the document.</td>
+</tr><tr>
 <td><a href="#Assistant.__getCharacter">__getCharacter</a></td>
 <td>Private method to get the character to the left of the current position in the current line.</td>
 </tr><tr>
@@ -110,6 +120,10 @@
 <td>Public method to enable or disable a feature.</td>
 </tr>
 </table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <a NAME="Assistant.__init__" ID="Assistant.__init__"></a>
 <h4>Assistant (Constructor)</h4>
 <b>Assistant</b>(<i>plugin, parent=None</i>)
@@ -156,9 +170,39 @@
 <dd>
 reference to the new editor (QScintilla.Editor)
 </dd>
+</dl><a NAME="Assistant.__getApiCalltips" ID="Assistant.__getApiCalltips"></a>
+<h4>Assistant.__getApiCalltips</h4>
+<b>__getApiCalltips</b>(<i>api, word, commas, prefix, module, editor</i>)
+<p>
+        Private method to determine calltips from APIs.
+</p><dl>
+<dt><i>api</i></dt>
+<dd>
+reference to the API object to be used (APIsManager.DbAPIs)
+</dd><dt><i>word</i></dt>
+<dd>
+function to get calltips for (string)
+</dd><dt><i>commas</i></dt>
+<dd>
+minimum number of commas contained in the calltip (integer)
+</dd><dt><i>prefix</i></dt>
+<dd>
+prefix of the word to be completed (string)
+</dd><dt><i>module</i></dt>
+<dd>
+reference to the scanned module info (Module)
+</dd><dt><i>editor</i></dt>
+<dd>
+reference to the editor object (QScintilla.Editor)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+list of calltips (list of string)
+</dd>
 </dl><a NAME="Assistant.__getApiCompletions" ID="Assistant.__getApiCompletions"></a>
 <h4>Assistant.__getApiCompletions</h4>
-<b>__getApiCompletions</b>(<i>api, word, context</i>)
+<b>__getApiCompletions</b>(<i>api, word, context, prefix, module, editor</i>)
 <p>
         Private method to determine a list of completions from an API object.
 </p><dl>
@@ -171,12 +215,45 @@
 </dd><dt><i>context</i></dt>
 <dd>
 flag indicating to autocomplete a context (boolean)
+</dd><dt><i>prefix</i></dt>
+<dd>
+prefix of the word to be completed (string)
+</dd><dt><i>module</i></dt>
+<dd>
+reference to the scanned module info (Module)
+</dd><dt><i>editor</i></dt>
+<dd>
+reference to the editor object (QScintilla.Editor)
 </dd>
 </dl><dl>
 <dt>Returns:</dt>
 <dd>
 list of possible completions (list of strings)
 </dd>
+</dl><a NAME="Assistant.__getCalltipsFromDocument" ID="Assistant.__getCalltipsFromDocument"></a>
+<h4>Assistant.__getCalltipsFromDocument</h4>
+<b>__getCalltipsFromDocument</b>(<i>word, prefix, module, editor</i>)
+<p>
+        Private method to determine calltips from the document.
+</p><dl>
+<dt><i>word</i></dt>
+<dd>
+function to get calltips for (string)
+</dd><dt><i>prefix</i></dt>
+<dd>
+prefix of the word to be completed (string)
+</dd><dt><i>module</i></dt>
+<dd>
+reference to the scanned module info (Module)
+</dd><dt><i>editor</i></dt>
+<dd>
+reference to the editor object (QScintilla.Editor)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+list of calltips (list of string)
+</dd>
 </dl><a NAME="Assistant.__getCharacter" ID="Assistant.__getCharacter"></a>
 <h4>Assistant.__getCharacter</h4>
 <b>__getCharacter</b>(<i>pos, editor</i>)
@@ -294,7 +371,7 @@
         Public method to perform actions upon deactivation.
 </p><a NAME="Assistant.getCompletionsFromDocument" ID="Assistant.getCompletionsFromDocument"></a>
 <h4>Assistant.getCompletionsFromDocument</h4>
-<b>getCompletionsFromDocument</b>(<i>editor, word, context, sep</i>)
+<b>getCompletionsFromDocument</b>(<i>editor, word, context, sep, prefix, module</i>)
 <p>
         Public method to determine autocompletion proposals from the document.
 </p><dl>
@@ -310,6 +387,12 @@
 </dd><dt><i>sep</i></dt>
 <dd>
 separator string (string)
+</dd><dt><i>prefix</i></dt>
+<dd>
+prefix of the word to be completed (string)
+</dd><dt><i>module</i></dt>
+<dd>
+reference to the scanned module info (Module)
 </dd>
 </dl><dl>
 <dt>Returns:</dt>
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.ConfigurationPages.AutoCompletionEricPage.html	Sat Jul 30 10:55:32 2011 +0200
+++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.ConfigurationPages.AutoCompletionEricPage.html	Sun Sep 25 17:18:48 2011 +0200
@@ -51,6 +51,10 @@
 <table>
 <tr><td>None</td></tr>
 </table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <h3>Methods</h3>
 <table>
 <tr>
@@ -61,6 +65,10 @@
 <td>Public slot to save the Eric Autocompletion configuration.</td>
 </tr>
 </table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <a NAME="AutoCompletionEricPage.__init__" ID="AutoCompletionEricPage.__init__"></a>
 <h4>AutoCompletionEricPage (Constructor)</h4>
 <b>AutoCompletionEricPage</b>(<i>plugin</i>)
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.ConfigurationPages.CallTipsEricPage.html	Sat Jul 30 10:55:32 2011 +0200
+++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.ConfigurationPages.CallTipsEricPage.html	Sun Sep 25 17:18:48 2011 +0200
@@ -51,6 +51,10 @@
 <table>
 <tr><td>None</td></tr>
 </table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <h3>Methods</h3>
 <table>
 <tr>
@@ -61,6 +65,10 @@
 <td>Public slot to save the Eric Calltips configuration.</td>
 </tr>
 </table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <a NAME="CallTipsEricPage.__init__" ID="CallTipsEricPage.__init__"></a>
 <h4>CallTipsEricPage (Constructor)</h4>
 <b>CallTipsEricPage</b>(<i>plugin</i>)
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.PluginAssistantEric.html	Sat Jul 30 10:55:32 2011 +0200
+++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.PluginAssistantEric.html	Sun Sep 25 17:18:48 2011 +0200
@@ -63,6 +63,10 @@
 <table>
 <tr><td>None</td></tr>
 </table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <h3>Methods</h3>
 <table>
 <tr>
@@ -97,6 +101,10 @@
 <td>Public method to store the various refactoring settings.</td>
 </tr>
 </table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
 <a NAME="AssistantEricPlugin.__init__" ID="AssistantEricPlugin.__init__"></a>
 <h4>AssistantEricPlugin (Constructor)</h4>
 <b>AssistantEricPlugin</b>(<i>ui</i>)
--- a/ChangeLog	Sat Jul 30 10:55:32 2011 +0200
+++ b/ChangeLog	Sun Sep 25 17:18:48 2011 +0200
@@ -1,5 +1,9 @@
 ChangeLog
 ---------
+Version 2.2.1:
+- bug fixes
+- improved auto-completions and calltips for Python sources
+
 Version 2.2.0:
 - bug fixes
 - dropped support for eric 5.0.x
--- a/PluginAssistantEric.py	Sat Jul 30 10:55:32 2011 +0200
+++ b/PluginAssistantEric.py	Sun Sep 25 17:18:48 2011 +0200
@@ -23,7 +23,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "2.2.0"
+version = "2.2.1"
 className = "AssistantEricPlugin"
 packageName = "AssistantEric"
 shortDescription = "Alternative autocompletion and calltips provider."

eric ide

mercurial