From 01cc5003514f7d689b269c440f8c026303b9dd57 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 22 Nov 2019 12:12:37 +0100 Subject: [PATCH] alternative action cannot be action itself, #73081 --- src/vs/editor/contrib/gotoSymbol/goToCommands.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/contrib/gotoSymbol/goToCommands.ts b/src/vs/editor/contrib/gotoSymbol/goToCommands.ts index 328eb593053..f2d7748031a 100644 --- a/src/vs/editor/contrib/gotoSymbol/goToCommands.ts +++ b/src/vs/editor/contrib/gotoSymbol/goToCommands.ts @@ -34,7 +34,7 @@ import { EditorOption, GoToLocationValues } from 'vs/editor/common/config/editor import { isStandalone } from 'vs/base/browser/browser'; import { URI } from 'vs/base/common/uri'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { ScrollType } from 'vs/editor/common/editorCommon'; +import { ScrollType, IEditorAction } from 'vs/editor/common/editorCommon'; import { assertType } from 'vs/base/common/types'; @@ -82,8 +82,15 @@ abstract class SymbolNavigationAction extends EditorAction { alert(references.ariaMessage); + let altAction: IEditorAction | null | undefined; + if (references.referenceAt(model.uri, pos)) { + const altActionId = this._getAlternativeCommand(editor); + if (altActionId !== this.id) { + altAction = editor.getAction(altActionId); + } + } + const referenceCount = references.references.length; - const altAction = references.referenceAt(model.uri, pos) && editor.getAction(this._getAlternativeCommand(editor)); if (referenceCount === 0) { // no result -> show message -- GitLab