pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
574 stars 44 forks source link

Query Regarding Wild-card Import Support for "Go to Definition" #278

Closed code2graph closed 10 months ago

code2graph commented 10 months ago

I'm reaching out to understand the current capability of jedi-language-server in handling "Go to Definition" for wild-card imports in Python. Specifically, I'd like to know the extent of its support and how it manages potential ambiguities.

Example for Clarification Given the following code structure:

module_a.py:

def function_a():
    return "Hello from function_a"

module_b.py:

from module_a import *

In module_b.py, if I attempt to use the "Go to Definition" feature on function_a(), what behavior should I expect? Does the server recognize function_a as being imported from module_a.py via the wild-card import?

I understand the inherent complexities with wild-card imports, especially in static code analysis. I'm keen on understanding the current state of this feature in jedi-language-server and any potential future enhancements about this issue.

pappasam commented 10 months ago

This is the sort of thing you can test our yourself pretty easily. Based on this example, Jedi appears to be able to handle (at least simple) wildcards imports:

Peek 2023-08-18 10-12