Add detection for unimported modules/packages used as a base for classes #1955
Description
This may have further implications and may actually be a bug but I will describe here.
from django.shortcuts import render
@method_decorator(staff_member_required, name='dispatch')
class IndexView(TemplateView):
def get(self, request):
pass
The above file will cause django to fail when it parses since it can't find TemplateView
. Where the bug may be is that the language server does not flag this as a missing import. I honestly can't say if Jedi does as I haven't used it on any project for months. Anyways since this is not flagged by the engine you can not use the auto import feature! I can get around this by doing the following:
Then I can remove the t = TemplateView
and everything is good. So this may be a bug, since maybe the engine should detect unimported references when used as a base class definition?? But maybe that's intended; if so it'd be great it we could use the import function in that way!
Cheers!