Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)

* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2

* update distro

* fix layering

* update distro

* fix tests
This commit is contained in:
Anthony Dresser
2020-01-22 13:42:37 -08:00
committed by GitHub
parent 977111eb21
commit bd7aac8ee0
895 changed files with 24651 additions and 14520 deletions

View File

@@ -27,7 +27,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { getDefinitionsAtPosition, getImplementationsAtPosition, getTypeDefinitionsAtPosition, getDeclarationsAtPosition, getReferencesAtPosition } from './goToSymbol';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { EditorStateCancellationTokenSource, CodeEditorStateFlag } from 'vs/editor/browser/core/editorState';
import { ISymbolNavigationService } from 'vs/editor/contrib/gotoSymbol/symbolNavigation';
import { EditorOption, GoToLocationValues } from 'vs/editor/common/config/editorOptions';
@@ -681,14 +681,11 @@ registerEditorAction(class PeekReferencesAction extends ReferencesAction {
class GenericGoToLocationAction extends SymbolNavigationAction {
constructor(
config: SymbolNavigationActionConfig,
private readonly _references: Location[],
private readonly _gotoMultipleBehaviour: GoToLocationValues | undefined
private readonly _gotoMultipleBehaviour: GoToLocationValues | undefined,
) {
super({
muteMessage: true,
openInPeek: false,
openToSide: false
}, {
super(config, {
id: 'editor.action.goToLocation',
label: nls.localize('label.generic', "Go To Any Symbol"),
alias: 'Go To Any Symbol',
@@ -725,11 +722,12 @@ CommandsRegistry.registerCommand({
{ name: 'multiple', description: 'Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto' },
]
},
handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any, multiple?: any) => {
handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any, multiple?: any, openInPeek?: boolean) => {
assertType(URI.isUri(resource));
assertType(corePosition.Position.isIPosition(position));
assertType(Array.isArray(references));
assertType(typeof multiple === 'undefined' || typeof multiple === 'string');
assertType(typeof openInPeek === 'undefined' || typeof openInPeek === 'boolean');
const editorService = accessor.get(ICodeEditorService);
const editor = await editorService.openCodeEditor({ resource }, editorService.getFocusedCodeEditor());
@@ -739,13 +737,29 @@ CommandsRegistry.registerCommand({
editor.revealPositionInCenterIfOutsideViewport(position, ScrollType.Smooth);
return editor.invokeWithinContext(accessor => {
const command = new GenericGoToLocationAction(references, multiple as GoToLocationValues);
const command = new GenericGoToLocationAction({ muteMessage: true, openInPeek: Boolean(openInPeek), openToSide: false }, references, multiple as GoToLocationValues);
accessor.get(IInstantiationService).invokeFunction(command.run.bind(command), editor);
});
}
}
});
CommandsRegistry.registerCommand({
id: 'editor.action.peekLocations',
description: {
description: 'Peek locations from a position in a file',
args: [
{ name: 'uri', description: 'The text document in which to start', constraint: URI },
{ name: 'position', description: 'The position at which to start', constraint: corePosition.Position.isIPosition },
{ name: 'locations', description: 'An array of locations.', constraint: Array },
{ name: 'multiple', description: 'Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto' },
]
},
handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any, multiple?: any) => {
accessor.get(ICommandService).executeCommand('editor.action.goToLocations', resource, position, references, multiple, true);
}
});
//#endregion
@@ -776,6 +790,6 @@ CommandsRegistry.registerCommand({
});
// use NEW command
CommandsRegistry.registerCommandAlias('editor.action.showReferences', 'editor.action.goToLocations');
CommandsRegistry.registerCommandAlias('editor.action.showReferences', 'editor.action.peekLocations');
//#endregion