Skip to content

Commit 74ad416

Browse files
committed
update doc comment and resolve logic
1 parent f8ad845 commit 74ad416

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/vs/editor/contrib/codeAction/codeAction.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ export class CodeActionItem {
3232
) { }
3333

3434
async resolve(token: CancellationToken): Promise<this> {
35-
// TODO@jrieken when is an item resolved already?
36-
if (this.provider?.resolveCodeAction && !this.action.edit && !this.action.command) {
35+
if (this.provider?.resolveCodeAction && !this.action.edit) {
3736
let action: modes.CodeAction | undefined | null;
3837
try {
3938
action = await this.provider.resolveCodeAction(this.action, token);

src/vs/vscode.proposed.d.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,21 @@ declare module 'vscode' {
1919
//#region https://github.com/microsoft/vscode/issues/106410
2020

2121
export interface CodeActionProvider<T extends CodeAction = CodeAction> {
22-
// TODO@jrieken make it clear that there is no support for commands, only code action
23-
// TODO@jrieken only edit can be set
22+
23+
/**
24+
* Given a code action fill in its [`edit`](#CodeAction.edit)-property, changes to
25+
* all other properties, like title, are ignored. A code action that has an edit
26+
* will not be resolved.
27+
*
28+
* *Note* that a code action provider that returns commands, not code actions, cannot successfully
29+
* implement this function. Returning commands is deprecated and instead code actions should be
30+
* returned.
31+
*
32+
* @param codeAction A code action.
33+
* @param token A cancellation token.
34+
* @return The resolved code action or a thenable that resolve to such. It is OK to return the given
35+
* `item`. When no result is returned, the given `item` will be used.
36+
*/
2437
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>;
2538
}
2639

0 commit comments

Comments
 (0)