feat: enrich completion info#94
Conversation
- Completions now filter out fixtures with narrower scope than the current fixture, following pytest's dependency rules - Fixtures are sorted by proximity: same file, conftest, plugin, third-party - Completion items show richer detail strings with filename, scope, and origin - Extensive tests added for scope filtering, proximity, and detail rendering
Now only scope and origin tags are shown in completion details. Updates tests to match new format.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #94 +/- ##
==========================================
+ Coverage 57.71% 61.22% +3.50%
==========================================
Files 26 26
Lines 3155 3198 +43
==========================================
+ Hits 1821 1958 +137
+ Misses 1334 1240 -94 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR enhances the fixture completion system by adding scope tracking and implementing scope-aware filtering, proximity-based sorting, and richer detail strings for completion items. The changes enable more intelligent fixture suggestions that respect pytest's scope dependency constraints while improving the user experience through better organization and contextual information.
Changes:
- Added
fixture_scopefield toCompletionContext::FunctionSignatureandCompletionContext::FunctionBodyvariants to track the scope of fixture functions - Implemented scope-aware filtering that prevents suggesting fixtures with incompatible (narrower) scopes based on pytest's dependency rules
- Added proximity-based sorting (same file → conftest → plugin → third-party) and enriched detail strings showing scope and origin tags
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/fixtures/types.rs | Added fixture_scope: Option<FixtureScope> field to FunctionSignature and FunctionBody completion context variants with documentation |
| src/fixtures/resolver.rs | Extracts fixture scope from decorators and populates the new field in completion contexts, defaulting to Function scope when unspecified |
| src/providers/completion.rs | Implements scope filtering logic, proximity-based sorting, and detail string formatting; adds comprehensive unit tests for new helper functions |
| tests/test_fixtures.rs | Adds extensive integration tests covering scope tracking, scope filtering for different fixture types, proximity sorting, and detail string generation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request enhances the fixture completion context by tracking and exposing the scope of fixtures within the completion logic. This will enable more accurate and scope-aware fixture suggestions in the future.
Fixture scope tracking improvements:
fixture_scopefield to theCompletionContext::FunctionSignatureandCompletionContext::FunctionBodyvariants, allowing the completion logic to be aware of the fixture's scope when inside a fixture function. (src/fixtures/types.rs)Functionscope if not specified. (src/fixtures/resolver.rs)fixture_scopefield is populated in both function signature and function body completion contexts. (src/fixtures/resolver.rs)