3

If I use evil-jump-to-tag or xref-find-defintions on an inherited class module whose name is the same as a class in my current project, I am taken to the definition in the current project. I would expect to go to the definition given in the module.

Aside from renaming the class in my current project, how I can I navigate to the module?

For example

Suppose my_module.py defines a custom MainWindow that I use in my_project.py:


# my_module.py

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self):
        super().__init__()
        print("My module!")

# my_project

class MainWindow(my_module.MainWindow):

    def __init__(self):
        super().__init__()
        print("My project calling my module!")

If my cursor is |, then a call to evil-jump-to-tag or xref-find-defintions at

# my_project.py
class MainWindow(my_module.MainWind|ow):

moves my cursor to

# my_project.py
class |MainWindow(my_module.MainWindow):

I would expect it to take me to

# my_module.py
class |MainWindow(QtWidgets.QMainWindow): 

What can I do, aside from renaming the class in my_project.py, to help xref understand that my_module.MainWindow lives in my_module.py?


Configuration details

I am using Gnu Emacs 26.1 on Windows 10 with Python 3. I edit Python files with elpy and evil. The elpy-config reads:

Elpy Configuration

Virtualenv........: venv (c:/projects/my_project/venv)
RPC Python........: 3.6.8 (c:/projects/my_project/venv/Scripts/python.exe)
Interactive Python: ipython (c:/projects/my_project/venv/Scripts/ipython.exe)
Emacs.............: 26.1
Elpy..............: 1.28.0
Jedi..............: 0.13.2
Rope..............: 0.11.0
Autopep8..........: 1.4.3
Yapf..............: 0.25.0
Black.............: 18.9b0
Syntax checker....: flake8.exe (c:/projects/my_project/venv/Scripts/flake8.exe)

I have not done any configuration for xref. Until now, it has Just Worked™.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.