[Eric] Autocompletion behaviour

Detlev Offenbach detlev at die-offenbachs.de
Fri Oct 26 18:18:47 BST 2018


Hi,

here are some explanations, that might shed some more light on the topic.

1. Eric Assistant
It uses the very same API files as the completer included in QScintilla (the 
editor widget used by eric). In addition to this it provides completions for 
files being part of the current project. All of these work statically (i.e. by 
matching text; nothing is executed).

2. Jedi, Rope
This completer plug-ins are using external libraries to do the job. Therefore 
eric can only show those completions determined by the external libraries. If 
they don't report anything, eric cannot be blamed (You shoot the messanger!).

3. Some IDEs try to execute the script of the current file in order to 
determine completions via the inspect module. I've seen this work in simple, 
standard cases but fail quite often (= regularly) with PyQt scripts. Therefore 
I decided to not follow this approach. However, if somebody wants to 
contribute such a completer, I may reconsider my decision.

4. Duplicate entries are caused by plug-ins reporting the same completions in 
different ways as seen in the screenshot. I didn't find a way to sort the list 
without taking the risk to loose information.

5. "No further documentation available" is caused by rope or jedi not being 
able to retrieve code documentation from the sources or imported packages or 
modules. This happens quite often with modules implement in C/C++ and wrapped 
for Python. The picture shows such a case. The shown calltip comes from a 
static API file and is presented by the eric Assistant plug-in.

6. Not being able to be completed is caused by none of the completers being 
able to determine the type of "now". This is due to the fact, that no code is 
executed (see above).

7. Display of too many calltips is caused by the providers not knowing about 
the context (no completion was selected).

8. Wrong calltip is a consequence of not having selected the correct 
completion. eric remembers the context of a completion in order to select the 
correct calltip thereafter.

I am fully aware, that some of this behaviour is not the expected one and are 
open for contribution of improved code.

Detlev

Am Freitag, 26. Oktober 2018, 05:40:19 CEST schrieb Alex Gerhardt-Bourke:
> Apologies to harp on this point, but in my opinion autocompletion is one of
> the vital things for a functional IDE. From a number of reviews I’ve read,
> the fact that autocomplete doesn’t work out of the box or with some easy
> configuration is the reason a lot of people put eric down not long after
> picking it up, without giving it a fair chance. So I would like to
> demonstrate how eric6 currently functions for me, and what I actually
> expect.
> 
> My setup:
> I have a conda virtual-environment called eric6. For the sake of simplicity
> everything following will be done under this environment. I run eric6 under
> this environment and run help->Show Versions:
> [cid:image001.png at 01D46D1B.C30B0190]
> 
> I have the following plugins installed for autocompletion:
>                 Eric Assistant
>                 Jedi
>                 Rope
> I also have the QScintilla autocompletion enabled.
> 
> Under Preferences->Editor->APIs I have the “Compile APIs automatically”
> setting enabled, and under Python3 PyQt5 GUI project type I have the
> Python3.7, QScintilla2, and PyQt5 apis listed. All autocompletion options
> are enabled.
> 
> Under Preferences->Editor->Documentation Viewer I have the documentation
> viewer enabled with show documentation upon ‘(‘ set.
> 
> I now create a new project called “checkEricAutocompletion”. Progr. Language
> python3, project type PyQt5 GUI. Present in the project is an __init__.py
> file. I will use this file to check autocompletion behavior.
> 
> [cid:image002.png at 01D46D1D.74701A50]
> This behavior is perfect – the autocomplete tool (I don’t know which one) is
> getting results from the QtCore module. I import QDate.
> [cid:image003.png at 01D46D1D.C3BCB370]
> Again the results are good, I am seeing options that exist within QDate – I
> don’t know why I am seeing two of each though, I assume it is due to having
> multiple autocomplete plugins enabled. This list filters appropriately:
> [cid:image004.png at 01D46D1E.08BDF420]
> 
> Here is where things get bad. Tabbing to complete currentDate gives me the
> following: [cid:image006.png at 01D46D20.B2FE7A70]
> The calltip is correct, but no documentation is available. The code info
> provider is set to Rope, changing to jedi gives the same non-result.
> 
> We can see from the calltip that QDate.currentDate() returns a QDate object,
> so the “now” variable should have many methods available to it. None of
> these are displayed when pressing ctrl+space.
> [cid:image008.png at 01D46D1E.B6C0EB90]
> 
> To make matters worse, methods that do *not* exist for QDate types show as
> autocompletion options when typing some letters, eg:
> [cid:image009.png at 01D46D1E.EA6326C0]
> The desired behavior here is that the autocomplete tool knows what type of
> object the “now” variable is and only shows  methods that exist for that
> type. Maybe this is harder than it sounds due to the dynamic typing nature
> of python? Here is another example when looking at a method that *does*
> belong to QDate types: [cid:image010.png at 01D46D1F.5B65D0C0]
> The problem with showing so many options here is, suppose I ignore this box
> and continue to code, I will now be shown this calltip:
> [cid:image013.png at 01D46D20.B2FE7A70]
> 
> If instead I just tab without selecting the right option, I will be shown
> the wrong calltip [cid:image011.png at 01D46D1F.98C7ED40]
> 
> In reality, I should be shown this:
> [cid:image017.png at 01D46D20.B2FE7A70]
> 
> Is all of this behavior what other users experience when using eric, or is
> there something wrong with my setup? If no, how can this be improved?
> 
> Regards,
> Alex.
> 
> 
> From: Christos Sevastiadis<mailto:csevast at auth.gr>
> Sent: Monday, October 22, 2018 5:57 PM
> To: Eric at riverbankcomputing.com<mailto:Eric at riverbankcomputing.com>
> Subject: Re: [Eric] Autocompletion behaviour
> 
> Alex and Detlev,
> 
> It seems that the "Virtual Environment" option should affect not only the
> Start/Debug action but the Editor's code support functions, such as
> Autocompletion, Calltips and "Code Documentation", either. For the "Code
> Documentation" I use the Jedi provider instead of Rope, because Rope fails
> to show information in many cases of my imported modules. Probably this
> problem is also connected with the different virtual environments.
> 
> Regards
> Christos
> 
> Christos

-- 
Detlev Offenbach
detlev at die-offenbachs.de




More information about the Eric mailing list