-
-
Notifications
You must be signed in to change notification settings - Fork 40
deoplete-jedi doesn't recognize some candidates in large packages as numpy #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@monkoose Thanks for creating new issue. I'll check it. |
I think deoplete-jedi server is freezed by numpy analyses. |
@Shougo Ah, but as I said before on #89 (comment), deoplete-jedi using json cache for the each module first method. |
As i said i guess neovim freezes because of jedi-vim call signatures. Will test it tomorrow. |
deoplete-jedi isn't freezing. The problem is that deoplete-jedi is (correctly) caching the results. I'm not sure why this is, but Jedi doesn't return the imports that are in With the following: diff --git a/rplugin/python3/deoplete/sources/deoplete_jedi.py b/rplugin/python3/deoplete/sources/deoplete_jedi.py
index 14a2f20..26cd14c 100644
--- a/rplugin/python3/deoplete/sources/deoplete_jedi.py
+++ b/rplugin/python3/deoplete/sources/deoplete_jedi.py
@@ -199,6 +199,9 @@ class Source(Base):
# refresh cached items that did not have associated module files.
refresh = True
+ if cache_key and cache_key[-1] == 'package' and 'numpy' in cache_key[-2]:
+ refresh = True
+
# Extra options to pass to the server.
options = {
'cwd': context.get('cwd'), In a script like:
Where |
@tweekmonster Thanks detail and debug. Hmm, strange... |
Might be related to davidhalter/jedi#784?! |
@blueyed Good reference for me. Edit: I saw added |
I'm not sure. I don't know enough about how Jedi works, but I believe something else is happening internally. Like the internal state incrementally changes on each call until it's able to resolve the imports at Also, because of that linked issue, I thought maybe changing settings.fast_parser = False
settings.max_executions_without_builtins = 50000000
settings.max_executions = 50000000
settings.scale_call_signatures = 10000000
settings.max_until_execution_unique = 50000000
settings.max_function_recursion_level = 50000000
settings.max_executions = 50000000
settings.star_import_cache_validity = 50000000
settings.call_signatures_validity = 50000000
settings.use_filesystem_cache = False I made it so that deoplete-jedi's caches were always invalid. All of these high values did basically nothing from my tests. Completions always finished in about the same amount of time, including |
@tweekmonster Yes, you are right about refreshing the cache. Actually atom editor and it autocomplete-python(with jedi) behaves similarly. I didn't describe it in my post. You should type np.sin, then delete sin and type again and wait some time(5+ seconds). And then it can complete all other staff like np.arange, np.cos, etc. without a problem. I checked my assumption about call_signatures of jedi-vim. And yes it is it that cause freeze of neovim. Maybe because it isn't async or i don't know. |
What's happening is Jedi stalling on |
@tweekmonster @blueyed Do you know does @davidhalter have plans to rewrite jedi-vim with some async features? Should i request it in his repo? |
@monkoose What about adding a call signature feature to deoplete/deoplete-jedi btw? :) |
@blueyed I don't know what @zchee and @Shougo think about it. Myself i like linux way. So completion engine/helper/plugin should always stay only as completion plugin. Or may be i wrong and completion and refactoring staff is the same thing(as we use jedi for both) and its easier to have and maintain in the same place. So i dunno. |
Hey, what's the status of this issue? For me, it seems to be happening, also with numpy. Other things that use |
@EshanSingh What you linked is a REPL, which gets the benefit of actually executing code at your request. Live objects can be inspected a lot more easily since you already loaded things. What we're doing is inspecting the scripts without executing anything and Jedi has to emulate some execution to get the completions. In a REPL you're controlling the execution step-by-step. So, you wouldn't be surprised if what you did caused a file to be written or deleted. In source editing, you wouldn't want code to execute before you consider it usable. As for the status, I haven't kept up with Jedi's development. Besides what I posted above, I'm not sure where this stands. |
@tweekmonster That makes sense, thanks a lot. |
any way this days of avoiding the kludge of typing,erasing and waiting to make deoplete show the right candidates? |
@ocehugo |
@blueyed, I cant invest time on that now, but I can say that I'm still hitting this issue with numpy for example, where candidates are completely wrong and/or not loaded at all (np.zeros,np.sin,np.tan are not pop ed up and other candidates not related to methods of the package are shown) . All packages on HEAD (neovim,jedi,bla bla bla). |
@ocehugo I can see that this is an issue for people using pandas & co, but then you should also have experience with coding, optimization, data structures etc., so please consider digging into the source of the software you are using. |
@blueyed Again , the issue is super easy to reproduce: import numpy as np
#trying to complete np.zeros
x = np.zer #press tab or activate the completion engine Also, doesn't matter if it's like: import numpy or import numpy as np candidates are wrong in all of them/completely missing. This is not only with numpy, but with mostly all popular python packages (matplotlib,scipy,astropy,etc). I could say all packages cause none of them work here. Completions for imports are also a problem but i'm digressing... |
@ocehugo Hi, ls -la $XDG_CACHE_HOME/deoplete/jedi/your_python_version
# if there is json cache file...
rm -rm $XDG_CACHE_HOME/deoplete/jedi/your_python_version that's clear before server cache data. |
Aha! @zchee worked! thx for that |
Same issue here and no help to clear old cache, it seems to output same cache as old.
both python2 and python3 on ArchLinux with jedi v0.10.0-1 failed. |
I can confirm the bug. It still fails with cache cleared. |
Update Jedi to 0.10.2 fixes this. |
Yep. Seems working for me too. So this issue can be closed i think. |
@monkoose When #115 is merged, completions will return a lot faster. For modules that take a long time, the completion menu will refresh automatically so you no longer need to backspace to refresh. But it depends on Shougo/deoplete.nvim#467 Video: https://share.esdf.io/PTpzroecdt/ There's still some work that needs to be done with Deoplete's async refresh, though. I think nvim changes the
That's a problem on our end. Any changes to the cache format or Jedi submodule requires a cache version bump in the code to invalidate the current cache. |
Problem summary
#89 partially fixes deoplete-jedi candidates recognition compare to other editors, but tested with numpy(even larger package then django and more comlex) and seems like it still cant show some candidates that JEDI(and jedi-vim) can. Tested in atom and vscode too. They both can complete(atom need like 5-10 sec to actually recognize this candidates. Yes numpy is huge), vscode much faster but still delays 2-3 seconds before comletions show up.



I dunno - maybe it's too much for deoplete-jedi and deoplete itself? Because my neovim even freeze for few seconds when im trying to get this completions with jedi-vim. And even when i dont complete with jedi-vim and just type something like np.cos() for the first time per session neovim freezes(i guess because of g:jedi#show_call_signatures = 2). Will test it later.
Some screenshots
deoplete-jedi
jedi-vim
atom
Atom an VScode after they actually detect this candidates, then completion is fast(i suppose because of cache). Jedi-vim too. Deoplete-jedi still cant detect them even when you already have them in your file(deoplete for sure completes them as simple keyword).
As you can see from jedi-vim screenshot actual path for sin is numpy.umath.sin. And as expected deoplete-jedi completes it without a problem

So i dont really know should we try to fix this. Because it's laggy. Just posted for the record.
0.1.7
The text was updated successfully, but these errors were encountered: