ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.44k stars 2.81k forks source link

Wrong completion with more than 10 (ten) imports #3291

Closed chrishaig14 closed 5 years ago

chrishaig14 commented 5 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

test.py:

class Test1:
    def __init__(self,a):
        self.a = a
 # Test2, Test3, ..., Test11 exactly the same as above

main.py:

from test import Test1, Test2, Test3, Test4, Test5, Test6, Test7, Test8, Test9, Test10, Test11
t = Te#<C-Space> here

Should suggest:

  ~       Test1                 c class Test1                                               
  ~       Test2                 c class Test2                                               
  ~       Test3                 c class Test3                                               
  ~       Test4                 c class Test4                                               
             ...                                            
  ~       Test11                c class Test11                  

Instead, I get "module" and not "class":

  ~       Test1                 m module Test1                                               
  ~       Test2                 m module Test2                                               
  ~       Test3                 m module Test3                                               
  ~       Test4                 m module Test4                                               
            ...                                        
  ~       Test11                m module Test11                

I don't get the __init__ documentation in the scratch window. But it still works OK for any other completion besides the constructor, e.g. if I type t = Test7() and then t.#<C-Space> it actually shows 'a'.

It works fine with less than 11 imports

Diagnostic data

Output of vim --version

gist

Output of YcmDebugInfo

Printing YouCompleteMe debug information... -- Client logfile: /tmp/ycm_MQWL3B.log -- Server Python interpreter: /usr/bin/python3 -- Server Python version: 3.6.6 -- Server has Clang support compiled in: False -- Clang version: None -- No extra configuration file found -- Python completer debug information: -- Python interpreter: /usr/bin/python3 -- Python path: ['/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dyn load', '/home/chris/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packa ges', '/usr/lib/python3/dist-packages'] -- Python version: 3.6.6 -- Jedi version: 0.13.1 -- Parso version: 0.3.1 -- Server running at: http://127.0.0.1:51799 -- Server process ID: 13866 -- Server logfiles: -- /tmp/ycmd_51799_stdout_FSzsak.log -- /tmp/ycmd_51799_stderr_L3i_1G.log

Contents of YCM, ycmd and completion engine logfiles

Add let g:ycm_log_level = 'debug' to vimrc, restart Vim, reproduce the issue, and include link here to a [gist][] containing the entire logfiles for ycm, ycmd and any completer logfiles listed by :YcmToggleLogs.

I triggered completion just before this point

   2019-01-07 13:49:38,196 - INFO - Received completion request
   2019-01-07 13:49:38,196 - DEBUG - Using filetype completion: True
   2019-01-07 13:49:40,142 - INFO - Received event notification
   2019-01-07 13:49:40,142 - DEBUG - Event name: FileReadyToParse
   2019-01-07 13:49:40,142 - INFO - Adding buffer identifiers for file: /home/chris/code/importtest/main.py
   2019-01-07 13:49:40,148 - INFO - Received event notification
   2019-01-07 13:49:40,148 - DEBUG - Event name: InsertLeave
   2019-01-07 13:49:40,148 - INFO - Adding ONE buffer identifier for file: /home/chris/code/importtest/main.py
   2019-01-07 13:49:45,387 - INFO - Received debug info request
   2019-01-07 13:49:51,157 - INFO - Received debug info request 
   2019-01-07 13:49:53,025 - INFO - Received debug info request

I see nothing relevant in the other logs listed.

OS version, distribution, etc.

Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic

micbou commented 5 years ago

Thanks for the report. This behavior is due to a Jedi workaround to improve responsiveness when completing modules like tensorflow. I am not a fan of this workaround and expressed my opinion about it in https://github.com/davidhalter/jedi/issues/1116#issuecomment-426285565. Anyway, there is not much we can do except maybe convincing Jedi's author to revert this.

bstaletic commented 5 years ago

Since this is a Jedi "feature" and not a YCM bug, I'm going to close this.