update doc comment and resolve logic

This commit is contained in:
Johannes Rieken
2020-09-17 09:06:16 +02:00
parent f8ad845310
commit 74ad416ebc
2 changed files with 16 additions and 4 deletions
@@ -32,8 +32,7 @@ export class CodeActionItem {
) { }
async resolve(token: CancellationToken): Promise<this> {
// TODO@jrieken when is an item resolved already?
if (this.provider?.resolveCodeAction && !this.action.edit && !this.action.command) {
if (this.provider?.resolveCodeAction && !this.action.edit) {
let action: modes.CodeAction | undefined | null;
try {
action = await this.provider.resolveCodeAction(this.action, token);
+15 -2
View File
@@ -19,8 +19,21 @@ declare module 'vscode' {
//#region https://github.com/microsoft/vscode/issues/106410
export interface CodeActionProvider<T extends CodeAction = CodeAction> {
// TODO@jrieken make it clear that there is no support for commands, only code action
// TODO@jrieken only edit can be set
/**
* Given a code action fill in its [`edit`](#CodeAction.edit)-property, changes to
* all other properties, like title, are ignored. A code action that has an edit
* will not be resolved.
*
* *Note* that a code action provider that returns commands, not code actions, cannot successfully
* implement this function. Returning commands is deprecated and instead code actions should be
* returned.
*
* @param codeAction A code action.
* @param token A cancellation token.
* @return The resolved code action or a thenable that resolve to such. It is OK to return the given
* `item`. When no result is returned, the given `item` will be used.
*/
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>;
}