I am using jedi via YCM in vim and an seeing some weird behavior in my project, regarding using the usages
endpoint on the jediHttp server. Basically it only finds a small fraction of the usages in my project of a class or function. It does find all the usages in the current file, but does not find the vast majority in other files. The GoTo
command works fine and will open a new buffer anywhere in the project as expected. However when I start at the definition and try to see all the usages
via the GoToReferences
command it only produces about 20% of the actual usages.
I have tried making a dummy project to recreate the behavior and it seems to have worked. Here is the simple project structure:
> tree -I __pycache__
.
├── setup.py
└── test_jedi
├── classes.py
├── __init__.py
├── mod1
│ ├── __init__.py
│ └── recessed.py
└── script.py
2 directories, 6 files
Here are the contents of those files:
classes.py
class Foo:
def __init__(self, a):
self.a = a
def make_a(self):
print('hello')
mod1/recessed.py:
from test_jedi.classes import Foo
Foo(5).make_a()
print('Ran this')
script.py:
from classes import Foo
a = Foo(5)
a.make_a()
Now from within vim with recessed.py in the buffer I am able to use GoTo
on Foo
to immediately open a classes.py
buffer. When I then try GoToReferences
from the classes.py
buffer I only get the usages
in script.py
and in classes.py
. I am at a loss to why jedi does not show me the usage in recessed.py
This is the quickfix buffer that shows:
classes.py|2 col 7| class Foo
script.py|2 col 21| from classes import Foo
script.py|5 col 5| a = Foo(5)
But clearly there is no reference to mod1/recessed.py which clearly has a usage of Foo
.
Any ideas?