Theia: updates improving python language server
Update versions and tweak a bit python language server config.
After some investigation, I understood that completions where slow for us because jedi add some buildout support which walks up directories to find a
buildout.cfg and inspects the corresponding scripts in
bin to find python package paths. On web runner I have 98 scripts in
~/bin/, each of them adding between 30 and 50 entries to
A quick workaround is to create an empty
buildout.cfg in the current directory or a parent directory before editing python code.
The changes were merged into master. The source branch has been removed.
@rafael if you are interested you should try this updated version. As said in the description, putting a
buildout.cfgis required to edit python otherwise auto completion take forever. I still have not really understood where the problem is in jedi so I have not reported the bug yet. It seems this is supposed to be cached and fast after some time, but it was always slow for me.
Note that there is also https://github.com/tomv564/pyls-mypy that looks excellent, but unfortunately this stops working after the first edit.
for reference, this is https://github.com/tomv564/pyls-mypy/issues/19 ( which is same problem as erp5!758 ... changing stdout in multi-thread application ) I'm following that github issue and will reconsider adding pyls-mypy if there is progress, but this seems to have stalled. Anyway, mypy is not enabled for now, so this MR is OK as is.
Thanks @rafael I think this can be merged. I'm have been using this to edit python code every day since I opened this and it works reasonably well.
Things have changed a bit and it would be interesting to try to update again:
- theia now supports vscode extensions, so it seems we can even use the debugger for python ( https://github.com/theia-ide/theia/issues/3771 ). I have not tried yet.
- The fix for my problem with yapf that made me install python-language-server from git is now released in (
0.21.6). Since that, python-language-server have also changed and includes pylint by default (and not just pyflakes). I have not tried new version.
- this language server includes mccabe. It might help when writing new code, but frankly I'm not sure this is helpful when working with existing code. ( if installed in a webrunner, it's possible to
pip uninstall mccabe)
- the language server is for python3, so it will complain if code is written with a python2 only syntax. For this reason, I started to change ERP5 syntax erp5!853
- mypy ... I don't know. There's also https://github.com/Microsoft/pyright that looks promising for editor integration. There's also https://github.com/facebook/pyre-check . I have not tried either, but even if I was very enthousiastic regarding typing in python at first, after trying a bit, it's not the same amazing experience as typescript provides.
- I have not looked more closely at the jedi vs buildout issue from the description.
- BTW this still uses python3.6, because before I understood that the slowness of completions was because of this conflict with buildout I tried to use exactly same versions as gitpod.io . We can update to python3.7 already.
... but all this can be done later. For now, this version works, so let's merge as is, we'll update again later.
mergedToggle commit list