Skip to content

Cascade code actions on save by provider - #328186

Open
Vivek JM (vivekjm) wants to merge 2 commits into
microsoft:mainfrom
vivekjm:fix/organize-imports-conflict
Open

Cascade code actions on save by provider#328186
Vivek JM (vivekjm) wants to merge 2 commits into
microsoft:mainfrom
vivekjm:fix/organize-imports-conflict

Conversation

@vivekjm

Copy link
Copy Markdown
Contributor

Fixes #174295

Code action providers used for save participants were queried concurrently against the same document version, but their edits were then applied sequentially. When multiple import organizers returned edits, the later provider could apply stale offsets and duplicate or corrupt imports.

This queries and applies providers sequentially in the registry's deterministic order. Each provider therefore sees the document after the preceding provider's edits, while action ordering within a provider remains unchanged.

Tests run:

  • npm run typecheck-client
  • npm run gulp compile (0 errors)
  • Save Participants suite (6 passing), including a regression that reproduced the duplicate import before the fix
  • CodeAction suite (7 passing)
  • Targeted ESLint, pre-commit hygiene, and diff checks

Copilot AI review requested due to automatic review settings July 30, 2026 10:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Cascades editor code actions on save so each provider sees prior edits.

Changes:

  • Adds provider-specific code-action querying.
  • Applies save actions sequentially by provider.
  • Adds a regression test for import corruption.

Reviewed changes

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

File Description
codeAction.ts Adds optional provider filtering.
saveParticipants.ts Serializes providers during editor saves.
saveParticipant.test.ts Tests cascading import organizers.

Comment thread src/vs/workbench/contrib/codeEditor/browser/saveParticipants.ts
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.

Multiple Import Organizers results in corrupted code

3 participants