Feature suggestion: Code Action to create module (or package) from a missing import
Given something like below, which reports reportMissingImports: Import "package.bar" could not be resolved
from package.bar import foo
Provide a code action to create a module bar.py, or a package bar/__init__.py.
If this were viable:
- It should perhaps be scoped to the local package, or editably installed packages, if that's possible
- I could imagine also having a code action to create
foo = ...from the missingfooattribute also.
related: #101
as i said there, i don't personally find code actions like that to be very useful. usually they just get in my way when im trying to import something, but im open to the idea if it's something people want
I can agree to your general statement because ruff-lsp exposes an "organize imports" and a "fix all issues" action always. And I essentially always want "fix all issues". But my main point of comparison is rust where they implement all sorts of convenience actions. Not all of them are useful, but many of them frequently are!
I guess what I'd say is code actions that are localized to a specific location should probably be the most relevant action for that location. if you took the time to get the cursor onto the relevant location it would ideally always show up first over everything else and there only be 1 logical choice. And in the cases most of the suggested actions (this one, #101, #198) it seems like that would be the case, and it'd mostly be a choice between something and nothing 🤷 (or a global action i guess).
And this particular action would, i think, save people a disproportionate amount of effort to create the file, however one might otherwise do that.