-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the quickAccess for the Settings
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'reflect-metadata'; | ||
import { localize } from 'monaco-editor/esm/vs/nls'; | ||
import { KeyMod, KeyCode } from 'mo/monaco'; | ||
import { KeyChord } from 'monaco-editor/esm/vs/base/common/keyCodes'; | ||
import { ISettingsService, SettingsService } from 'mo/services'; | ||
import { ServicesAccessor } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation'; | ||
import { container } from 'tsyringe'; | ||
import { Action2, KeybindingWeight } from './common'; | ||
|
||
export class QuickAccessSettings extends Action2 { | ||
static readonly ID = 'workbench.action.quickAccessSettings'; | ||
static readonly LABEL = localize( | ||
'quickAccessSettings.label', | ||
'Open Settings (JSON)' | ||
); | ||
private readonly settingsService: ISettingsService; | ||
|
||
constructor() { | ||
super({ | ||
id: QuickAccessSettings.ID, | ||
label: QuickAccessSettings.LABEL, | ||
title: QuickAccessSettings.LABEL, | ||
alias: 'Open Settings (JSON)', | ||
precondition: undefined, | ||
f1: true, | ||
keybinding: { | ||
when: undefined, | ||
weight: KeybindingWeight.WorkbenchContrib, | ||
// eslint-disable-next-line new-cap | ||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.US_COMMA), | ||
}, | ||
}); | ||
this.settingsService = container.resolve(SettingsService); | ||
} | ||
|
||
run(accessor: ServicesAccessor) { | ||
this.settingsService.openSettingsInEditor(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters