mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-18 19:41:34 +00:00
<!-- Thank you for contributing to Ruff/ty! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> Partially addresses https://github.com/astral-sh/ty/issues/1562 Only suggest the keyword "as" in import statements when the user have written `import foo a<CURSOR>` or `from foo import bar a<CURSOR>` as no other suggestion makes sense here. Re-uses the existing pattern for incomplete `import from` statements to determine incomplete import alias statements and make the suggestions more sane in those cases. There was a potential suggestion from @BurntSushi in https://github.com/astral-sh/ty/issues/1562#issue-3626853513 to move the handling of import statements into one unified state machine but I acted on the side of caution and fixed this with already established patterns, pending a potential bigger re-write down the line. ## Test Plan Added new tests and checked that it behaved reasonable in the playground. <!-- How was it tested? --> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||