Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/dropOrPasteInto/browser/commands.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { toAction } from '../../../../base/common/actions.js';
7
import { CopyPasteController, pasteAsPreferenceConfig } from '../../../../editor/contrib/dropOrPasteInto/browser/copyPasteController.js';
8
import { DropIntoEditorController, dropAsPreferenceConfig } from '../../../../editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js';
9
import { localize } from '../../../../nls.js';
10
import { IWorkbenchContribution } from '../../../common/contributions.js';
11
import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
12
13
export class DropOrPasteIntoCommands implements IWorkbenchContribution {
14
public static ID = 'workbench.contrib.dropOrPasteInto';
15
16
constructor(
17
@IPreferencesService private readonly _preferencesService: IPreferencesService
18
) {
19
CopyPasteController.setConfigureDefaultAction(toAction({
20
id: 'workbench.action.configurePreferredPasteAction',
21
label: localize('configureDefaultPaste.label', 'Configure preferred paste action...'),
22
run: () => this.configurePreferredPasteAction()
23
}));
24
25
DropIntoEditorController.setConfigureDefaultAction(toAction({
26
id: 'workbench.action.configurePreferredDropAction',
27
label: localize('configureDefaultDrop.label', 'Configure preferred drop action...'),
28
run: () => this.configurePreferredDropAction()
29
}));
30
}
31
32
private configurePreferredPasteAction() {
33
return this._preferencesService.openUserSettings({
34
jsonEditor: true,
35
revealSetting: { key: pasteAsPreferenceConfig, edit: true }
36
});
37
}
38
39
private configurePreferredDropAction() {
40
return this._preferencesService.openUserSettings({
41
jsonEditor: true,
42
revealSetting: { key: dropAsPreferenceConfig, edit: true }
43
});
44
}
45
}
46
47