Skip to content

Proposal: 'Fix All In File' for CodeFixes #14549

@mjbvz

Description

@mjbvz

From microsoft/vscode#22220

Problem
The current TypeScript code fixes must be applied individual. For fixes such as remove unused import, we would also like to support applying the fix to across all effected locations in a file.

Possible Approaches
To support this scenario across various editors and tools, the best approach would have the TSServer itself return Fix all in File type code fixes when getCodeFixes is requested. No TSServer API/protocol would have to be updated to support this. My only concern is that calculating the edits for fixing all problem in a file may be expensive and could bog down the TSServer.

The alternative would be to implement the fix all in file logic in VSCode. To do this, we would make multiple calls to getCodeFixes against the TSServer to build up a set of fix all in file code actions. Each type of CodeAction returned by TSServer would need a kind identifier so that we can bundle all instances of the same kind together. We would also need to know which types of code fixes can be applied across an entire file

@mhegazy and anyone else, please let me know if you have any thoughts on this

Metadata

Metadata

Assignees

No one assigned

    Labels

    CommittedThe team has roadmapped this issueFixedA PR has been merged for this issueSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions