Open ilekka opened 8 months ago
Unfortunately this is kind of a known issue. Because there's no index, there's all sorts of "slow" things going on. See also https://github.com/davidhalter/jedi/issues/1059.
I'm currently rewriting Jedi/Mypy in Rust to avoid this issue.
There might still be hope here. We could theoretically disable a certain kind of functionality in case of imported modules, that would make this issue quite a bit faster. I'm thinking about that.
Thanks for the insight, and for the plugin, which has served me well for several years.
I had already resigned to using ~/empty/directory/with/no/python/anywhere/in/sight
as a workaround when working with python-igraph. However, I eventually found asyncomplete.vim, which seems to be a better solution. It does give very speedy completions when Jedi is used as the language server.
Yes, that makes complete sense. I definitely feel like there might be better solutions out there for Jedi completions than jedi-vim. The thing that many of these don't do is the other stuff like gotos.
There's also https://github.com/deoplete-plugins/deoplete-jedi/ if you are using neovim, I guess. AFAIK @blueyed has been using that.
Issue
Completions for python-igraph are typically very slow, but the speed depends drastically on the current working directory.
If vim is run in
~
, the codetakes over 30 seconds to complete. The completion becomes faster if the current working directory is better isolated from other directories. (The examples below will hopefully help to clarify what I mean by this; unfortunately I don't know how to give a precise characterization of "isolated".)
Steps to reproduce
After cd'ing into the following directories:
~
~/Python/empty
(an empty directory, but~/Python
contains all my Python projects and scripts)~/empty/directory/with/no/python/anywhere/in/sight
I start vim and type the code
In case 1, the completion takes over 30 seconds, in case 2 it takes about 3 seconds, and in case 3 it happens basically instantaneously.
Tab completion in ipython is instantaneous in all three cases.
Vim is run with a minimal .vimrc that uses vim-plug to load only jedi-vim:
Output of “:verbose JediDebugInfo”
Jedi-vim debug information
jedi-vim version
Global Python
Using Python version 3 to access Jedi.
/home/ilkka/mambaforge/envs/3.11/bin/python3
3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
/home/ilkka/mambaforge/lib/python3.10/site.py
Jedi
/home/ilkka/.vim/plugged/jedi-vim/pythonx/jedi/jedi/__init__.py
Jedi environment: <Environment: 3.11.7 in /home/ilkka/mambaforge/envs/3.11>
/home/ilkka/mambaforge/envs/3.11/lib/python311.zip
/home/ilkka/mambaforge/envs/3.11/lib/python3.11
/home/ilkka/mambaforge/envs/3.11/lib/python3.11/lib-dynload
/home/ilkka/mambaforge/envs/3.11/lib/python3.11/site-packages
Known environments
<Environment: 3.11.7 in /home/ilkka/mambaforge/envs/3.11> (/home/ilkka/mambaforge/envs/3.11/bin/python)
<Environment: 3.11.7 in /home/ilkka/mambaforge/envs/3.11> (/home/ilkka/mambaforge/envs/3.11/bin/python3.11)
<Environment: 3.10.12 in /usr> (/usr/bin/python3.10)
Settings
:version
:messages
:scriptnames
``` 1: ~/jedi.vimrc 2: ~/.vim/autoload/plug.vim 3: /usr/share/vim/vim82/filetype.vim 4: /usr/share/vim/vim82/ftplugin.vim 5: /usr/share/vim/vim82/indent.vim 6: /usr/share/vim/vim82/syntax/syntax.vim 7: /usr/share/vim/vim82/syntax/synload.vim 8: /usr/share/vim/vim82/syntax/syncolor.vim 9: /usr/share/vim/vim82/colors/lists/default.vim 10: ~/.vim/plugged/jedi-vim/plugin/jedi.vim 11: /usr/share/vim/vim82/plugin/getscriptPlugin.vim 12: /usr/share/vim/vim82/plugin/gzip.vim 13: /usr/share/vim/vim82/plugin/logiPat.vim 14: /usr/share/vim/vim82/plugin/manpager.vim 15: /usr/share/vim/vim82/plugin/matchparen.vim 16: /usr/share/vim/vim82/plugin/netrwPlugin.vim 17: /usr/share/vim/vim82/plugin/rrhelper.vim 18: /usr/share/vim/vim82/plugin/spellfile.vim 19: /usr/share/vim/vim82/plugin/tarPlugin.vim 20: /usr/share/vim/vim82/plugin/tohtml.vim 21: /usr/share/vim/vim82/plugin/vimballPlugin.vim 22: /usr/share/vim/vim82/plugin/zipPlugin.vim 23: ~/.vim/plugged/jedi-vim/ftplugin/python/jedi.vim 24: ~/.vim/plugged/jedi-vim/autoload/jedi.vim 25: /usr/share/vim/vim82/ftplugin/python.vim 26: ~/.vim/plugged/jedi-vim/after/ftplugin/python/jedi.vim 27: /usr/share/vim/vim82/indent/python.vim 28: ~/.vim/syntax/python.vim 29: /usr/share/vim/vim82/syntax/python.vim 30: ~/.vim/plugged/jedi-vim/after/syntax/python.vim ```