Path: blob/main/src/vs/workbench/contrib/dropOrPasteInto/browser/commands.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { toAction } from '../../../../base/common/actions.js';6import { CopyPasteController, pasteAsPreferenceConfig } from '../../../../editor/contrib/dropOrPasteInto/browser/copyPasteController.js';7import { DropIntoEditorController, dropAsPreferenceConfig } from '../../../../editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js';8import { localize } from '../../../../nls.js';9import { IWorkbenchContribution } from '../../../common/contributions.js';10import { IPreferencesService } from '../../../services/preferences/common/preferences.js';1112export class DropOrPasteIntoCommands implements IWorkbenchContribution {13public static ID = 'workbench.contrib.dropOrPasteInto';1415constructor(16@IPreferencesService private readonly _preferencesService: IPreferencesService17) {18CopyPasteController.setConfigureDefaultAction(toAction({19id: 'workbench.action.configurePreferredPasteAction',20label: localize('configureDefaultPaste.label', 'Configure preferred paste action...'),21run: () => this.configurePreferredPasteAction()22}));2324DropIntoEditorController.setConfigureDefaultAction(toAction({25id: 'workbench.action.configurePreferredDropAction',26label: localize('configureDefaultDrop.label', 'Configure preferred drop action...'),27run: () => this.configurePreferredDropAction()28}));29}3031private configurePreferredPasteAction() {32return this._preferencesService.openUserSettings({33jsonEditor: true,34revealSetting: { key: pasteAsPreferenceConfig, edit: true }35});36}3738private configurePreferredDropAction() {39return this._preferencesService.openUserSettings({40jsonEditor: true,41revealSetting: { key: dropAsPreferenceConfig, edit: true }42});43}44}454647