Skip to content

feat: Add "Fix all: X" code action for codefixes appearing multiple times in a file - #11468

Open
timotheeguerin with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-codefixes-suggest-fix-all
Open

feat: Add "Fix all: X" code action for codefixes appearing multiple times in a file#11468
timotheeguerin with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-codefixes-suggest-fix-all

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Add fix all per code fix
image

Screen.Recording.2026-07-30.at.9.13.07.AM.mov

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

…s in a file

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the compiler:core Issues for @typespec/compiler label Jul 30, 2026
Copilot AI changed the title [WIP] Implement codefixes to suggest a fix all for a given file feat: Add "Fix all: X" code action for codefixes appearing multiple times in a file Jul 30, 2026
Copilot AI requested a review from timotheeguerin July 30, 2026 01:47
@timotheeguerin
timotheeguerin marked this pull request as ready for review July 30, 2026 11:10
@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@11468
npm i https://pkg.pr.new/@typespec/playground@11468

commit: 7de17a1

@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin

Copy link
Copy Markdown
Member

@copilot I don't see the fix all in the playground

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot I don't see the fix all in the playground

The playground uses its own Monaco code action provider (in packages/playground/src/services.ts) that doesn't go through the LSP server — so the "Fix all" logic I added to serverlib.ts wasn't visible there. Fixed in commit feat: add Fix all code action to playground code action provider: the playground's provider now does the same two-pass approach — grouping all fix IDs across the whole file first, then adding a Fix all: <label> action for any fix that appears more than once.

@timotheeguerin

Copy link
Copy Markdown
Member

@copilot build fails now

vite v8.1.4 building client environment for production...
src/services.ts:400:42 - error TS18048: 'compiler' is possibly 'undefined'.

400         edits: Awaited<ReturnType<typeof compiler.resolveCodeFix>>,
                                             ~~~~~~~~


why are we adding all those computer types here they should be exported

…osure

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot build fails now

vite v8.1.4 building client environment for production...

...

Fixed in the latest commit. The helper codeFixEditsToMonacoEdits is now a module-level function (so there's no captured compiler variable in its type), and it takes CodeFixEdit[] — using the CodeFix and CodeFixEdit types imported directly from @typespec/compiler instead of the inline Awaited<ReturnType<typeof compiler.resolveCodeFix>> expression.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/compiler
  • @typespec/playground
Show changes

@typespec/compiler - feature ✏️

Add Fix all: X code action for codefixes that can be applied to multiple instances in a file at once. When a codefix applies to more than one diagnostic of the same kind in a file, a Fix all: <fix label> quick fix action is now suggested alongside the individual fix.

@typespec/playground - feature ✏️

Add support for the Fix all: X code action in the playground, allowing a codefix that appears multiple times in a file to be applied to all instances at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler ui:playground

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codefixes should suggest a fix all for a given file

2 participants