[ty] provide import completion when in from <name> <name> statement by MatthewMckee4 · Pull Request #21291 · astral-sh/ruff (original) (raw)

@MatthewMckee4 MatthewMckee4 changed the title[ty] Don't provide completions when in 'from i' statement [ty] Don't provide completions when in 'from ' statement

Nov 6, 2025

@MatthewMckee4 MatthewMckee4 changed the title[ty] Don't provide completions when in 'from ' statement [ty] Don't provide completions when in from <name> <name> statement

Nov 6, 2025

@MatthewMckee4 MatthewMckee4 changed the title[ty] Don't provide completions when in from <name> <name> statement [ty] Don't import completion when in from <name> <name> statement

Nov 6, 2025

@MatthewMckee4 MatthewMckee4 changed the title[ty] Don't import completion when in from <name> <name> statement [ty] provide import completion when in from <name> <name> statement

Nov 6, 2025

MichaReiser

AlexWaygood

BurntSushi

AlexWaygood

AlexWaygood

AlexWaygood

MichaReiser

MichaReiser

BurntSushi

BurntSushi

@MatthewMckee4 @BurntSushi

This works principally by copying from_import_tokens and tweaking it a bit to look for from module <CURSOR> token sequences. We actually wind up needing to be a little more careful here to parse <module> correctly to avoid something like from os.i<CURSOR> from being treated as if the i is the beginning of the import keyword.

Fixes astral-sh/ty#1494

dcreager added a commit that referenced this pull request

Nov 11, 2025

@dcreager

BurntSushi added a commit that referenced this pull request

Nov 11, 2025

@BurntSushi

Ideally this would have been added as part of #21291, but I forgot.

BurntSushi added a commit that referenced this pull request

Nov 11, 2025

@BurntSushi

Ideally this would have been added as part of #21291, but I forgot.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})