LSP-pyright icon indicating copy to clipboard operation
LSP-pyright copied to clipboard

How to get import auto suggestion from __init__.py files?

Open rocchidavide opened this issue 8 months ago • 1 comments

My django project structure is something like that:

django-project/
    .venv/
     manage.py
     project/
       settings.py
       bar/
         __init__.py
         models/
           __init__.py
           company.py
         api/
           __init__.py
           companies/
             views.py
             serializers.py

In models/__init__.py there are imports:

from .company import Company

Same way for api package.

The problem I need that LSP pyright suggests me imports from inits, for example:

from bar.models import Company

instead of

from bar.models.company import Company

My .sublime-project file contains these settings:

{
	"settings":
	{
		"LSP": {
			"LSP-pyright": {
				"settings": {
					"python.pythonPath": "$folder/.venv/bin/python3"
				}
			}
		}
	}
}

Is it possible? Thank you!

rocchidavide avatar Jun 25 '24 17:06 rocchidavide