-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Simpler quick fix API #46249
Copy link
Copy link
Open
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptDomain: LS: TSServerIssues related to the TSServerIssues related to the TSServerIn DiscussionNot yet reached consensusNot yet reached consensusRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScriptVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestoneCritical issues that VS Code needs fixed in the current TypeScript milestone
Milestone
Metadata
Metadata
Assignees
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptDomain: LS: TSServerIssues related to the TSServerIssues related to the TSServerIn DiscussionNot yet reached consensusNot yet reached consensusRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScriptVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestoneCritical issues that VS Code needs fixed in the current TypeScript milestone
Follow up on #27614
Search terms
getCodeFixesgetSupportedCodeFixesProblem
The
getCodeFixesAPI currently takes a range plus a diagnostic code. Currently, the range we pass to it has to match the range of the diagnostic we are trying to fix. This API is difficult for editors to implement for a few reasons:Proposal
We should consider a new quick fix API that addresses these problems and also is better aligned with the language server protocol. My proposal is that instead of having to think about diagnostics, editors pass the TS Server a range and are returned the valid quick fixes in that range.
Here's what the VS Code api for this looks like:
https://github.com/microsoft/vscode/blob/9a21b536639c2d986c50fb51b7da67bafdb50c9b/src/vs/vscode.d.ts#L2336
And here's the LSP:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction