class BaseTransport:
def get(self, path):
return f"a get stuff with {path}"
From my_project/my_project/dns/__init__.py this will work fine:
from .. import get_version
from ..protocol import BaseTransport
From my_project/my_project/dns/protocol.py this won't complete and references will not work (i.e gd on neovim):
from .. import get_version
from ..protocol import BaseTransport
From my_project/my_project/dns/service.py :
from .. import get_version // <==== not recognized
from ..protocol import BaseTransport // this will work fine
If I rename my_project/my_project/protocol.py to my_project/my_project/base_protocol.py on my_project/my_project/dns/protocol.py I have this situation:
from .. import get_version // <==== this is still not recognized
from ..base_protocol import BaseTransport // this will work fine
If I don't use relative imports and from my_project.protocol import BaseTransport instead, I cannot observe the issue.
The code with relative imports, will run without issues, and will work on PyCharm, for instance.
The lsp root directory is \<absolute_path>\my_project. Installed python-lsp-server via Mason.
While relative importing classes from a module that has the same name of the module I'm editing, completions/references are not available for me.
Steps to reproduce:
Take this file structure:
my_project
(dir)my_project
(dir)__init__.py
protocol.py
dns
(dir)__init__.py
protocol.py
service.py
On
my_project/my_project/__init__.py
we have:On
my_project/my_project/protocol.py
we have:From
my_project/my_project/dns/__init__.py
this will work fine:From
my_project/my_project/dns/protocol.py
this won't complete and references will not work (i.e gd on neovim):From
my_project/my_project/dns/service.py
:If I rename
my_project/my_project/protocol.py
tomy_project/my_project/base_protocol.py
onmy_project/my_project/dns/protocol.py
I have this situation:If I don't use relative imports and
from my_project.protocol import BaseTransport
instead, I cannot observe the issue.The code with relative imports, will run without issues, and will work on PyCharm, for instance.
The lsp root directory is
\<absolute_path>\my_project
. Installed python-lsp-server via Mason.Could you please take a look at this?