|
| 1 | +import 'reflect-metadata'; |
| 2 | +import { localize } from 'monaco-editor/esm/vs/nls'; |
| 3 | +import { KeyMod, KeyCode } from 'mo/monaco'; |
| 4 | +import { KeyChord } from 'monaco-editor/esm/vs/base/common/keyCodes'; |
| 5 | +import { ISettingsService, SettingsService } from 'mo/services'; |
| 6 | +import { ServicesAccessor } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation'; |
| 7 | +import { container } from 'tsyringe'; |
| 8 | +import { Action2, KeybindingWeight } from './common'; |
| 9 | + |
| 10 | +export class QuickAccessSettings extends Action2 { |
| 11 | + static readonly ID = 'workbench.action.quickAccessSettings'; |
| 12 | + static readonly LABEL = localize( |
| 13 | + 'quickAccessSettings.label', |
| 14 | + 'Open Settings (JSON)' |
| 15 | + ); |
| 16 | + private readonly settingsService: ISettingsService; |
| 17 | + |
| 18 | + constructor() { |
| 19 | + super({ |
| 20 | + id: QuickAccessSettings.ID, |
| 21 | + label: QuickAccessSettings.LABEL, |
| 22 | + title: QuickAccessSettings.LABEL, |
| 23 | + alias: 'Open Settings (JSON)', |
| 24 | + precondition: undefined, |
| 25 | + f1: true, |
| 26 | + keybinding: { |
| 27 | + when: undefined, |
| 28 | + weight: KeybindingWeight.WorkbenchContrib, |
| 29 | + // eslint-disable-next-line new-cap |
| 30 | + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.US_COMMA), |
| 31 | + }, |
| 32 | + }); |
| 33 | + this.settingsService = container.resolve(SettingsService); |
| 34 | + } |
| 35 | + |
| 36 | + run(accessor: ServicesAccessor) { |
| 37 | + this.settingsService.openSettingsInEditor(); |
| 38 | + } |
| 39 | +} |
0 commit comments