Skip to content

feat: enrich completion info#94

Merged
bellini666 merged 4 commits intobellini666:masterfrom
benediktziegler:rich-completion-info
Feb 23, 2026
Merged

feat: enrich completion info#94
bellini666 merged 4 commits intobellini666:masterfrom
benediktziegler:rich-completion-info

Conversation

@benediktziegler
Copy link
Copy Markdown
Contributor

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:

  • Added a fixture_scope field to the CompletionContext::FunctionSignature and CompletionContext::FunctionBody variants, allowing the completion logic to be aware of the fixture's scope when inside a fixture function. (src/fixtures/types.rs)
  • Updated the fixture resolver to extract and assign the fixture scope using the decorator list when determining the completion context, defaulting to Function scope if not specified. (src/fixtures/resolver.rs)
  • Ensured the new fixture_scope field is populated in both function signature and function body completion contexts. (src/fixtures/resolver.rs)

- 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
Copy link
Copy Markdown

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.22%. Comparing base (f50c9d3) to head (7f2dac2).
⚠️ Report is 5 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_scope field to CompletionContext::FunctionSignature and CompletionContext::FunctionBody variants 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.

Copy link
Copy Markdown
Owner

@bellini666 bellini666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! :)

@bellini666 bellini666 merged commit a144958 into bellini666:master Feb 23, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants