ruff/crates/ty_python_semantic/src
Andrew Gallant 33ed502edb ty_ide: improve completions by using scopes
Previously, completions were based on just returning every identifier
parsed in the current Python file. In this commit, we change it to
identify an expression under the cursor and then return all symbols
available to the scope containing that expression.

This is still returning too much, and also, in some cases, not enough.
Namely, it doesn't really take the specific context into account other
than scope. But this does improve on the status quo. For example:

    def foo(): ...
    def bar():
        def fast(): ...
    def foofoo(): ...

    f<CURSOR>

When asking for completions here, the LSP will no longer include `fast`
as a possible completion in this context.

Ref https://github.com/astral-sh/ty/issues/86
2025-05-29 10:31:30 -04:00
..
module_resolver [ty] Support ephemeral uv virtual environments (#18335) 2025-05-28 14:54:59 +00:00
semantic_index [ty] Add a subdiagnostic if invalid-return-type is emitted on a method with an empty body on a non-protocol subclass of a protocol class (#18243) 2025-05-21 17:38:07 +00:00
types [ty] Split Type::KnownInstance into two type variants (#18350) 2025-05-29 14:47:55 +01:00
util [ty] Tell the user why we inferred a certain Python version when reporting version-specific syntax errors (#18295) 2025-05-26 20:44:43 +00:00
ast_node_ref.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
db.rs [ty] Tell the user why we inferred the Python version we inferred (#18082) 2025-05-21 11:06:27 -04:00
dunder_all.rs [ty] Support import <namespace> and from <namespace> import module (#18137) 2025-05-21 07:28:33 +00:00
lib.rs [ty] Tell the user why we inferred a certain Python version when reporting version-specific syntax errors (#18295) 2025-05-26 20:44:43 +00:00
lint.rs [ty] Ignore possibly-unresolved-reference by default (#17934) 2025-05-08 17:44:56 +02:00
list.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
module_name.rs Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
node_key.rs Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
program.rs [ty] Resolving Python path using CONDA_PREFIX variable to support Conda and Pixi (#18267) 2025-05-23 20:00:42 +02:00
python_platform.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
semantic_index.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
semantic_model.rs ty_ide: improve completions by using scopes 2025-05-29 10:31:30 -04:00
site_packages.rs [ty] Support ephemeral uv virtual environments (#18335) 2025-05-28 14:54:59 +00:00
suppression.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
symbol.rs [ty] Split Type::KnownInstance into two type variants (#18350) 2025-05-29 14:47:55 +01:00
types.rs [ty] Split Type::KnownInstance into two type variants (#18350) 2025-05-29 14:47:55 +01:00
unpack.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00