Skip to content

Move the "Add Dependency" fix to middleware - #6062

Merged
DanTup merged 2 commits into
masterfrom
move-add-dep-fix-to-middleware
May 26, 2026
Merged

DanTup merged 2 commits into
masterfrom
move-add-dep-fix-to-middleware

Conversation

@DanTup

@DanTup DanTup commented May 26, 2026

Copy link
Copy Markdown
Member

This should fix the race that could cause it appear at the bottom instead of the top.

Fixes #5968

This should fix the race that could cause it appear at the bottom instead of the top.

Fixes #5968
@DanTup DanTup added this to the v3.136.0 milestone May 26, 2026
@DanTup DanTup added is bug fix in editor Relates to code editing or language features labels May 26, 2026
@DanTup
DanTup requested a review from Copilot May 26, 2026 10:18

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request integrates the AddDependencyCodeActionProvider directly into the LSP analyzer's provideCodeActions middleware rather than registering it as a separate VS Code code action provider. This ensures custom dependency fixes are stitched in at the top of the results. One issue was identified where using the spread operator inside push on a potentially large array could lead to a stack overflow, and it is recommended to use concat instead.

Comment thread src/extension/analysis/analyzer.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

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 addresses a race in Quick Fix ordering by moving the custom “Add dependency” fix integration into the LSP middleware, ensuring it appears before server-provided fixes like “Ignore”.

Changes:

  • Remove delayed VS Code registration of AddDependencyCodeActionProvider from extension activation.
  • Instantiate and invoke AddDependencyCodeActionProvider inside LSP provideCodeActions middleware and prepend its results.
  • Update the provider’s provideCodeActions signature to return (Command | CodeAction)[] to align with LSP/middleware usage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/extension/providers/add_dependency_code_action_provider.ts Adjusts provider API typing to support being invoked from middleware.
src/extension/extension.ts Removes delayed provider registration logic previously used to influence ordering.
src/extension/analysis/analyzer.ts Adds middleware stitching to insert custom “Add dependency” fixes at the top of LSP code actions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/extension/providers/add_dependency_code_action_provider.ts Outdated

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.47%. Comparing base (b51637e) to head (162849f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6062      +/-   ##
==========================================
- Coverage   70.49%   70.47%   -0.02%     
==========================================
  Files         171      171              
  Lines       12981    12983       +2     
  Branches     2591     2592       +1     
==========================================
- Hits         9151     9150       -1     
- Misses       3343     3345       +2     
- Partials      487      488       +1     

☔ 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.

@DanTup
DanTup merged commit 342fc0b into master May 26, 2026
21 checks passed
@DanTup
DanTup deleted the move-add-dep-fix-to-middleware branch May 26, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in editor Relates to code editing or language features is bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Add 'package' to dependencies" fix sometimes appears after "Ignore" actions

2 participants