-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support a "getCombinedCodeFix" service #20338
Merged
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5c70641
Support a "getCombinedCodeFix" service
be19542
Rename things
8a1865f
Code review
b89b7fe
Merge branch 'master' into codeFixAll
a8b3afc
Rename things
a38216c
Update API baselines
c621e3f
CodeActionAll -> CombinedCodeActions
d0af16a
Merge branch 'master' into codeFixAll
2db8649
Take a `scope` parameter instead of `fileName` for flexibility
f2031be
Renames and bugfixes
79c0150
Merge branch 'master' into codeFixAll
8a61761
Make API changes internal
41c5710
Merge branch 'master' into codeFixAll
87d30c0
Code review
5f7ba73
Update comment
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,9 +99,12 @@ namespace ts.server.protocol { | |
BreakpointStatement = "breakpointStatement", | ||
CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects", | ||
GetCodeFixes = "getCodeFixes", | ||
ApplyCodeActionCommand = "applyCodeActionCommand", | ||
/* @internal */ | ||
GetCodeFixesFull = "getCodeFixes-full", | ||
GetCombinedCodeFix = "getCombinedCodeFix", | ||
/* @internal */ | ||
GetCombinedCodeFixFull = "getCombinedCodeFix-full", | ||
ApplyCodeActionCommand = "applyCodeActionCommand", | ||
GetSupportedCodeFixes = "getSupportedCodeFixes", | ||
|
||
GetApplicableRefactors = "getApplicableRefactors", | ||
|
@@ -533,6 +536,15 @@ namespace ts.server.protocol { | |
arguments: CodeFixRequestArgs; | ||
} | ||
|
||
export interface GetCombinedCodeFixRequest extends Request { | ||
command: CommandTypes.GetCombinedCodeFix; | ||
arguments: GetCombinedCodeFixRequestArgs; | ||
} | ||
|
||
export interface GetCombinedCodeFixResponse extends Response { | ||
body: CodeActionAll; | ||
} | ||
|
||
export interface ApplyCodeActionCommandRequest extends Request { | ||
command: CommandTypes.ApplyCodeActionCommand; | ||
arguments: ApplyCodeActionCommandRequestArgs; | ||
|
@@ -585,6 +597,10 @@ namespace ts.server.protocol { | |
errorCodes?: number[]; | ||
} | ||
|
||
export interface GetCombinedCodeFixRequestArgs extends FileRequestArgs { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a |
||
actionId: {}; | ||
} | ||
|
||
export interface ApplyCodeActionCommandRequestArgs { | ||
/** May also be an array of commands. */ | ||
command: {}; | ||
|
@@ -1568,7 +1584,7 @@ namespace ts.server.protocol { | |
|
||
export interface CodeFixResponse extends Response { | ||
/** The code actions that are available */ | ||
body?: CodeAction[]; | ||
body?: CodeFix[]; | ||
} | ||
|
||
export interface CodeAction { | ||
|
@@ -1580,6 +1596,16 @@ namespace ts.server.protocol { | |
commands?: {}[]; | ||
} | ||
|
||
export interface CodeActionAll { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
changes: FileCodeEdits[]; | ||
commands?: {}[]; | ||
} | ||
|
||
export interface CodeFix extends CodeAction { | ||
/** If present, one may call 'getAllCodeFixesInGroup' with this actionId. */ | ||
actionId?: {}; | ||
} | ||
|
||
/** | ||
* Format and format on key response message. | ||
*/ | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this always be currentFile. Api call returns TextChangeRange which has file name per change.. So wouldnt it need to verify all those files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an assertion that all changes are for the current file and a TODO for if we need to test changes affecting multiple files.