feat: Add "Fix all: X" code action for codefixes appearing multiple times in a file - #11468
feat: Add "Fix all: X" code action for codefixes appearing multiple times in a file#11468timotheeguerin with Copilot wants to merge 4 commits into
Conversation
|
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>
commit: |
|
You can try these changes here
|
|
@copilot I don't see the fix all in the playground |
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
The playground uses its own Monaco code action provider (in |
|
@copilot build fails now why are we adding all those computer types here they should be exported |
…osure Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
... Fixed in the latest commit. The helper |
The TypeSpec language server only offered per-instance quick fixes. ESLint-style "Fix all X problems" was missing, so users had to manually apply the same fix repeatedly for e.g. multiple unused
usingstatements.Changes
serverlib.tscurrentDiagnosticIndexnow stores{ diagnostic, fileUri }instead of justDiagnostic, enabling file-scoped lookup without resolving AST nodesgetCodeActions: after building individual fixes, counts how many times each codefix ID appears across all diagnostics in the same file; adds a"Fix all: <label>"action (kindQuickFix) when count > 1, carrying{ fixAllInFile: { fixId, fileUri } }indataresolveCodeAction: handlesfixAllInFiledata by collecting and merging edits from every matching codefix in the target file into one workspace editExample
Given two unused
usingstatements, the lightbulb menu now shows:test/server/code-actions.test.ts— new tests covering: