Skip to content

Commit

Permalink
Extract constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Jun 22, 2020
1 parent 8dc7bea commit b46b525
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vs/editor/contrib/codeAction/codeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class ManagedCodeActionSet extends Disposable implements CodeActionSet {
}
}


const emptyCodeActionsResponse = { actions: [] as modes.CodeAction[], documentation: undefined };

export function getCodeActions(
model: ITextModel,
rangeOrSelection: Range | Selection,
Expand Down Expand Up @@ -100,7 +103,7 @@ export function getCodeActions(
}

if (cts.token.isCancellationRequested) {
return { actions: [] as modes.CodeAction[], documentation: undefined };
return emptyCodeActionsResponse;
}

const filteredActions = (providedCodeActions?.actions || []).filter(action => action && filtersAction(filter, action));
Expand All @@ -111,7 +114,7 @@ export function getCodeActions(
throw err;
}
onUnexpectedExternalError(err);
return { actions: [] as modes.CodeAction[], documentation: undefined };
return emptyCodeActionsResponse;
}
});

Expand Down

0 comments on commit b46b525

Please sign in to comment.