mirror of https://github.com/astral-sh/ruff
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. |
||
|---|---|---|
| .. | ||
| resources | ||
| src | ||
| tests | ||
| Cargo.toml | ||
| build.rs | ||
| mdtest.py | ||
| mdtest.py.lock | ||