From b46b5251ae0d078c875f46cd55c100bde63023a6 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 18 Jun 2020 18:09:20 -0700 Subject: [PATCH] Extract constant --- src/vs/editor/contrib/codeAction/codeAction.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/codeAction.ts b/src/vs/editor/contrib/codeAction/codeAction.ts index b9e30b80525..f54e722566e 100644 --- a/src/vs/editor/contrib/codeAction/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/codeAction.ts @@ -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, @@ -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)); @@ -111,7 +114,7 @@ export function getCodeActions( throw err; } onUnexpectedExternalError(err); - return { actions: [] as modes.CodeAction[], documentation: undefined }; + return emptyCodeActionsResponse; } });