mirror of https://github.com/astral-sh/ruff
[ty] Refactor completion generation
This refactor is intended to give more structure to how we generate completions. There's now a `Context` for "how do we figure out what kind of completions to offer" and also a `CollectionContext` for "how do we figure out which completions are appropriate or not." We double down on `Completions` as a collector and a single point of truth for this. It now handles adding information to `Completion` (based on the context) and also skipping completions that are inappropriate (instead of filtering them after-the-fact). We also bundle a bunch of state into a new `ContextCursor` type, and then define a bunch of predicates/accessors on that type that were previously free functions with loads of parameters. Finally, we introduce more structure to ranking. Instead of an anonymous tuple, we define an explicit type with some helper types to hopefully make the influence on ranking from each constituent piece a bit clearer. This does seem to fix one bug around detecting the target for non-import completions, but otherwise should not have any changes in behavior. This is meant to be a precursor to improving completion ranking.
This commit is contained in:
parent
10748b2fdb
commit
bab3924833
File diff suppressed because it is too large
Load Diff
|
|
@ -380,7 +380,7 @@ pub struct MemberDefinition<'db> {
|
|||
/// single-underscore names. This matches the order of the variants defined for
|
||||
/// this enum, which is in turn picked up by the derived trait implementation
|
||||
/// for `Ord`.
|
||||
#[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)]
|
||||
pub enum NameKind {
|
||||
Normal,
|
||||
Dunder,
|
||||
|
|
|
|||
Loading…
Reference in New Issue