Support "Add Dependency" quickfix when a dev_dependency is used in a public file#5914
Support "Add Dependency" quickfix when a dev_dependency is used in a public file#5914
Conversation
…public file Fixes #5913
|
@codex review /gemini review |
|
I've reviewed this pull request, and the changes look good. The implementation correctly addresses the issue of conditionally offering "Add Dependency" quickfixes based on the file's location. Overall FeedbackThe changes are well-structured and directly solve the problem described in the pull request title and linked issue. The introduction of the Detailed ReviewFile:
File:
Style Guide AdherenceI've reviewed the code with general TypeScript best practices in mind. The changes adhere to a clear and consistent coding style, using meaningful variable names and clear logic. No specific style guide violations were found. |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #5913 where the "Add 'package' to dependencies" quickfix was not showing when a dev_dependency was used in a public file (lib/ or bin/). The fix ensures that when a package exists only in dev_dependencies but is imported from lib/ or bin/, the quickfix offers to add it to dependencies (and doesn't offer the dev_dependencies option, since that would be incorrect for public files).
Changes:
- Modified the dependency filtering logic to exclude dev_dependencies when determining if a package already exists in the pubspec, for files in lib/ or bin/
- Adjusted the code action creation to only offer the dev_dependencies option for files outside lib/ and bin/
- Added test coverage to verify that the fix works correctly for packages listed only in dev_dependencies when imported from lib/
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/extension/providers/add_dependency_code_action_provider.ts | Added logic to determine whether to include dev_dependencies based on file location (lib/bin vs other), and updated filtering and action creation accordingly |
| src/test/dart/pub/add.test.ts | Added test case to verify that quickfix correctly offers only "Add to dependencies" (not "Add to dev_dependencies") when a dev_dependency is used in lib/ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5914 +/- ##
==========================================
- Coverage 67.64% 67.60% -0.04%
==========================================
Files 169 169
Lines 12979 12980 +1
Branches 2566 2567 +1
==========================================
- Hits 8779 8775 -4
- Misses 3745 3749 +4
- Partials 455 456 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
011bcd5 to
f5f86e7
Compare
Fixes #5913