| // Copyright 2021 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| import type * as Platform from '../platform/platform.js'; |
| import {ls} from '../platform/platform.js'; |
| import * as Root from '../root/root.js'; |
| import * as UI from '../ui/ui.js'; |
| |
| // eslint-disable-next-line rulesdir/es_modules_import |
| import type * as QuickOpen from './quick_open.js'; |
| |
| let loadedQuickOpenModule: (typeof QuickOpen|undefined); |
| |
| async function loadQuickOpenModule(): Promise<typeof QuickOpen> { |
| if (!loadedQuickOpenModule) { |
| // Side-effect import resources in module.json |
| await Root.Runtime.Runtime.instance().loadModulePromise('quick_open'); |
| loadedQuickOpenModule = await import('./quick_open.js'); |
| } |
| return loadedQuickOpenModule; |
| } |
| |
| UI.ActionRegistration.registerActionExtension({ |
| actionId: 'commandMenu.show', |
| category: UI.ActionRegistration.ActionCategory.GLOBAL, |
| title: (): Platform.UIString.LocalizedString => ls`Run command`, |
| async loadActionDelegate() { |
| const QuickOpen = await loadQuickOpenModule(); |
| return QuickOpen.CommandMenu.ShowActionDelegate.instance(); |
| }, |
| bindings: [ |
| { |
| platform: UI.ActionRegistration.Platforms.WindowsLinux, |
| shortcut: 'Ctrl+Shift+P', |
| keybindSets: [ |
| UI.ActionRegistration.KeybindSet.DEVTOOLS_DEFAULT, |
| UI.ActionRegistration.KeybindSet.VS_CODE, |
| ], |
| }, |
| { |
| platform: UI.ActionRegistration.Platforms.Mac, |
| shortcut: 'Meta+Shift+P', |
| keybindSets: [ |
| UI.ActionRegistration.KeybindSet.DEVTOOLS_DEFAULT, |
| UI.ActionRegistration.KeybindSet.VS_CODE, |
| ], |
| }, |
| { |
| shortcut: 'F1', |
| keybindSets: [ |
| UI.ActionRegistration.KeybindSet.VS_CODE, |
| ], |
| }, |
| ], |
| }); |
| |
| UI.ActionRegistration.registerActionExtension({ |
| actionId: 'quickOpen.show', |
| category: UI.ActionRegistration.ActionCategory.GLOBAL, |
| title: (): Platform.UIString.LocalizedString => ls`Open file`, |
| async loadActionDelegate() { |
| const QuickOpen = await loadQuickOpenModule(); |
| return QuickOpen.QuickOpen.ShowActionDelegate.instance(); |
| }, |
| order: 100, |
| bindings: [ |
| { |
| platform: UI.ActionRegistration.Platforms.Mac, |
| shortcut: 'Meta+P', |
| keybindSets: [ |
| UI.ActionRegistration.KeybindSet.DEVTOOLS_DEFAULT, |
| UI.ActionRegistration.KeybindSet.VS_CODE, |
| ], |
| }, |
| { |
| platform: UI.ActionRegistration.Platforms.Mac, |
| shortcut: 'Meta+O', |
| keybindSets: [ |
| UI.ActionRegistration.KeybindSet.DEVTOOLS_DEFAULT, |
| UI.ActionRegistration.KeybindSet.VS_CODE, |
| ], |
| }, |
| { |
| platform: UI.ActionRegistration.Platforms.WindowsLinux, |
| shortcut: 'Ctrl+P', |
| keybindSets: [ |
| UI.ActionRegistration.KeybindSet.DEVTOOLS_DEFAULT, |
| UI.ActionRegistration.KeybindSet.VS_CODE, |
| ], |
| }, |
| { |
| platform: UI.ActionRegistration.Platforms.WindowsLinux, |
| shortcut: 'Ctrl+O', |
| keybindSets: [ |
| UI.ActionRegistration.KeybindSet.DEVTOOLS_DEFAULT, |
| UI.ActionRegistration.KeybindSet.VS_CODE, |
| ], |
| }, |
| ], |
| }); |