Repository: spyder-ide/spyder

Issue:
Code completion issue with Jedi
Spyder 2.3.3  Python 3.4.0 64bits, Qt 4.8.6, PyQt4 (API v2) 4.10.4 on Linux

With **rope** (jedi uninstalled):
**Okno.ui.Tlacitko.pressed.**
shows:

```
- connect
- disconnect
- emit
- signal
```

with **jedi** installed (rope too)  these are omitted.

Main.py

``` python
from PyQt4 import  QtGui #,QtCore
from Ui_Formular import Ui_Form
from PyQt4.QtGui import QMessageBox

class Formular(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.ui.Tlacitko.clicked.connect(self.ObsluhaKliku)

    def ObsluhaKliku(self):
        QMessageBox.information(self,"Ok", "Tak to je teda komedie :-)") 

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    Okno = Formular()
    Okno.show()
    sys.exit(app.exec_())
```

Ui_Formular.py

``` python
from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(623, 444)
        self.Tlacitko = QtGui.QPushButton(Form)
        self.Tlacitko.setGeometry(QtCore.QRect(370, 210, 98, 32))
        self.Tlacitko.setObjectName(_fromUtf8("Tlacitko"))
        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(_translate("Form", "Form", None))
        self.Tlacitko.setText(_translate("Form", "Můj Button", None))
```



Discussion:
@blink1073 if you find how to solve this problem, please submit a PR against the 2.3 branch.

@ccordoba12, this happens because Jedi is given preference and in this case returns a valid, but incomplete result.  This may be a reason to keep Rope as the default, and only use Jedi if rope fails to find something.  When I reverse the order of the preferred plugins, I get the desired behaviour in this case.

@blink1073 It makes sense, given that the main use case for Jedi is to provide completions for compiled modules.

But perhaps a better decision criteria would be to ask for completions with both libraries, compute the (set) union of the returned completion lists, and show that. What do you think?

@ccordoba12, my concern there is that we'd have to wait a period of time as opposed to giving the user results as soon as they are available.

Yes, I was thinking that too. Then please go ahead and make Rope the default (in any case it seems to be faster too :-)


Resolving patch:
diff --git a/spyderlib/utils/introspection/plugin_manager.py b/spyderlib/utils/introspection/plugin_manager.py
--- a/spyderlib/utils/introspection/plugin_manager.py
+++ b/spyderlib/utils/introspection/plugin_manager.py
@@ -17,7 +17,7 @@
 from spyderlib.qt.QtCore import Signal, QThread, QObject, QTimer
 
 
-PLUGINS = ['jedi', 'rope', 'fallback']
+PLUGINS = ['rope', 'jedi', 'fallback']
 
 LOG_FILENAME = get_conf_path('introspection.log')
 DEBUG_EDITOR = DEBUG >= 3


Test patch: