70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
4116 lines
206 KiB
Diff
4116 lines
206 KiB
Diff
diff --git a/src/vs/platform/window/common/window.ts b/src/vs/platform/window/common/window.ts
|
|
index 86ad0229037..5e1a604ee07 100644
|
|
--- a/src/vs/platform/window/common/window.ts
|
|
+++ b/src/vs/platform/window/common/window.ts
|
|
@@ -255,7 +255,7 @@ export function hasNativeTitlebar(configurationService: IConfigurationService, t
|
|
|
|
export function getTitleBarStyle(configurationService: IConfigurationService): TitlebarStyle {
|
|
if (isWeb) {
|
|
- return TitlebarStyle.CUSTOM;
|
|
+ return TitlebarStyle.NATIVE;
|
|
}
|
|
|
|
const configuration = configurationService.getValue<IWindowSettings | undefined>('window');
|
|
diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts
|
|
index 051dc16d1e0..0ea5dae22ca 100644
|
|
--- a/src/vs/workbench/browser/layout.ts
|
|
+++ b/src/vs/workbench/browser/layout.ts
|
|
@@ -701,6 +701,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
|
initialization: initialLayoutState,
|
|
runtime: layoutRuntimeState,
|
|
};
|
|
+ this.stateModel.setRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN, true);
|
|
|
|
// Sidebar View Container To Restore
|
|
if (this.isVisible(Parts.SIDEBAR_PART)) {
|
|
diff --git a/src/vs/workbench/browser/parts/globalCompositeBar.ts b/src/vs/workbench/browser/parts/globalCompositeBar.ts
|
|
index 064faf73e15..9cea6109ea4 100644
|
|
--- a/src/vs/workbench/browser/parts/globalCompositeBar.ts
|
|
+++ b/src/vs/workbench/browser/parts/globalCompositeBar.ts
|
|
@@ -10,7 +10,7 @@ import { IActivityService } from '../../services/activity/common/activity.js';
|
|
import { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';
|
|
import { DisposableStore, Disposable } from '../../../base/common/lifecycle.js';
|
|
import { IColorTheme, IThemeService } from '../../../platform/theme/common/themeService.js';
|
|
-import { IStorageService, StorageScope, StorageTarget } from '../../../platform/storage/common/storage.js';
|
|
+import { IStorageService, StorageScope } from '../../../platform/storage/common/storage.js';
|
|
import { IExtensionService } from '../../services/extensions/common/extensions.js';
|
|
import { CompositeBarActionViewItem, CompositeBarAction, IActivityHoverOptions, ICompositeBarActionViewItemOptions, ICompositeBarColors } from './compositeBarActions.js';
|
|
import { Codicon } from '../../../base/common/codicons.js';
|
|
@@ -731,9 +731,8 @@ function simpleActivityContextMenuActions(storageService: IStorageService, isAcc
|
|
}
|
|
|
|
export function isAccountsActionVisible(storageService: IStorageService): boolean {
|
|
- return storageService.getBoolean(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, StorageScope.PROFILE, true);
|
|
+ return false
|
|
}
|
|
|
|
function setAccountsActionVisible(storageService: IStorageService, visible: boolean) {
|
|
- storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, visible, StorageScope.PROFILE, StorageTarget.USER);
|
|
}
|
|
diff --git a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts
|
|
index 4a98431a021..8423cd02de2 100644
|
|
--- a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts
|
|
+++ b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts
|
|
@@ -3,697 +3,10 @@
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
-import { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';
|
|
-import { FileAccess } from '../../../../base/common/network.js';
|
|
-import { isMacintosh, isWeb } from '../../../../base/common/platform.js';
|
|
-import { URI } from '../../../../base/common/uri.js';
|
|
-import { EditorContributionInstantiation, registerEditorContribution } from '../../../../editor/browser/editorExtensions.js';
|
|
-import * as nls from '../../../../nls.js';
|
|
-import { AccessibleViewRegistry } from '../../../../platform/accessibility/browser/accessibleViewRegistry.js';
|
|
-import { ICommandActionTitle, Icon } from '../../../../platform/action/common/action.js';
|
|
-import { MenuId, MenuRegistry } from '../../../../platform/actions/common/actions.js';
|
|
-import { Extensions as ConfigurationExtensions, ConfigurationScope, IConfigurationRegistry } from '../../../../platform/configuration/common/configurationRegistry.js';
|
|
-import { ContextKeyExpr, ContextKeyExpression } from '../../../../platform/contextkey/common/contextkey.js';
|
|
-import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
|
|
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
|
-import { KeybindingWeight, KeybindingsRegistry } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
|
|
-import { IQuickAccessRegistry, Extensions as QuickAccessExtensions } from '../../../../platform/quickinput/common/quickAccess.js';
|
|
-import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
-import { EditorPaneDescriptor, IEditorPaneRegistry } from '../../../browser/editor.js';
|
|
-import { ViewPaneContainer } from '../../../browser/parts/views/viewPaneContainer.js';
|
|
-import { FocusedViewContext } from '../../../common/contextkeys.js';
|
|
-import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, WorkbenchPhase, registerWorkbenchContribution2 } from '../../../common/contributions.js';
|
|
-import { EditorExtensions } from '../../../common/editor.js';
|
|
-import { IViewContainersRegistry, IViewsRegistry, ViewContainer, ViewContainerLocation, Extensions as ViewExtensions } from '../../../common/views.js';
|
|
-import { launchSchemaId } from '../../../services/configuration/common/configuration.js';
|
|
-import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
|
|
-import { COPY_NOTEBOOK_VARIABLE_VALUE_ID, COPY_NOTEBOOK_VARIABLE_VALUE_LABEL } from '../../notebook/browser/contrib/notebookVariables/notebookVariableCommands.js';
|
|
-import { BREAKPOINTS_VIEW_ID, BREAKPOINT_EDITOR_CONTRIBUTION_ID, CALLSTACK_VIEW_ID, CONTEXT_BREAKPOINTS_EXIST, CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED, CONTEXT_BREAK_WHEN_VALUE_IS_ACCESSED_SUPPORTED, CONTEXT_BREAK_WHEN_VALUE_IS_READ_SUPPORTED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_CAN_VIEW_MEMORY, CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE, CONTEXT_DEBUG_UX, CONTEXT_EXPRESSION_SELECTED, CONTEXT_FOCUSED_SESSION_IS_ATTACH, CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG, CONTEXT_HAS_DEBUGGED, CONTEXT_IN_DEBUG_MODE, CONTEXT_JUMP_TO_CURSOR_SUPPORTED, CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_RESTART_FRAME_SUPPORTED, CONTEXT_SET_EXPRESSION_SUPPORTED, CONTEXT_SET_VARIABLE_SUPPORTED, CONTEXT_STACK_FRAME_SUPPORTS_RESTART, CONTEXT_STEP_INTO_TARGETS_SUPPORTED, CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED, CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED, CONTEXT_TERMINATE_THREADS_SUPPORTED, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, CONTEXT_VARIABLE_IS_READONLY, CONTEXT_VARIABLE_VALUE, CONTEXT_WATCH_ITEM_TYPE, DEBUG_PANEL_ID, DISASSEMBLY_VIEW_ID, EDITOR_CONTRIBUTION_ID, IDebugService, INTERNAL_CONSOLE_OPTIONS_SCHEMA, LOADED_SCRIPTS_VIEW_ID, REPL_VIEW_ID, State, VARIABLES_VIEW_ID, VIEWLET_ID, WATCH_VIEW_ID, getStateLabel } from '../common/debug.js';
|
|
-import { DebugWatchAccessibilityAnnouncer } from '../common/debugAccessibilityAnnouncer.js';
|
|
-import { DebugContentProvider } from '../common/debugContentProvider.js';
|
|
-import { DebugLifecycle } from '../common/debugLifecycle.js';
|
|
+import { IDebugService } from '../common/debug.js';
|
|
import { DebugVisualizerService, IDebugVisualizerService } from '../common/debugVisualizers.js';
|
|
-import { DisassemblyViewInput } from '../common/disassemblyViewInput.js';
|
|
-import { ReplAccessibilityAnnouncer } from '../common/replAccessibilityAnnouncer.js';
|
|
-import { BreakpointEditorContribution } from './breakpointEditorContribution.js';
|
|
-import { BreakpointsView } from './breakpointsView.js';
|
|
-import { CallStackEditorContribution } from './callStackEditorContribution.js';
|
|
-import { CallStackView } from './callStackView.js';
|
|
-import { registerColors } from './debugColors.js';
|
|
-import { ADD_CONFIGURATION_ID, ADD_TO_WATCH_ID, ADD_TO_WATCH_LABEL, CALLSTACK_BOTTOM_ID, CALLSTACK_BOTTOM_LABEL, CALLSTACK_DOWN_ID, CALLSTACK_DOWN_LABEL, CALLSTACK_TOP_ID, CALLSTACK_TOP_LABEL, CALLSTACK_UP_ID, CALLSTACK_UP_LABEL, CONTINUE_ID, CONTINUE_LABEL, COPY_EVALUATE_PATH_ID, COPY_EVALUATE_PATH_LABEL, COPY_STACK_TRACE_ID, COPY_VALUE_ID, COPY_VALUE_LABEL, DEBUG_COMMAND_CATEGORY, DEBUG_CONSOLE_QUICK_ACCESS_PREFIX, DEBUG_QUICK_ACCESS_PREFIX, DEBUG_RUN_COMMAND_ID, DEBUG_RUN_LABEL, DEBUG_START_COMMAND_ID, DEBUG_START_LABEL, DISCONNECT_AND_SUSPEND_ID, DISCONNECT_AND_SUSPEND_LABEL, DISCONNECT_ID, DISCONNECT_LABEL, EDIT_EXPRESSION_COMMAND_ID, JUMP_TO_CURSOR_ID, NEXT_DEBUG_CONSOLE_ID, NEXT_DEBUG_CONSOLE_LABEL, OPEN_LOADED_SCRIPTS_LABEL, PAUSE_ID, PAUSE_LABEL, PREV_DEBUG_CONSOLE_ID, PREV_DEBUG_CONSOLE_LABEL, REMOVE_EXPRESSION_COMMAND_ID, RESTART_FRAME_ID, RESTART_LABEL, RESTART_SESSION_ID, SELECT_AND_START_ID, SELECT_AND_START_LABEL, SELECT_DEBUG_CONSOLE_ID, SELECT_DEBUG_CONSOLE_LABEL, SELECT_DEBUG_SESSION_ID, SELECT_DEBUG_SESSION_LABEL, SET_EXPRESSION_COMMAND_ID, SHOW_LOADED_SCRIPTS_ID, STEP_INTO_ID, STEP_INTO_LABEL, STEP_INTO_TARGET_ID, STEP_INTO_TARGET_LABEL, STEP_OUT_ID, STEP_OUT_LABEL, STEP_OVER_ID, STEP_OVER_LABEL, STOP_ID, STOP_LABEL, TERMINATE_THREAD_ID, TOGGLE_INLINE_BREAKPOINT_ID, COPY_ADDRESS_ID, COPY_ADDRESS_LABEL, TOGGLE_BREAKPOINT_ID } from './debugCommands.js';
|
|
-import { DebugConsoleQuickAccess } from './debugConsoleQuickAccess.js';
|
|
-import { RunToCursorAction, SelectionToReplAction, SelectionToWatchExpressionsAction } from './debugEditorActions.js';
|
|
-import { DebugEditorContribution } from './debugEditorContribution.js';
|
|
-import * as icons from './debugIcons.js';
|
|
-import { DebugProgressContribution } from './debugProgress.js';
|
|
-import { StartDebugQuickAccessProvider } from './debugQuickAccess.js';
|
|
import { DebugService } from './debugService.js';
|
|
-import './debugSettingMigration.js';
|
|
-import { DebugStatusContribution } from './debugStatus.js';
|
|
-import { DebugTitleContribution } from './debugTitle.js';
|
|
-import { DebugToolBar } from './debugToolBar.js';
|
|
-import { DebugViewPaneContainer } from './debugViewlet.js';
|
|
-import { DisassemblyView, DisassemblyViewContribution } from './disassemblyView.js';
|
|
-import { LoadedScriptsView } from './loadedScriptsView.js';
|
|
-import './media/debug.contribution.css';
|
|
-import './media/debugHover.css';
|
|
-import { Repl } from './repl.js';
|
|
-import { ReplAccessibilityHelp } from './replAccessibilityHelp.js';
|
|
-import { ReplAccessibleView } from './replAccessibleView.js';
|
|
-import { RunAndDebugAccessibilityHelp } from './runAndDebugAccessibilityHelp.js';
|
|
-import { StatusBarColorProvider } from './statusbarColorProvider.js';
|
|
-import { BREAK_WHEN_VALUE_CHANGES_ID, BREAK_WHEN_VALUE_IS_ACCESSED_ID, BREAK_WHEN_VALUE_IS_READ_ID, SET_VARIABLE_ID, VIEW_MEMORY_ID, VariablesView } from './variablesView.js';
|
|
-import { ADD_WATCH_ID, ADD_WATCH_LABEL, REMOVE_WATCH_EXPRESSIONS_COMMAND_ID, REMOVE_WATCH_EXPRESSIONS_LABEL, WatchExpressionsView } from './watchExpressionsView.js';
|
|
-import { WelcomeView } from './welcomeView.js';
|
|
|
|
-const debugCategory = nls.localize('debugCategory', "Debug");
|
|
-registerColors();
|
|
-registerSingleton(IDebugService, DebugService, InstantiationType.Delayed);
|
|
registerSingleton(IDebugVisualizerService, DebugVisualizerService, InstantiationType.Delayed);
|
|
-
|
|
-// Register Debug Workbench Contributions
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugStatusContribution, LifecyclePhase.Eventually);
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugProgressContribution, LifecyclePhase.Eventually);
|
|
-if (isWeb) {
|
|
- Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugTitleContribution, LifecyclePhase.Eventually);
|
|
-}
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugToolBar, LifecyclePhase.Restored);
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider, LifecyclePhase.Eventually);
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider, LifecyclePhase.Eventually);
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DisassemblyViewContribution, LifecyclePhase.Eventually);
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugLifecycle, LifecyclePhase.Eventually);
|
|
-
|
|
-// Register Quick Access
|
|
-Registry.as<IQuickAccessRegistry>(QuickAccessExtensions.Quickaccess).registerQuickAccessProvider({
|
|
- ctor: StartDebugQuickAccessProvider,
|
|
- prefix: DEBUG_QUICK_ACCESS_PREFIX,
|
|
- contextKey: 'inLaunchConfigurationsPicker',
|
|
- placeholder: nls.localize('startDebugPlaceholder', "Type the name of a launch configuration to run."),
|
|
- helpEntries: [{
|
|
- description: nls.localize('startDebuggingHelp', "Start Debugging"),
|
|
- commandId: SELECT_AND_START_ID,
|
|
- commandCenterOrder: 50
|
|
- }]
|
|
-});
|
|
-
|
|
-// Register quick access for debug console
|
|
-Registry.as<IQuickAccessRegistry>(QuickAccessExtensions.Quickaccess).registerQuickAccessProvider({
|
|
- ctor: DebugConsoleQuickAccess,
|
|
- prefix: DEBUG_CONSOLE_QUICK_ACCESS_PREFIX,
|
|
- contextKey: 'inDebugConsolePicker',
|
|
- placeholder: nls.localize('tasksQuickAccessPlaceholder', "Type the name of a debug console to open."),
|
|
- helpEntries: [{ description: nls.localize('tasksQuickAccessHelp', "Show All Debug Consoles"), commandId: SELECT_DEBUG_CONSOLE_ID }]
|
|
-});
|
|
-
|
|
-registerEditorContribution('editor.contrib.callStack', CallStackEditorContribution, EditorContributionInstantiation.AfterFirstRender);
|
|
-registerEditorContribution(BREAKPOINT_EDITOR_CONTRIBUTION_ID, BreakpointEditorContribution, EditorContributionInstantiation.AfterFirstRender);
|
|
-registerEditorContribution(EDITOR_CONTRIBUTION_ID, DebugEditorContribution, EditorContributionInstantiation.BeforeFirstInteraction);
|
|
-
|
|
-const registerDebugCommandPaletteItem = (id: string, title: ICommandActionTitle, when?: ContextKeyExpression, precondition?: ContextKeyExpression) => {
|
|
- MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
|
- when: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, when),
|
|
- group: debugCategory,
|
|
- command: {
|
|
- id,
|
|
- title,
|
|
- category: DEBUG_COMMAND_CATEGORY,
|
|
- precondition
|
|
- }
|
|
- });
|
|
-};
|
|
-
|
|
-registerDebugCommandPaletteItem(RESTART_SESSION_ID, RESTART_LABEL);
|
|
-registerDebugCommandPaletteItem(TERMINATE_THREAD_ID, nls.localize2('terminateThread', "Terminate Thread"), CONTEXT_IN_DEBUG_MODE, CONTEXT_TERMINATE_THREADS_SUPPORTED);
|
|
-registerDebugCommandPaletteItem(STEP_OVER_ID, STEP_OVER_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugCommandPaletteItem(STEP_INTO_ID, STEP_INTO_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugCommandPaletteItem(STEP_INTO_TARGET_ID, STEP_INTO_TARGET_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.and(CONTEXT_STEP_INTO_TARGETS_SUPPORTED, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped')));
|
|
-registerDebugCommandPaletteItem(STEP_OUT_ID, STEP_OUT_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugCommandPaletteItem(PAUSE_ID, PAUSE_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.and(CONTEXT_DEBUG_STATE.isEqualTo('running'), CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG.toNegated()));
|
|
-registerDebugCommandPaletteItem(DISCONNECT_ID, DISCONNECT_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.or(CONTEXT_FOCUSED_SESSION_IS_ATTACH, CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED));
|
|
-registerDebugCommandPaletteItem(DISCONNECT_AND_SUSPEND_ID, DISCONNECT_AND_SUSPEND_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.or(CONTEXT_FOCUSED_SESSION_IS_ATTACH, ContextKeyExpr.and(CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED, CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED)));
|
|
-registerDebugCommandPaletteItem(STOP_ID, STOP_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.or(CONTEXT_FOCUSED_SESSION_IS_ATTACH.toNegated(), CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED));
|
|
-registerDebugCommandPaletteItem(CONTINUE_ID, CONTINUE_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugCommandPaletteItem(JUMP_TO_CURSOR_ID, nls.localize2('jumpToCursor', "Jump to Cursor"), CONTEXT_JUMP_TO_CURSOR_SUPPORTED);
|
|
-registerDebugCommandPaletteItem(JUMP_TO_CURSOR_ID, nls.localize2('SetNextStatement', "Set Next Statement"), CONTEXT_JUMP_TO_CURSOR_SUPPORTED);
|
|
-registerDebugCommandPaletteItem(RunToCursorAction.ID, RunToCursorAction.LABEL, CONTEXT_DEBUGGERS_AVAILABLE);
|
|
-registerDebugCommandPaletteItem(SelectionToReplAction.ID, SelectionToReplAction.LABEL, CONTEXT_IN_DEBUG_MODE);
|
|
-registerDebugCommandPaletteItem(SelectionToWatchExpressionsAction.ID, SelectionToWatchExpressionsAction.LABEL);
|
|
-registerDebugCommandPaletteItem(TOGGLE_INLINE_BREAKPOINT_ID, nls.localize2('inlineBreakpoint', "Inline Breakpoint"));
|
|
-registerDebugCommandPaletteItem(DEBUG_START_COMMAND_ID, DEBUG_START_LABEL, ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE.notEqualsTo(getStateLabel(State.Initializing))));
|
|
-registerDebugCommandPaletteItem(DEBUG_RUN_COMMAND_ID, DEBUG_RUN_LABEL, ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE.notEqualsTo(getStateLabel(State.Initializing))));
|
|
-registerDebugCommandPaletteItem(SELECT_AND_START_ID, SELECT_AND_START_LABEL, ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE.notEqualsTo(getStateLabel(State.Initializing))));
|
|
-registerDebugCommandPaletteItem(NEXT_DEBUG_CONSOLE_ID, NEXT_DEBUG_CONSOLE_LABEL);
|
|
-registerDebugCommandPaletteItem(PREV_DEBUG_CONSOLE_ID, PREV_DEBUG_CONSOLE_LABEL);
|
|
-registerDebugCommandPaletteItem(SHOW_LOADED_SCRIPTS_ID, OPEN_LOADED_SCRIPTS_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_LOADED_SCRIPTS_SUPPORTED);
|
|
-registerDebugCommandPaletteItem(SELECT_DEBUG_CONSOLE_ID, SELECT_DEBUG_CONSOLE_LABEL);
|
|
-registerDebugCommandPaletteItem(SELECT_DEBUG_SESSION_ID, SELECT_DEBUG_SESSION_LABEL);
|
|
-registerDebugCommandPaletteItem(CALLSTACK_TOP_ID, CALLSTACK_TOP_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugCommandPaletteItem(CALLSTACK_BOTTOM_ID, CALLSTACK_BOTTOM_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugCommandPaletteItem(CALLSTACK_UP_ID, CALLSTACK_UP_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugCommandPaletteItem(CALLSTACK_DOWN_ID, CALLSTACK_DOWN_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-
|
|
-// Debug callstack context menu
|
|
-const registerDebugViewMenuItem = (menuId: MenuId, id: string, title: string | ICommandActionTitle, order: number, when?: ContextKeyExpression, precondition?: ContextKeyExpression, group = 'navigation', icon?: Icon) => {
|
|
- MenuRegistry.appendMenuItem(menuId, {
|
|
- group,
|
|
- when,
|
|
- order,
|
|
- icon,
|
|
- command: {
|
|
- id,
|
|
- title,
|
|
- icon,
|
|
- precondition
|
|
- }
|
|
- });
|
|
-};
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, RESTART_SESSION_ID, RESTART_LABEL, 10, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('session'), undefined, '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, DISCONNECT_ID, DISCONNECT_LABEL, 20, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('session'), undefined, '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, DISCONNECT_AND_SUSPEND_ID, DISCONNECT_AND_SUSPEND_LABEL, 21, ContextKeyExpr.and(CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('session'), CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED, CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED), undefined, '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, STOP_ID, STOP_LABEL, 30, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('session'), undefined, '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, PAUSE_ID, PAUSE_LABEL, 10, ContextKeyExpr.and(CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('thread'), ContextKeyExpr.and(CONTEXT_DEBUG_STATE.isEqualTo('running'), CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG.toNegated())));
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, CONTINUE_ID, CONTINUE_LABEL, 10, ContextKeyExpr.and(CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('thread'), CONTEXT_DEBUG_STATE.isEqualTo('stopped')));
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, STEP_OVER_ID, STEP_OVER_LABEL, 20, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('thread'), CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, STEP_INTO_ID, STEP_INTO_LABEL, 30, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('thread'), CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, STEP_OUT_ID, STEP_OUT_LABEL, 40, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('thread'), CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, TERMINATE_THREAD_ID, nls.localize('terminateThread', "Terminate Thread"), 10, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('thread'), CONTEXT_TERMINATE_THREADS_SUPPORTED, 'termination');
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, RESTART_FRAME_ID, nls.localize('restartFrame', "Restart Frame"), 10, ContextKeyExpr.and(CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('stackFrame'), CONTEXT_RESTART_FRAME_SUPPORTED), CONTEXT_STACK_FRAME_SUPPORTS_RESTART);
|
|
-registerDebugViewMenuItem(MenuId.DebugCallStackContext, COPY_STACK_TRACE_ID, nls.localize('copyStackTrace', "Copy Call Stack"), 20, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('stackFrame'), undefined, '3_modification');
|
|
-
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, VIEW_MEMORY_ID, nls.localize('viewMemory', "View Binary Data"), 15, CONTEXT_CAN_VIEW_MEMORY, CONTEXT_IN_DEBUG_MODE, 'inline', icons.debugInspectMemory);
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, SET_VARIABLE_ID, nls.localize('setValue', "Set Value"), 10, ContextKeyExpr.or(CONTEXT_SET_VARIABLE_SUPPORTED, ContextKeyExpr.and(CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, CONTEXT_SET_EXPRESSION_SUPPORTED)), CONTEXT_VARIABLE_IS_READONLY.toNegated(), '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, COPY_VALUE_ID, COPY_VALUE_LABEL, 10, undefined, undefined, '5_cutcopypaste');
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, COPY_EVALUATE_PATH_ID, COPY_EVALUATE_PATH_LABEL, 20, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, undefined, '5_cutcopypaste');
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, ADD_TO_WATCH_ID, ADD_TO_WATCH_LABEL, 100, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, undefined, 'z_commands');
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, BREAK_WHEN_VALUE_IS_READ_ID, nls.localize('breakWhenValueIsRead', "Break on Value Read"), 200, CONTEXT_BREAK_WHEN_VALUE_IS_READ_SUPPORTED, undefined, 'z_commands');
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, BREAK_WHEN_VALUE_CHANGES_ID, nls.localize('breakWhenValueChanges', "Break on Value Change"), 210, CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED, undefined, 'z_commands');
|
|
-registerDebugViewMenuItem(MenuId.DebugVariablesContext, BREAK_WHEN_VALUE_IS_ACCESSED_ID, nls.localize('breakWhenValueIsAccessed', "Break on Value Access"), 220, CONTEXT_BREAK_WHEN_VALUE_IS_ACCESSED_SUPPORTED, undefined, 'z_commands');
|
|
-
|
|
-registerDebugViewMenuItem(MenuId.DebugHoverContext, VIEW_MEMORY_ID, nls.localize('viewMemory', "View Binary Data"), 15, CONTEXT_CAN_VIEW_MEMORY, CONTEXT_IN_DEBUG_MODE, 'inline', icons.debugInspectMemory);
|
|
-registerDebugViewMenuItem(MenuId.DebugHoverContext, COPY_VALUE_ID, COPY_VALUE_LABEL, 10, undefined, undefined, '5_cutcopypaste');
|
|
-registerDebugViewMenuItem(MenuId.DebugHoverContext, COPY_EVALUATE_PATH_ID, COPY_EVALUATE_PATH_LABEL, 20, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, undefined, '5_cutcopypaste');
|
|
-registerDebugViewMenuItem(MenuId.DebugHoverContext, ADD_TO_WATCH_ID, ADD_TO_WATCH_LABEL, 100, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, undefined, 'z_commands');
|
|
-registerDebugViewMenuItem(MenuId.DebugHoverContext, BREAK_WHEN_VALUE_IS_READ_ID, nls.localize('breakWhenValueIsRead', "Break on Value Read"), 200, CONTEXT_BREAK_WHEN_VALUE_IS_READ_SUPPORTED, undefined, 'z_commands');
|
|
-registerDebugViewMenuItem(MenuId.DebugHoverContext, BREAK_WHEN_VALUE_CHANGES_ID, nls.localize('breakWhenValueChanges', "Break on Value Change"), 210, CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED, undefined, 'z_commands');
|
|
-registerDebugViewMenuItem(MenuId.DebugHoverContext, BREAK_WHEN_VALUE_IS_ACCESSED_ID, nls.localize('breakWhenValueIsAccessed', "Break on Value Access"), 220, CONTEXT_BREAK_WHEN_VALUE_IS_ACCESSED_SUPPORTED, undefined, 'z_commands');
|
|
-
|
|
-registerDebugViewMenuItem(MenuId.DebugWatchContext, ADD_WATCH_ID, ADD_WATCH_LABEL, 10, undefined, undefined, '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugWatchContext, EDIT_EXPRESSION_COMMAND_ID, nls.localize('editWatchExpression', "Edit Expression"), 20, CONTEXT_WATCH_ITEM_TYPE.isEqualTo('expression'), undefined, '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugWatchContext, SET_EXPRESSION_COMMAND_ID, nls.localize('setValue', "Set Value"), 30, ContextKeyExpr.or(ContextKeyExpr.and(CONTEXT_WATCH_ITEM_TYPE.isEqualTo('expression'), CONTEXT_SET_EXPRESSION_SUPPORTED), ContextKeyExpr.and(CONTEXT_WATCH_ITEM_TYPE.isEqualTo('variable'), CONTEXT_SET_VARIABLE_SUPPORTED)), CONTEXT_VARIABLE_IS_READONLY.toNegated(), '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugWatchContext, COPY_VALUE_ID, nls.localize('copyValue', "Copy Value"), 40, ContextKeyExpr.or(CONTEXT_WATCH_ITEM_TYPE.isEqualTo('expression'), CONTEXT_WATCH_ITEM_TYPE.isEqualTo('variable')), CONTEXT_IN_DEBUG_MODE, '3_modification');
|
|
-registerDebugViewMenuItem(MenuId.DebugWatchContext, VIEW_MEMORY_ID, nls.localize('viewMemory', "View Binary Data"), 10, CONTEXT_CAN_VIEW_MEMORY, undefined, 'inline', icons.debugInspectMemory);
|
|
-registerDebugViewMenuItem(MenuId.DebugWatchContext, REMOVE_EXPRESSION_COMMAND_ID, nls.localize('removeWatchExpression', "Remove Expression"), 20, CONTEXT_WATCH_ITEM_TYPE.isEqualTo('expression'), undefined, 'inline', icons.watchExpressionRemove);
|
|
-registerDebugViewMenuItem(MenuId.DebugWatchContext, REMOVE_WATCH_EXPRESSIONS_COMMAND_ID, REMOVE_WATCH_EXPRESSIONS_LABEL, 20, undefined, undefined, 'z_commands');
|
|
-
|
|
-registerDebugViewMenuItem(MenuId.NotebookVariablesContext, COPY_NOTEBOOK_VARIABLE_VALUE_ID, COPY_NOTEBOOK_VARIABLE_VALUE_LABEL, 20, CONTEXT_VARIABLE_VALUE);
|
|
-
|
|
-KeybindingsRegistry.registerKeybindingRule({
|
|
- id: COPY_VALUE_ID,
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- when: ContextKeyExpr.and(
|
|
- CONTEXT_EXPRESSION_SELECTED.negate(),
|
|
- ContextKeyExpr.or(
|
|
- FocusedViewContext.isEqualTo(WATCH_VIEW_ID),
|
|
- FocusedViewContext.isEqualTo(VARIABLES_VIEW_ID),
|
|
- ),
|
|
- ),
|
|
- primary: KeyMod.CtrlCmd | KeyCode.KeyC
|
|
-});
|
|
-
|
|
-// Touch Bar
|
|
-if (isMacintosh) {
|
|
-
|
|
- const registerTouchBarEntry = (id: string, title: string | ICommandActionTitle, order: number, when: ContextKeyExpression | undefined, iconUri: URI) => {
|
|
- MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
|
|
- command: {
|
|
- id,
|
|
- title,
|
|
- icon: { dark: iconUri }
|
|
- },
|
|
- when: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, when),
|
|
- group: '9_debug',
|
|
- order
|
|
- });
|
|
- };
|
|
-
|
|
- registerTouchBarEntry(DEBUG_RUN_COMMAND_ID, DEBUG_RUN_LABEL, 0, CONTEXT_IN_DEBUG_MODE.toNegated(), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/continue-tb.png'));
|
|
- registerTouchBarEntry(DEBUG_START_COMMAND_ID, DEBUG_START_LABEL, 1, CONTEXT_IN_DEBUG_MODE.toNegated(), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/run-with-debugging-tb.png'));
|
|
- registerTouchBarEntry(CONTINUE_ID, CONTINUE_LABEL, 0, CONTEXT_DEBUG_STATE.isEqualTo('stopped'), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/continue-tb.png'));
|
|
- registerTouchBarEntry(PAUSE_ID, PAUSE_LABEL, 1, ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.and(CONTEXT_DEBUG_STATE.isEqualTo('running'), CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG.toNegated())), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/pause-tb.png'));
|
|
- registerTouchBarEntry(STEP_OVER_ID, STEP_OVER_LABEL, 2, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stepover-tb.png'));
|
|
- registerTouchBarEntry(STEP_INTO_ID, STEP_INTO_LABEL, 3, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stepinto-tb.png'));
|
|
- registerTouchBarEntry(STEP_OUT_ID, STEP_OUT_LABEL, 4, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stepout-tb.png'));
|
|
- registerTouchBarEntry(RESTART_SESSION_ID, RESTART_LABEL, 5, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/restart-tb.png'));
|
|
- registerTouchBarEntry(STOP_ID, STOP_LABEL, 6, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stop-tb.png'));
|
|
-}
|
|
-
|
|
-// Editor Title Menu's "Run/Debug" dropdown item
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.EditorTitle, { submenu: MenuId.EditorTitleRun, rememberDefaultAction: true, title: nls.localize2('run', "Run or Debug..."), icon: icons.debugRun, group: 'navigation', order: -1 });
|
|
-
|
|
-// Debug menu
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
|
|
- submenu: MenuId.MenubarDebugMenu,
|
|
- title: {
|
|
- ...nls.localize2('runMenu', "Run"),
|
|
- mnemonicTitle: nls.localize({ key: 'mRun', comment: ['&& denotes a mnemonic'] }, "&&Run")
|
|
- },
|
|
- order: 6
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '1_debug',
|
|
- command: {
|
|
- id: DEBUG_START_COMMAND_ID,
|
|
- title: nls.localize({ key: 'miStartDebugging', comment: ['&& denotes a mnemonic'] }, "&&Start Debugging")
|
|
- },
|
|
- order: 1,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '1_debug',
|
|
- command: {
|
|
- id: DEBUG_RUN_COMMAND_ID,
|
|
- title: nls.localize({ key: 'miRun', comment: ['&& denotes a mnemonic'] }, "Run &&Without Debugging")
|
|
- },
|
|
- order: 2,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '1_debug',
|
|
- command: {
|
|
- id: STOP_ID,
|
|
- title: nls.localize({ key: 'miStopDebugging', comment: ['&& denotes a mnemonic'] }, "&&Stop Debugging"),
|
|
- precondition: CONTEXT_IN_DEBUG_MODE
|
|
- },
|
|
- order: 3,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '1_debug',
|
|
- command: {
|
|
- id: RESTART_SESSION_ID,
|
|
- title: nls.localize({ key: 'miRestart Debugging', comment: ['&& denotes a mnemonic'] }, "&&Restart Debugging"),
|
|
- precondition: CONTEXT_IN_DEBUG_MODE
|
|
- },
|
|
- order: 4,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-// Configuration
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '2_configuration',
|
|
- command: {
|
|
- id: ADD_CONFIGURATION_ID,
|
|
- title: nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "A&&dd Configuration...")
|
|
- },
|
|
- order: 2,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-// Step Commands
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '3_step',
|
|
- command: {
|
|
- id: STEP_OVER_ID,
|
|
- title: nls.localize({ key: 'miStepOver', comment: ['&& denotes a mnemonic'] }, "Step &&Over"),
|
|
- precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
|
|
- },
|
|
- order: 1,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '3_step',
|
|
- command: {
|
|
- id: STEP_INTO_ID,
|
|
- title: nls.localize({ key: 'miStepInto', comment: ['&& denotes a mnemonic'] }, "Step &&Into"),
|
|
- precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
|
|
- },
|
|
- order: 2,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '3_step',
|
|
- command: {
|
|
- id: STEP_OUT_ID,
|
|
- title: nls.localize({ key: 'miStepOut', comment: ['&& denotes a mnemonic'] }, "Step O&&ut"),
|
|
- precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
|
|
- },
|
|
- order: 3,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '3_step',
|
|
- command: {
|
|
- id: CONTINUE_ID,
|
|
- title: nls.localize({ key: 'miContinue', comment: ['&& denotes a mnemonic'] }, "&&Continue"),
|
|
- precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
|
|
- },
|
|
- order: 4,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-// New Breakpoints
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarNewBreakpointMenu, {
|
|
- group: '1_breakpoints',
|
|
- command: {
|
|
- id: TOGGLE_INLINE_BREAKPOINT_ID,
|
|
- title: nls.localize({ key: 'miInlineBreakpoint', comment: ['&& denotes a mnemonic'] }, "Inline Breakp&&oint")
|
|
- },
|
|
- order: 2,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: '4_new_breakpoint',
|
|
- title: nls.localize({ key: 'miNewBreakpoint', comment: ['&& denotes a mnemonic'] }, "&&New Breakpoint"),
|
|
- submenu: MenuId.MenubarNewBreakpointMenu,
|
|
- order: 2,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-// Disassembly
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.DebugDisassemblyContext, {
|
|
- group: '1_edit',
|
|
- command: {
|
|
- id: COPY_ADDRESS_ID,
|
|
- title: COPY_ADDRESS_LABEL,
|
|
- },
|
|
- order: 2,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.DebugDisassemblyContext, {
|
|
- group: '3_breakpoints',
|
|
- command: {
|
|
- id: TOGGLE_BREAKPOINT_ID,
|
|
- title: nls.localize({ key: 'miToggleBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle Breakpoint"),
|
|
- },
|
|
- order: 2,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE
|
|
-});
|
|
-
|
|
-// Breakpoint actions are registered from breakpointsView.ts
|
|
-
|
|
-// Install Debuggers
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
|
|
- group: 'z_install',
|
|
- command: {
|
|
- id: 'debug.installAdditionalDebuggers',
|
|
- title: nls.localize({ key: 'miInstallAdditionalDebuggers', comment: ['&& denotes a mnemonic'] }, "&&Install Additional Debuggers...")
|
|
- },
|
|
- order: 1
|
|
-});
|
|
-
|
|
-// register repl panel
|
|
-
|
|
-const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewExtensions.ViewContainersRegistry).registerViewContainer({
|
|
- id: DEBUG_PANEL_ID,
|
|
- title: nls.localize2({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"),
|
|
- icon: icons.debugConsoleViewIcon,
|
|
- ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [DEBUG_PANEL_ID, { mergeViewWithContainerWhenSingleView: true }]),
|
|
- storageId: DEBUG_PANEL_ID,
|
|
- hideIfEmpty: true,
|
|
- order: 2,
|
|
-}, ViewContainerLocation.Panel, { doNotRegisterOpenCommand: true });
|
|
-
|
|
-Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry).registerViews([{
|
|
- id: REPL_VIEW_ID,
|
|
- name: nls.localize2({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"),
|
|
- containerIcon: icons.debugConsoleViewIcon,
|
|
- canToggleVisibility: true,
|
|
- canMoveView: true,
|
|
- when: CONTEXT_DEBUGGERS_AVAILABLE,
|
|
- ctorDescriptor: new SyncDescriptor(Repl),
|
|
- openCommandActionDescriptor: {
|
|
- id: 'workbench.debug.action.toggleRepl',
|
|
- mnemonicTitle: nls.localize({ key: 'miToggleDebugConsole', comment: ['&& denotes a mnemonic'] }, "De&&bug Console"),
|
|
- keybindings: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyY },
|
|
- order: 2
|
|
- }
|
|
-}], VIEW_CONTAINER);
|
|
-
|
|
-
|
|
-const viewContainer = Registry.as<IViewContainersRegistry>(ViewExtensions.ViewContainersRegistry).registerViewContainer({
|
|
- id: VIEWLET_ID,
|
|
- title: nls.localize2('run and debug', "Run and Debug"),
|
|
- openCommandActionDescriptor: {
|
|
- id: VIEWLET_ID,
|
|
- mnemonicTitle: nls.localize({ key: 'miViewRun', comment: ['&& denotes a mnemonic'] }, "&&Run"),
|
|
- keybindings: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyD },
|
|
- order: 3
|
|
- },
|
|
- ctorDescriptor: new SyncDescriptor(DebugViewPaneContainer),
|
|
- icon: icons.runViewIcon,
|
|
- alwaysUseContainerInfo: true,
|
|
- order: 3,
|
|
-}, ViewContainerLocation.Sidebar);
|
|
-
|
|
-// Register default debug views
|
|
-const viewsRegistry = Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry);
|
|
-viewsRegistry.registerViews([{ id: VARIABLES_VIEW_ID, name: nls.localize2('variables', "Variables"), containerIcon: icons.variablesViewIcon, ctorDescriptor: new SyncDescriptor(VariablesView), order: 10, weight: 40, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusVariablesView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
|
|
-viewsRegistry.registerViews([{ id: WATCH_VIEW_ID, name: nls.localize2('watch', "Watch"), containerIcon: icons.watchViewIcon, ctorDescriptor: new SyncDescriptor(WatchExpressionsView), order: 20, weight: 10, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusWatchView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
|
|
-viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: nls.localize2('callStack', "Call Stack"), containerIcon: icons.callStackViewIcon, ctorDescriptor: new SyncDescriptor(CallStackView), order: 30, weight: 30, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusCallStackView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
|
|
-viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: nls.localize2('breakpoints', "Breakpoints"), containerIcon: icons.breakpointsViewIcon, ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default'), CONTEXT_HAS_DEBUGGED) }], viewContainer);
|
|
-viewsRegistry.registerViews([{ id: WelcomeView.ID, name: WelcomeView.LABEL, containerIcon: icons.runViewIcon, ctorDescriptor: new SyncDescriptor(WelcomeView), order: 1, weight: 40, canToggleVisibility: true, when: CONTEXT_DEBUG_UX.isEqualTo('simple') }], viewContainer);
|
|
-viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: nls.localize2('loadedScripts', "Loaded Scripts"), containerIcon: icons.loadedScriptsViewIcon, ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer);
|
|
-
|
|
-// Register disassembly view
|
|
-
|
|
-Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane).registerEditorPane(
|
|
- EditorPaneDescriptor.create(DisassemblyView, DISASSEMBLY_VIEW_ID, nls.localize('disassembly', "Disassembly")),
|
|
- [new SyncDescriptor(DisassemblyViewInput)]
|
|
-);
|
|
-
|
|
-// Register configuration
|
|
-const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
|
|
-configurationRegistry.registerConfiguration({
|
|
- id: 'debug',
|
|
- order: 20,
|
|
- title: nls.localize('debugConfigurationTitle', "Debug"),
|
|
- type: 'object',
|
|
- properties: {
|
|
- 'debug.showVariableTypes': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'showVariableTypes' }, "Show variable type in variable pane during debug session"),
|
|
- default: false
|
|
- },
|
|
- 'debug.allowBreakpointsEverywhere': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'allowBreakpointsEverywhere' }, "Allow setting breakpoints in any file."),
|
|
- default: false
|
|
- },
|
|
- 'debug.gutterMiddleClickAction': {
|
|
- type: 'string',
|
|
- enum: ['logpoint', 'conditionalBreakpoint', 'triggeredBreakpoint', 'none'],
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'gutterMiddleClickAction' }, 'Controls the action to perform when clicking the editor gutter with the middle mouse button.'),
|
|
- enumDescriptions: [
|
|
- nls.localize('debug.gutterMiddleClickAction.logpoint', "Add Logpoint."),
|
|
- nls.localize('debug.gutterMiddleClickAction.conditionalBreakpoint', "Add Conditional Breakpoint."),
|
|
- nls.localize('debug.gutterMiddleClickAction.triggeredBreakpoint', "Add Triggered Breakpoint."),
|
|
- nls.localize('debug.gutterMiddleClickAction.none', "Don't perform any action."),
|
|
- ],
|
|
- default: 'logpoint',
|
|
- },
|
|
- 'debug.openExplorerOnEnd': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'openExplorerOnEnd' }, "Automatically open the explorer view at the end of a debug session."),
|
|
- default: false
|
|
- },
|
|
- 'debug.closeReadonlyTabsOnEnd': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'closeReadonlyTabsOnEnd' }, "At the end of a debug session, all the read-only tabs associated with that session will be closed"),
|
|
- default: false
|
|
- },
|
|
- 'debug.inlineValues': {
|
|
- type: 'string',
|
|
- 'enum': ['on', 'off', 'auto'],
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'inlineValues' }, "Show variable values inline in editor while debugging."),
|
|
- 'enumDescriptions': [
|
|
- nls.localize('inlineValues.on', "Always show variable values inline in editor while debugging."),
|
|
- nls.localize('inlineValues.off', "Never show variable values inline in editor while debugging."),
|
|
- nls.localize('inlineValues.focusNoScroll', "Show variable values inline in editor while debugging when the language supports inline value locations."),
|
|
- ],
|
|
- default: 'auto'
|
|
- },
|
|
- 'debug.toolBarLocation': {
|
|
- enum: ['floating', 'docked', 'commandCenter', 'hidden'],
|
|
- markdownDescription: nls.localize({ comment: ['This is the description for a setting'], key: 'toolBarLocation' }, "Controls the location of the debug toolbar. Either `floating` in all views, `docked` in the debug view, `commandCenter` (requires {0}), or `hidden`.", '`#window.commandCenter#`'),
|
|
- default: 'floating',
|
|
- markdownEnumDescriptions: [
|
|
- nls.localize('debugToolBar.floating', "Show debug toolbar in all views."),
|
|
- nls.localize('debugToolBar.docked', "Show debug toolbar only in debug views."),
|
|
- nls.localize('debugToolBar.commandCenter', "`(Experimental)` Show debug toolbar in the command center."),
|
|
- nls.localize('debugToolBar.hidden', "Do not show debug toolbar."),
|
|
- ]
|
|
- },
|
|
- 'debug.showInStatusBar': {
|
|
- enum: ['never', 'always', 'onFirstSessionStart'],
|
|
- enumDescriptions: [nls.localize('never', "Never show debug in Status bar"), nls.localize('always', "Always show debug in Status bar"), nls.localize('onFirstSessionStart', "Show debug in Status bar only after debug was started for the first time")],
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'showInStatusBar' }, "Controls when the debug Status bar should be visible."),
|
|
- default: 'onFirstSessionStart'
|
|
- },
|
|
- 'debug.internalConsoleOptions': INTERNAL_CONSOLE_OPTIONS_SCHEMA,
|
|
- 'debug.console.closeOnEnd': {
|
|
- type: 'boolean',
|
|
- description: nls.localize('debug.console.closeOnEnd', "Controls if the Debug Console should be automatically closed when the debug session ends."),
|
|
- default: false
|
|
- },
|
|
- 'debug.terminal.clearBeforeReusing': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'debug.terminal.clearBeforeReusing' }, "Before starting a new debug session in an integrated or external terminal, clear the terminal."),
|
|
- default: false
|
|
- },
|
|
- 'debug.openDebug': {
|
|
- enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart', 'openOnDebugBreak'],
|
|
- default: 'openOnDebugBreak',
|
|
- description: nls.localize('openDebug', "Controls when the debug view should open.")
|
|
- },
|
|
- 'debug.showSubSessionsInToolBar': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'showSubSessionsInToolBar' }, "Controls whether the debug sub-sessions are shown in the debug tool bar. When this setting is false the stop command on a sub-session will also stop the parent session."),
|
|
- default: false
|
|
- },
|
|
- 'debug.console.fontSize': {
|
|
- type: 'number',
|
|
- description: nls.localize('debug.console.fontSize', "Controls the font size in pixels in the Debug Console."),
|
|
- default: isMacintosh ? 12 : 14,
|
|
- },
|
|
- 'debug.console.fontFamily': {
|
|
- type: 'string',
|
|
- description: nls.localize('debug.console.fontFamily', "Controls the font family in the Debug Console."),
|
|
- default: 'default'
|
|
- },
|
|
- 'debug.console.lineHeight': {
|
|
- type: 'number',
|
|
- description: nls.localize('debug.console.lineHeight', "Controls the line height in pixels in the Debug Console. Use 0 to compute the line height from the font size."),
|
|
- default: 0
|
|
- },
|
|
- 'debug.console.wordWrap': {
|
|
- type: 'boolean',
|
|
- description: nls.localize('debug.console.wordWrap', "Controls if the lines should wrap in the Debug Console."),
|
|
- default: true
|
|
- },
|
|
- 'debug.console.historySuggestions': {
|
|
- type: 'boolean',
|
|
- description: nls.localize('debug.console.historySuggestions', "Controls if the Debug Console should suggest previously typed input."),
|
|
- default: true
|
|
- },
|
|
- 'debug.console.collapseIdenticalLines': {
|
|
- type: 'boolean',
|
|
- description: nls.localize('debug.console.collapseIdenticalLines', "Controls if the Debug Console should collapse identical lines and show a number of occurrences with a badge."),
|
|
- default: true
|
|
- },
|
|
- 'debug.console.acceptSuggestionOnEnter': {
|
|
- enum: ['off', 'on'],
|
|
- description: nls.localize('debug.console.acceptSuggestionOnEnter', "Controls whether suggestions should be accepted on Enter in the Debug Console. Enter is also used to evaluate whatever is typed in the Debug Console."),
|
|
- default: 'off'
|
|
- },
|
|
- 'debug.console.maximumLines': {
|
|
- type: 'number',
|
|
- description: nls.localize('debug.console.maximumLines', "Controls the maximum number of lines in the Debug Console."),
|
|
- default: 10000
|
|
- },
|
|
- 'launch': {
|
|
- type: 'object',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'launch' }, "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces."),
|
|
- default: { configurations: [], compounds: [] },
|
|
- $ref: launchSchemaId,
|
|
- disallowConfigurationDefault: true
|
|
- },
|
|
- 'debug.focusWindowOnBreak': {
|
|
- type: 'boolean',
|
|
- description: nls.localize('debug.focusWindowOnBreak', "Controls whether the workbench window should be focused when the debugger breaks."),
|
|
- default: true
|
|
- },
|
|
- 'debug.focusEditorOnBreak': {
|
|
- type: 'boolean',
|
|
- description: nls.localize('debug.focusEditorOnBreak', "Controls whether the editor should be focused when the debugger breaks."),
|
|
- default: true
|
|
- },
|
|
- 'debug.onTaskErrors': {
|
|
- enum: ['debugAnyway', 'showErrors', 'prompt', 'abort'],
|
|
- enumDescriptions: [nls.localize('debugAnyway', "Ignore task errors and start debugging."), nls.localize('showErrors', "Show the Problems view and do not start debugging."), nls.localize('prompt', "Prompt user."), nls.localize('cancel', "Cancel debugging.")],
|
|
- description: nls.localize('debug.onTaskErrors', "Controls what to do when errors are encountered after running a preLaunchTask."),
|
|
- default: 'prompt'
|
|
- },
|
|
- 'debug.showBreakpointsInOverviewRuler': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'showBreakpointsInOverviewRuler' }, "Controls whether breakpoints should be shown in the overview ruler."),
|
|
- default: false
|
|
- },
|
|
- 'debug.showInlineBreakpointCandidates': {
|
|
- type: 'boolean',
|
|
- description: nls.localize({ comment: ['This is the description for a setting'], key: 'showInlineBreakpointCandidates' }, "Controls whether inline breakpoints candidate decorations should be shown in the editor while debugging."),
|
|
- default: true
|
|
- },
|
|
- 'debug.saveBeforeStart': {
|
|
- description: nls.localize('debug.saveBeforeStart', "Controls what editors to save before starting a debug session."),
|
|
- enum: ['allEditorsInActiveGroup', 'nonUntitledEditorsInActiveGroup', 'none'],
|
|
- enumDescriptions: [
|
|
- nls.localize('debug.saveBeforeStart.allEditorsInActiveGroup', "Save all editors in the active group before starting a debug session."),
|
|
- nls.localize('debug.saveBeforeStart.nonUntitledEditorsInActiveGroup', "Save all editors in the active group except untitled ones before starting a debug session."),
|
|
- nls.localize('debug.saveBeforeStart.none', "Don't save any editors before starting a debug session."),
|
|
- ],
|
|
- default: 'allEditorsInActiveGroup',
|
|
- scope: ConfigurationScope.LANGUAGE_OVERRIDABLE
|
|
- },
|
|
- 'debug.confirmOnExit': {
|
|
- description: nls.localize('debug.confirmOnExit', "Controls whether to confirm when the window closes if there are active debug sessions."),
|
|
- type: 'string',
|
|
- enum: ['never', 'always'],
|
|
- enumDescriptions: [
|
|
- nls.localize('debug.confirmOnExit.never', "Never confirm."),
|
|
- nls.localize('debug.confirmOnExit.always', "Always confirm if there are debug sessions."),
|
|
- ],
|
|
- default: 'never'
|
|
- },
|
|
- 'debug.disassemblyView.showSourceCode': {
|
|
- type: 'boolean',
|
|
- default: true,
|
|
- description: nls.localize('debug.disassemblyView.showSourceCode', "Show Source Code in Disassembly View.")
|
|
- },
|
|
- 'debug.autoExpandLazyVariables': {
|
|
- type: 'string',
|
|
- enum: ['auto', 'on', 'off'],
|
|
- default: 'auto',
|
|
- enumDescriptions: [
|
|
- nls.localize('debug.autoExpandLazyVariables.auto', "When in screen reader optimized mode, automatically expand lazy variables."),
|
|
- nls.localize('debug.autoExpandLazyVariables.on', "Always automatically expand lazy variables."),
|
|
- nls.localize('debug.autoExpandLazyVariables.off', "Never automatically expand lazy variables.")
|
|
- ],
|
|
- description: nls.localize('debug.autoExpandLazyVariables', "Controls whether variables that are lazily resolved, such as getters, are automatically resolved and expanded by the debugger.")
|
|
- },
|
|
- 'debug.enableStatusBarColor': {
|
|
- type: 'boolean',
|
|
- description: nls.localize('debug.enableStatusBarColor', "Color of the Status bar when debugger is active."),
|
|
- default: true
|
|
- },
|
|
- 'debug.hideLauncherWhileDebugging': {
|
|
- type: 'boolean',
|
|
- markdownDescription: nls.localize({ comment: ['This is the description for a setting'], key: 'debug.hideLauncherWhileDebugging' }, "Hide 'Start Debugging' control in title bar of 'Run and Debug' view while debugging is active. Only relevant when {0} is not `docked`.", '`#debug.toolBarLocation#`'),
|
|
- default: false
|
|
- },
|
|
- 'debug.hideSlowPreLaunchWarning': {
|
|
- type: 'boolean',
|
|
- markdownDescription: nls.localize('debug.hideSlowPreLaunchWarning', "Hide the warning shown when a `preLaunchTask` has been running for a while."),
|
|
- default: false
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-AccessibleViewRegistry.register(new ReplAccessibleView());
|
|
-AccessibleViewRegistry.register(new ReplAccessibilityHelp());
|
|
-AccessibleViewRegistry.register(new RunAndDebugAccessibilityHelp());
|
|
-registerWorkbenchContribution2(ReplAccessibilityAnnouncer.ID, ReplAccessibilityAnnouncer, WorkbenchPhase.AfterRestored);
|
|
-registerWorkbenchContribution2(DebugWatchAccessibilityAnnouncer.ID, DebugWatchAccessibilityAnnouncer, WorkbenchPhase.AfterRestored);
|
|
+registerSingleton(IDebugService, DebugService, InstantiationType.Delayed);
|
|
diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts
|
|
index 816f372aceb..191146749c3 100644
|
|
--- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts
|
|
+++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts
|
|
@@ -4,2042 +4,9 @@
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import './media/extensionManagement.css';
|
|
-import { localize, localize2 } from '../../../../nls.js';
|
|
-import { KeyMod, KeyCode } from '../../../../base/common/keyCodes.js';
|
|
-import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
-import { MenuRegistry, MenuId, registerAction2, Action2, IMenuItem, IAction2Options } from '../../../../platform/actions/common/actions.js';
|
|
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
|
-import { ExtensionsLocalizedLabel, IExtensionManagementService, IExtensionGalleryService, PreferencesLocalizedLabel, EXTENSION_INSTALL_SOURCE_CONTEXT, ExtensionInstallSource, SortBy, FilterType, VerifyExtensionSignatureConfigKey } from '../../../../platform/extensionManagement/common/extensionManagement.js';
|
|
-import { EnablementState, IExtensionManagementServerService, IPublisherInfo, IWorkbenchExtensionEnablementService, IWorkbenchExtensionManagementService } from '../../../services/extensionManagement/common/extensionManagement.js';
|
|
-import { IExtensionIgnoredRecommendationsService, IExtensionRecommendationsService } from '../../../services/extensionRecommendations/common/extensionRecommendations.js';
|
|
-import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution, registerWorkbenchContribution2, WorkbenchPhase } from '../../../common/contributions.js';
|
|
-import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
|
|
-import { VIEWLET_ID, IExtensionsWorkbenchService, IExtensionsViewPaneContainer, TOGGLE_IGNORE_EXTENSION_ACTION_ID, INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID, WORKSPACE_RECOMMENDATIONS_VIEW_ID, IWorkspaceRecommendedExtensionsView, AutoUpdateConfigurationKey, HasOutdatedExtensionsContext, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, ExtensionEditorTab, THEME_ACTIONS_GROUP, INSTALL_ACTIONS_GROUP, OUTDATED_EXTENSIONS_VIEW_ID, CONTEXT_HAS_GALLERY, extensionsSearchActionsMenu, UPDATE_ACTIONS_GROUP, IExtensionArg, ExtensionRuntimeActionType, EXTENSIONS_CATEGORY, AutoRestartConfigurationKey, extensionsFilterSubMenu, DefaultViewsContext } from '../common/extensions.js';
|
|
-import { InstallSpecificVersionOfExtensionAction, ConfigureWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction, SetColorThemeAction, SetFileIconThemeAction, SetProductIconThemeAction, ClearLanguageAction, ToggleAutoUpdateForExtensionAction, ToggleAutoUpdatesForPublisherAction, TogglePreReleaseExtensionAction, InstallAnotherVersionAction, InstallAction } from './extensionsActions.js';
|
|
-import { ExtensionsInput } from '../common/extensionsInput.js';
|
|
-import { ExtensionEditor } from './extensionEditor.js';
|
|
-import { StatusUpdater, MaliciousExtensionChecker, ExtensionsViewletViewsContribution, ExtensionsViewPaneContainer, BuiltInExtensionsContext, SearchMarketplaceExtensionsContext, RecommendedExtensionsContext, ExtensionsSortByContext, SearchHasTextContext, ExtensionsSearchValueContext } from './extensionsViewlet.js';
|
|
-import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from '../../../../platform/configuration/common/configurationRegistry.js';
|
|
-import * as jsonContributionRegistry from '../../../../platform/jsonschemas/common/jsonContributionRegistry.js';
|
|
-import { ExtensionsConfigurationSchema, ExtensionsConfigurationSchemaId } from '../common/extensionsFileTemplate.js';
|
|
-import { CommandsRegistry, ICommandService } from '../../../../platform/commands/common/commands.js';
|
|
-import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
|
|
-import { KeymapExtensions } from '../common/extensionsUtils.js';
|
|
-import { areSameExtensions, getIdAndVersion } from '../../../../platform/extensionManagement/common/extensionManagementUtil.js';
|
|
-import { EditorPaneDescriptor, IEditorPaneRegistry } from '../../../browser/editor.js';
|
|
-import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
|
|
-import { URI, UriComponents } from '../../../../base/common/uri.js';
|
|
-import { ExtensionActivationProgress } from './extensionsActivationProgress.js';
|
|
-import { onUnexpectedError } from '../../../../base/common/errors.js';
|
|
-import { ExtensionDependencyChecker } from './extensionsDependencyChecker.js';
|
|
-import { CancellationToken } from '../../../../base/common/cancellation.js';
|
|
-import { IViewContainersRegistry, ViewContainerLocation, Extensions as ViewContainerExtensions } from '../../../common/views.js';
|
|
-import { IViewsService } from '../../../services/views/common/viewsService.js';
|
|
-import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
|
|
-import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
|
|
-import { ContextKeyExpr, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
|
|
-import { IQuickAccessRegistry, Extensions } from '../../../../platform/quickinput/common/quickAccess.js';
|
|
-import { InstallExtensionQuickAccessProvider, ManageExtensionsQuickAccessProvider } from './extensionsQuickAccess.js';
|
|
-import { ExtensionRecommendationsService } from './extensionRecommendationsService.js';
|
|
-import { CONTEXT_SYNC_ENABLEMENT } from '../../../services/userDataSync/common/userDataSync.js';
|
|
-import { CopyAction, CutAction, PasteAction } from '../../../../editor/contrib/clipboard/browser/clipboard.js';
|
|
-import { IEditorService } from '../../../services/editor/common/editorService.js';
|
|
-import { MultiCommand } from '../../../../editor/browser/editorExtensions.js';
|
|
-import { IWebview } from '../../webview/browser/webview.js';
|
|
+import { IExtensionsWorkbenchService } from '../common/extensions.js';
|
|
import { ExtensionsWorkbenchService } from './extensionsWorkbenchService.js';
|
|
-import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
|
|
-import { IExtensionRecommendationNotificationService } from '../../../../platform/extensionRecommendations/common/extensionRecommendations.js';
|
|
-import { ExtensionRecommendationNotificationService } from './extensionRecommendationNotificationService.js';
|
|
-import { INotificationService, Severity } from '../../../../platform/notification/common/notification.js';
|
|
-import { IHostService } from '../../../services/host/browser/host.js';
|
|
-import { ResourceContextKey, WorkbenchStateContext } from '../../../common/contextkeys.js';
|
|
-import { IAction } from '../../../../base/common/actions.js';
|
|
-import { IWorkspaceExtensionsConfigService } from '../../../services/extensionRecommendations/common/workspaceExtensionsConfig.js';
|
|
-import { Schemas } from '../../../../base/common/network.js';
|
|
-import { ShowRuntimeExtensionsAction } from './abstractRuntimeExtensionsEditor.js';
|
|
-import { ExtensionEnablementWorkspaceTrustTransitionParticipant } from './extensionEnablementWorkspaceTrustTransitionParticipant.js';
|
|
-import { clearSearchResultsIcon, configureRecommendedIcon, extensionsViewIcon, filterIcon, installWorkspaceRecommendedIcon, refreshIcon } from './extensionsIcons.js';
|
|
-import { EXTENSION_CATEGORIES, ExtensionType } from '../../../../platform/extensions/common/extensions.js';
|
|
-import { Disposable, DisposableStore, IDisposable, isDisposable } from '../../../../base/common/lifecycle.js';
|
|
-import { IDialogService, IFileDialogService } from '../../../../platform/dialogs/common/dialogs.js';
|
|
-import { mnemonicButtonLabel } from '../../../../base/common/labels.js';
|
|
-import { Query } from '../common/extensionQuery.js';
|
|
-import { EditorExtensions } from '../../../common/editor.js';
|
|
-import { WORKSPACE_TRUST_EXTENSION_SUPPORT } from '../../../services/workspaces/common/workspaceTrust.js';
|
|
-import { ExtensionsCompletionItemsProvider } from './extensionsCompletionItemsProvider.js';
|
|
-import { IQuickInputService } from '../../../../platform/quickinput/common/quickInput.js';
|
|
-import { Event } from '../../../../base/common/event.js';
|
|
-import { UnsupportedExtensionsMigrationContrib } from './unsupportedExtensionsMigrationContribution.js';
|
|
-import { isNative, isWeb } from '../../../../base/common/platform.js';
|
|
-import { ExtensionStorageService } from '../../../../platform/extensionManagement/common/extensionStorage.js';
|
|
-import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
|
|
-import { IStringDictionary } from '../../../../base/common/collections.js';
|
|
-import { CONTEXT_KEYBINDINGS_EDITOR } from '../../preferences/common/preferences.js';
|
|
-import { ProgressLocation } from '../../../../platform/progress/common/progress.js';
|
|
-import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
|
|
-import { IConfigurationMigrationRegistry, Extensions as ConfigurationMigrationExtensions } from '../../../common/configuration.js';
|
|
-import { IProductService } from '../../../../platform/product/common/productService.js';
|
|
-import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js';
|
|
-import product from '../../../../platform/product/common/product.js';
|
|
-import { ExtensionGalleryResourceType, ExtensionGalleryServiceUrlConfigKey, getExtensionGalleryManifestResourceUri, IExtensionGalleryManifest, IExtensionGalleryManifestService } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js';
|
|
-import { ILanguageModelToolsService } from '../../chat/common/languageModelToolsService.js';
|
|
-import { SearchExtensionsTool, SearchExtensionsToolData } from '../common/searchExtensionsTool.js';
|
|
|
|
// Singletons
|
|
-registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService, InstantiationType.Eager /* Auto updates extensions */);
|
|
-registerSingleton(IExtensionRecommendationNotificationService, ExtensionRecommendationNotificationService, InstantiationType.Delayed);
|
|
-registerSingleton(IExtensionRecommendationsService, ExtensionRecommendationsService, InstantiationType.Eager /* Prompts recommendations in the background */);
|
|
-
|
|
-// Quick Access
|
|
-Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
|
|
- ctor: ManageExtensionsQuickAccessProvider,
|
|
- prefix: ManageExtensionsQuickAccessProvider.PREFIX,
|
|
- placeholder: localize('manageExtensionsQuickAccessPlaceholder', "Press Enter to manage extensions."),
|
|
- helpEntries: [{ description: localize('manageExtensionsHelp', "Manage Extensions") }]
|
|
-});
|
|
-
|
|
-// Editor
|
|
-Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane).registerEditorPane(
|
|
- EditorPaneDescriptor.create(
|
|
- ExtensionEditor,
|
|
- ExtensionEditor.ID,
|
|
- localize('extension', "Extension")
|
|
- ),
|
|
- [
|
|
- new SyncDescriptor(ExtensionsInput)
|
|
- ]);
|
|
-
|
|
-export const VIEW_CONTAINER = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(
|
|
- {
|
|
- id: VIEWLET_ID,
|
|
- title: localize2('extensions', "Extensions"),
|
|
- openCommandActionDescriptor: {
|
|
- id: VIEWLET_ID,
|
|
- mnemonicTitle: localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions"),
|
|
- keybindings: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyX },
|
|
- order: 4,
|
|
- },
|
|
- ctorDescriptor: new SyncDescriptor(ExtensionsViewPaneContainer),
|
|
- icon: extensionsViewIcon,
|
|
- order: 4,
|
|
- rejectAddedViews: true,
|
|
- alwaysUseContainerInfo: true,
|
|
- }, ViewContainerLocation.Sidebar);
|
|
-
|
|
-Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
|
- .registerConfiguration({
|
|
- id: 'extensions',
|
|
- order: 30,
|
|
- title: localize('extensionsConfigurationTitle', "Extensions"),
|
|
- type: 'object',
|
|
- properties: {
|
|
- 'extensions.autoUpdate': {
|
|
- enum: [true, 'onlyEnabledExtensions', false,],
|
|
- enumItemLabels: [
|
|
- localize('all', "All Extensions"),
|
|
- localize('enabled', "Only Enabled Extensions"),
|
|
- localize('none', "None"),
|
|
- ],
|
|
- enumDescriptions: [
|
|
- localize('extensions.autoUpdate.true', 'Download and install updates automatically for all extensions.'),
|
|
- localize('extensions.autoUpdate.enabled', 'Download and install updates automatically only for enabled extensions.'),
|
|
- localize('extensions.autoUpdate.false', 'Extensions are not automatically updated.'),
|
|
- ],
|
|
- description: localize('extensions.autoUpdate', "Controls the automatic update behavior of extensions. The updates are fetched from a Microsoft online service."),
|
|
- default: true,
|
|
- scope: ConfigurationScope.APPLICATION,
|
|
- tags: ['usesOnlineServices']
|
|
- },
|
|
- 'extensions.autoCheckUpdates': {
|
|
- type: 'boolean',
|
|
- description: localize('extensionsCheckUpdates', "When enabled, automatically checks extensions for updates. If an extension has an update, it is marked as outdated in the Extensions view. The updates are fetched from a Microsoft online service."),
|
|
- default: true,
|
|
- scope: ConfigurationScope.APPLICATION,
|
|
- tags: ['usesOnlineServices']
|
|
- },
|
|
- 'extensions.ignoreRecommendations': {
|
|
- type: 'boolean',
|
|
- description: localize('extensionsIgnoreRecommendations', "When enabled, the notifications for extension recommendations will not be shown."),
|
|
- default: false
|
|
- },
|
|
- 'extensions.showRecommendationsOnlyOnDemand': {
|
|
- type: 'boolean',
|
|
- deprecationMessage: localize('extensionsShowRecommendationsOnlyOnDemand_Deprecated', "This setting is deprecated. Use extensions.ignoreRecommendations setting to control recommendation notifications. Use Extensions view's visibility actions to hide Recommended view by default."),
|
|
- default: false,
|
|
- tags: ['usesOnlineServices']
|
|
- },
|
|
- 'extensions.closeExtensionDetailsOnViewChange': {
|
|
- type: 'boolean',
|
|
- description: localize('extensionsCloseExtensionDetailsOnViewChange', "When enabled, editors with extension details will be automatically closed upon navigating away from the Extensions View."),
|
|
- default: false
|
|
- },
|
|
- 'extensions.confirmedUriHandlerExtensionIds': {
|
|
- type: 'array',
|
|
- items: {
|
|
- type: 'string'
|
|
- },
|
|
- description: localize('handleUriConfirmedExtensions', "When an extension is listed here, a confirmation prompt will not be shown when that extension handles a URI."),
|
|
- default: [],
|
|
- scope: ConfigurationScope.APPLICATION
|
|
- },
|
|
- 'extensions.webWorker': {
|
|
- type: ['boolean', 'string'],
|
|
- enum: [true, false, 'auto'],
|
|
- enumDescriptions: [
|
|
- localize('extensionsWebWorker.true', "The Web Worker Extension Host will always be launched."),
|
|
- localize('extensionsWebWorker.false', "The Web Worker Extension Host will never be launched."),
|
|
- localize('extensionsWebWorker.auto', "The Web Worker Extension Host will be launched when a web extension needs it."),
|
|
- ],
|
|
- description: localize('extensionsWebWorker', "Enable web worker extension host."),
|
|
- default: 'auto'
|
|
- },
|
|
- 'extensions.supportVirtualWorkspaces': {
|
|
- type: 'object',
|
|
- markdownDescription: localize('extensions.supportVirtualWorkspaces', "Override the virtual workspaces support of an extension."),
|
|
- patternProperties: {
|
|
- '([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$': {
|
|
- type: 'boolean',
|
|
- default: false
|
|
- }
|
|
- },
|
|
- additionalProperties: false,
|
|
- default: {},
|
|
- defaultSnippets: [{
|
|
- 'body': {
|
|
- 'pub.name': false
|
|
- }
|
|
- }]
|
|
- },
|
|
- 'extensions.experimental.affinity': {
|
|
- type: 'object',
|
|
- markdownDescription: localize('extensions.affinity', "Configure an extension to execute in a different extension host process."),
|
|
- patternProperties: {
|
|
- '([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$': {
|
|
- type: 'integer',
|
|
- default: 1
|
|
- }
|
|
- },
|
|
- additionalProperties: false,
|
|
- default: {},
|
|
- defaultSnippets: [{
|
|
- 'body': {
|
|
- 'pub.name': 1
|
|
- }
|
|
- }]
|
|
- },
|
|
- [WORKSPACE_TRUST_EXTENSION_SUPPORT]: {
|
|
- type: 'object',
|
|
- scope: ConfigurationScope.APPLICATION,
|
|
- markdownDescription: localize('extensions.supportUntrustedWorkspaces', "Override the untrusted workspace support of an extension. Extensions using `true` will always be enabled. Extensions using `limited` will always be enabled, and the extension will hide functionality that requires trust. Extensions using `false` will only be enabled only when the workspace is trusted."),
|
|
- patternProperties: {
|
|
- '([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$': {
|
|
- type: 'object',
|
|
- properties: {
|
|
- 'supported': {
|
|
- type: ['boolean', 'string'],
|
|
- enum: [true, false, 'limited'],
|
|
- enumDescriptions: [
|
|
- localize('extensions.supportUntrustedWorkspaces.true', "Extension will always be enabled."),
|
|
- localize('extensions.supportUntrustedWorkspaces.false', "Extension will only be enabled only when the workspace is trusted."),
|
|
- localize('extensions.supportUntrustedWorkspaces.limited', "Extension will always be enabled, and the extension will hide functionality requiring trust."),
|
|
- ],
|
|
- description: localize('extensions.supportUntrustedWorkspaces.supported', "Defines the untrusted workspace support setting for the extension."),
|
|
- },
|
|
- 'version': {
|
|
- type: 'string',
|
|
- description: localize('extensions.supportUntrustedWorkspaces.version', "Defines the version of the extension for which the override should be applied. If not specified, the override will be applied independent of the extension version."),
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- },
|
|
- 'extensions.experimental.deferredStartupFinishedActivation': {
|
|
- type: 'boolean',
|
|
- description: localize('extensionsDeferredStartupFinishedActivation', "When enabled, extensions which declare the `onStartupFinished` activation event will be activated after a timeout."),
|
|
- default: false
|
|
- },
|
|
- 'extensions.experimental.issueQuickAccess': {
|
|
- type: 'boolean',
|
|
- description: localize('extensionsInQuickAccess', "When enabled, extensions can be searched for via Quick Access and report issues from there."),
|
|
- default: true
|
|
- },
|
|
- [VerifyExtensionSignatureConfigKey]: {
|
|
- type: 'boolean',
|
|
- description: localize('extensions.verifySignature', "When enabled, extensions are verified to be signed before getting installed."),
|
|
- default: true,
|
|
- scope: ConfigurationScope.APPLICATION,
|
|
- included: isNative
|
|
- },
|
|
- [AutoRestartConfigurationKey]: {
|
|
- type: 'boolean',
|
|
- description: localize('autoRestart', "If activated, extensions will automatically restart following an update if the window is not in focus. There can be a data loss if you have open Notebooks or Custom Editors."),
|
|
- default: false,
|
|
- included: product.quality !== 'stable'
|
|
- },
|
|
- [ExtensionGalleryServiceUrlConfigKey]: {
|
|
- type: 'string',
|
|
- description: localize('extensions.gallery.serviceUrl', "Configure the Marketplace service URL to connect to"),
|
|
- default: '',
|
|
- scope: ConfigurationScope.APPLICATION,
|
|
- tags: ['usesOnlineServices'],
|
|
- included: false,
|
|
- policy: {
|
|
- name: 'ExtensionGalleryServiceUrl',
|
|
- minimumVersion: '1.99',
|
|
- },
|
|
- },
|
|
- 'extensions.supportNodeGlobalNavigator': {
|
|
- type: 'boolean',
|
|
- description: localize('extensionsSupportNodeGlobalNavigator', "When enabled, Node.js navigator object is exposed on the global scope."),
|
|
- default: false,
|
|
- },
|
|
- }
|
|
- });
|
|
-
|
|
-const jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
|
|
-jsonRegistry.registerSchema(ExtensionsConfigurationSchemaId, ExtensionsConfigurationSchema);
|
|
-
|
|
-// Register Commands
|
|
-CommandsRegistry.registerCommand('_extensions.manage', (accessor: ServicesAccessor, extensionId: string, tab?: ExtensionEditorTab, preserveFocus?: boolean, feature?: string) => {
|
|
- const extensionService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = extensionService.local.find(e => areSameExtensions(e.identifier, { id: extensionId }));
|
|
- if (extension) {
|
|
- extensionService.open(extension, { tab, preserveFocus, feature });
|
|
- } else {
|
|
- throw new Error(localize('notFound', "Extension '{0}' not found.", extensionId));
|
|
- }
|
|
-});
|
|
-
|
|
-CommandsRegistry.registerCommand('extension.open', async (accessor: ServicesAccessor, extensionId: string, tab?: ExtensionEditorTab, preserveFocus?: boolean, feature?: string, sideByside?: boolean) => {
|
|
- const extensionService = accessor.get(IExtensionsWorkbenchService);
|
|
- const commandService = accessor.get(ICommandService);
|
|
-
|
|
- const [extension] = await extensionService.getExtensions([{ id: extensionId }], CancellationToken.None);
|
|
- if (extension) {
|
|
- return extensionService.open(extension, { tab, preserveFocus, feature, sideByside });
|
|
- }
|
|
-
|
|
- return commandService.executeCommand('_extensions.manage', extensionId, tab, preserveFocus, feature);
|
|
-});
|
|
-
|
|
-CommandsRegistry.registerCommand({
|
|
- id: 'workbench.extensions.installExtension',
|
|
- metadata: {
|
|
- description: localize('workbench.extensions.installExtension.description', "Install the given extension"),
|
|
- args: [
|
|
- {
|
|
- name: 'extensionIdOrVSIXUri',
|
|
- description: localize('workbench.extensions.installExtension.arg.decription', "Extension id or VSIX resource uri"),
|
|
- constraint: (value: any) => typeof value === 'string' || value instanceof URI,
|
|
- },
|
|
- {
|
|
- name: 'options',
|
|
- description: '(optional) Options for installing the extension. Object with the following properties: ' +
|
|
- '`installOnlyNewlyAddedFromExtensionPackVSIX`: When enabled, VS Code installs only newly added extensions from the extension pack VSIX. This option is considered only when installing VSIX. ',
|
|
- isOptional: true,
|
|
- schema: {
|
|
- 'type': 'object',
|
|
- 'properties': {
|
|
- 'installOnlyNewlyAddedFromExtensionPackVSIX': {
|
|
- 'type': 'boolean',
|
|
- 'description': localize('workbench.extensions.installExtension.option.installOnlyNewlyAddedFromExtensionPackVSIX', "When enabled, VS Code installs only newly added extensions from the extension pack VSIX. This option is considered only while installing a VSIX."),
|
|
- default: false
|
|
- },
|
|
- 'installPreReleaseVersion': {
|
|
- 'type': 'boolean',
|
|
- 'description': localize('workbench.extensions.installExtension.option.installPreReleaseVersion', "When enabled, VS Code installs the pre-release version of the extension if available."),
|
|
- default: false
|
|
- },
|
|
- 'donotSync': {
|
|
- 'type': 'boolean',
|
|
- 'description': localize('workbench.extensions.installExtension.option.donotSync', "When enabled, VS Code do not sync this extension when Settings Sync is on."),
|
|
- default: false
|
|
- },
|
|
- 'justification': {
|
|
- 'type': ['string', 'object'],
|
|
- 'description': localize('workbench.extensions.installExtension.option.justification', "Justification for installing the extension. This is a string or an object that can be used to pass any information to the installation handlers. i.e. `{reason: 'This extension wants to open a URI', action: 'Open URI'}` will show a message box with the reason and action upon install."),
|
|
- },
|
|
- 'enable': {
|
|
- 'type': 'boolean',
|
|
- 'description': localize('workbench.extensions.installExtension.option.enable', "When enabled, the extension will be enabled if it is installed but disabled. If the extension is already enabled, this has no effect."),
|
|
- default: false
|
|
- },
|
|
- 'context': {
|
|
- 'type': 'object',
|
|
- 'description': localize('workbench.extensions.installExtension.option.context', "Context for the installation. This is a JSON object that can be used to pass any information to the installation handlers. i.e. `{skipWalkthrough: true}` will skip opening the walkthrough upon install."),
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- ]
|
|
- },
|
|
- handler: async (
|
|
- accessor,
|
|
- arg: string | UriComponents,
|
|
- options?: {
|
|
- installOnlyNewlyAddedFromExtensionPackVSIX?: boolean;
|
|
- installPreReleaseVersion?: boolean;
|
|
- donotSync?: boolean;
|
|
- justification?: string | { reason: string; action: string };
|
|
- enable?: boolean;
|
|
- context?: IStringDictionary<any>;
|
|
- }) => {
|
|
- const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extensionManagementService = accessor.get(IWorkbenchExtensionManagementService);
|
|
- const extensionGalleryService = accessor.get(IExtensionGalleryService);
|
|
- try {
|
|
- if (typeof arg === 'string') {
|
|
- const [id, version] = getIdAndVersion(arg);
|
|
- const extension = extensionsWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id, uuid: version }));
|
|
- if (extension?.enablementState === EnablementState.DisabledByExtensionKind) {
|
|
- const [gallery] = await extensionGalleryService.getExtensions([{ id, preRelease: options?.installPreReleaseVersion }], CancellationToken.None);
|
|
- if (!gallery) {
|
|
- throw new Error(localize('notFound', "Extension '{0}' not found.", arg));
|
|
- }
|
|
- await extensionManagementService.installFromGallery(gallery, {
|
|
- isMachineScoped: options?.donotSync ? true : undefined, /* do not allow syncing extensions automatically while installing through the command */
|
|
- installPreReleaseVersion: options?.installPreReleaseVersion,
|
|
- installGivenVersion: !!version,
|
|
- context: { ...options?.context, [EXTENSION_INSTALL_SOURCE_CONTEXT]: ExtensionInstallSource.COMMAND },
|
|
- });
|
|
- } else {
|
|
- await extensionsWorkbenchService.install(arg, {
|
|
- version,
|
|
- installPreReleaseVersion: options?.installPreReleaseVersion,
|
|
- context: { ...options?.context, [EXTENSION_INSTALL_SOURCE_CONTEXT]: ExtensionInstallSource.COMMAND },
|
|
- justification: options?.justification,
|
|
- enable: options?.enable,
|
|
- isMachineScoped: options?.donotSync ? true : undefined, /* do not allow syncing extensions automatically while installing through the command */
|
|
- }, ProgressLocation.Notification);
|
|
- }
|
|
- } else {
|
|
- const vsix = URI.revive(arg);
|
|
- await extensionsWorkbenchService.install(vsix, { installGivenVersion: true });
|
|
- }
|
|
- } catch (e) {
|
|
- onUnexpectedError(e);
|
|
- throw e;
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-CommandsRegistry.registerCommand({
|
|
- id: 'workbench.extensions.uninstallExtension',
|
|
- metadata: {
|
|
- description: localize('workbench.extensions.uninstallExtension.description', "Uninstall the given extension"),
|
|
- args: [
|
|
- {
|
|
- name: localize('workbench.extensions.uninstallExtension.arg.name', "Id of the extension to uninstall"),
|
|
- schema: {
|
|
- 'type': 'string'
|
|
- }
|
|
- }
|
|
- ]
|
|
- },
|
|
- handler: async (accessor, id: string) => {
|
|
- if (!id) {
|
|
- throw new Error(localize('id required', "Extension id required."));
|
|
- }
|
|
- const extensionManagementService = accessor.get(IExtensionManagementService);
|
|
- const installed = await extensionManagementService.getInstalled();
|
|
- const [extensionToUninstall] = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
|
- if (!extensionToUninstall) {
|
|
- throw new Error(localize('notInstalled', "Extension '{0}' is not installed. Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp.", id));
|
|
- }
|
|
- if (extensionToUninstall.isBuiltin) {
|
|
- throw new Error(localize('builtin', "Extension '{0}' is a Built-in extension and cannot be uninstalled", id));
|
|
- }
|
|
-
|
|
- try {
|
|
- await extensionManagementService.uninstall(extensionToUninstall);
|
|
- } catch (e) {
|
|
- onUnexpectedError(e);
|
|
- throw e;
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-CommandsRegistry.registerCommand({
|
|
- id: 'workbench.extensions.search',
|
|
- metadata: {
|
|
- description: localize('workbench.extensions.search.description', "Search for a specific extension"),
|
|
- args: [
|
|
- {
|
|
- name: localize('workbench.extensions.search.arg.name', "Query to use in search"),
|
|
- schema: { 'type': 'string' }
|
|
- }
|
|
- ]
|
|
- },
|
|
- handler: async (accessor, query: string = '') => {
|
|
- return accessor.get(IExtensionsWorkbenchService).openSearch(query);
|
|
- }
|
|
-});
|
|
-
|
|
-function overrideActionForActiveExtensionEditorWebview(command: MultiCommand | undefined, f: (webview: IWebview) => void) {
|
|
- command?.addImplementation(105, 'extensions-editor', (accessor) => {
|
|
- const editorService = accessor.get(IEditorService);
|
|
- const editor = editorService.activeEditorPane;
|
|
- if (editor instanceof ExtensionEditor) {
|
|
- if (editor.activeWebview?.isFocused) {
|
|
- f(editor.activeWebview);
|
|
- return true;
|
|
- }
|
|
- }
|
|
- return false;
|
|
- });
|
|
-}
|
|
-
|
|
-overrideActionForActiveExtensionEditorWebview(CopyAction, webview => webview.copy());
|
|
-overrideActionForActiveExtensionEditorWebview(CutAction, webview => webview.cut());
|
|
-overrideActionForActiveExtensionEditorWebview(PasteAction, webview => webview.paste());
|
|
-
|
|
-// Contexts
|
|
-export const CONTEXT_HAS_LOCAL_SERVER = new RawContextKey<boolean>('hasLocalServer', false);
|
|
-export const CONTEXT_HAS_REMOTE_SERVER = new RawContextKey<boolean>('hasRemoteServer', false);
|
|
-export const CONTEXT_HAS_WEB_SERVER = new RawContextKey<boolean>('hasWebServer', false);
|
|
-const CONTEXT_GALLERY_SORT_CAPABILITIES = new RawContextKey<string>('gallerySortCapabilities', '');
|
|
-const CONTEXT_GALLERY_FILTER_CAPABILITIES = new RawContextKey<string>('galleryFilterCapabilities', '');
|
|
-const CONTEXT_GALLERY_ALL_PUBLIC_REPOSITORY_SIGNED = new RawContextKey<boolean>('galleryAllPublicRepositorySigned', false);
|
|
-const CONTEXT_GALLERY_ALL_PRIVATE_REPOSITORY_SIGNED = new RawContextKey<boolean>('galleryAllPrivateRepositorySigned', false);
|
|
-const CONTEXT_GALLERY_HAS_EXTENSION_LINK = new RawContextKey<boolean>('galleryHasExtensionLink', false);
|
|
-
|
|
-async function runAction(action: IAction): Promise<void> {
|
|
- try {
|
|
- await action.run();
|
|
- } finally {
|
|
- if (isDisposable(action)) {
|
|
- action.dispose();
|
|
- }
|
|
- }
|
|
-}
|
|
-
|
|
-type IExtensionActionOptions = IAction2Options & {
|
|
- menuTitles?: { [id: string]: string };
|
|
- run(accessor: ServicesAccessor, ...args: any[]): Promise<any>;
|
|
-};
|
|
-
|
|
-class ExtensionsContributions extends Disposable implements IWorkbenchContribution {
|
|
-
|
|
- constructor(
|
|
- @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
|
- @IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
|
- @IExtensionGalleryService extensionGalleryService: IExtensionGalleryService,
|
|
- @IExtensionGalleryManifestService extensionGalleryManifestService: IExtensionGalleryManifestService,
|
|
- @IContextKeyService private readonly contextKeyService: IContextKeyService,
|
|
- @IViewsService private readonly viewsService: IViewsService,
|
|
- @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
|
- @IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService,
|
|
- @IInstantiationService private readonly instantiationService: IInstantiationService,
|
|
- @IDialogService private readonly dialogService: IDialogService,
|
|
- @ICommandService private readonly commandService: ICommandService,
|
|
- @IProductService private readonly productService: IProductService,
|
|
- ) {
|
|
- super();
|
|
- const hasGalleryContext = CONTEXT_HAS_GALLERY.bindTo(contextKeyService);
|
|
- if (extensionGalleryService.isEnabled()) {
|
|
- hasGalleryContext.set(true);
|
|
- }
|
|
-
|
|
- const hasLocalServerContext = CONTEXT_HAS_LOCAL_SERVER.bindTo(contextKeyService);
|
|
- if (this.extensionManagementServerService.localExtensionManagementServer) {
|
|
- hasLocalServerContext.set(true);
|
|
- }
|
|
-
|
|
- const hasRemoteServerContext = CONTEXT_HAS_REMOTE_SERVER.bindTo(contextKeyService);
|
|
- if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
|
- hasRemoteServerContext.set(true);
|
|
- }
|
|
-
|
|
- const hasWebServerContext = CONTEXT_HAS_WEB_SERVER.bindTo(contextKeyService);
|
|
- if (this.extensionManagementServerService.webExtensionManagementServer) {
|
|
- hasWebServerContext.set(true);
|
|
- }
|
|
-
|
|
- extensionGalleryManifestService.getExtensionGalleryManifest()
|
|
- .then(extensionGalleryManifest => {
|
|
- this.registerGalleryCapabilitiesContexts(extensionGalleryManifest);
|
|
- this._register(extensionGalleryManifestService.onDidChangeExtensionGalleryManifest(extensionGalleryManifest => this.registerGalleryCapabilitiesContexts(extensionGalleryManifest)));
|
|
- });
|
|
- this.registerGlobalActions();
|
|
- this.registerContextMenuActions();
|
|
- this.registerQuickAccessProvider();
|
|
- }
|
|
-
|
|
- private async registerGalleryCapabilitiesContexts(extensionGalleryManifest: IExtensionGalleryManifest | null): Promise<void> {
|
|
- CONTEXT_GALLERY_SORT_CAPABILITIES.bindTo(this.contextKeyService).set(`_${extensionGalleryManifest?.capabilities.extensionQuery.sorting?.map(s => s.name)?.join('_')}_UpdateDate_`);
|
|
- CONTEXT_GALLERY_FILTER_CAPABILITIES.bindTo(this.contextKeyService).set(`_${extensionGalleryManifest?.capabilities.extensionQuery.filtering?.map(s => s.name)?.join('_')}_`);
|
|
- CONTEXT_GALLERY_ALL_PUBLIC_REPOSITORY_SIGNED.bindTo(this.contextKeyService).set(!!extensionGalleryManifest?.capabilities?.signing?.allPublicRepositorySigned);
|
|
- CONTEXT_GALLERY_ALL_PRIVATE_REPOSITORY_SIGNED.bindTo(this.contextKeyService).set(!!extensionGalleryManifest?.capabilities?.signing?.allPrivateRepositorySigned);
|
|
- CONTEXT_GALLERY_HAS_EXTENSION_LINK.bindTo(this.contextKeyService).set(!!(extensionGalleryManifest && getExtensionGalleryManifestResourceUri(extensionGalleryManifest, ExtensionGalleryResourceType.ExtensionDetailsViewUri)));
|
|
- }
|
|
-
|
|
- private registerQuickAccessProvider(): void {
|
|
- if (this.extensionManagementServerService.localExtensionManagementServer
|
|
- || this.extensionManagementServerService.remoteExtensionManagementServer
|
|
- || this.extensionManagementServerService.webExtensionManagementServer
|
|
- ) {
|
|
- Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
|
|
- ctor: InstallExtensionQuickAccessProvider,
|
|
- prefix: InstallExtensionQuickAccessProvider.PREFIX,
|
|
- placeholder: localize('installExtensionQuickAccessPlaceholder', "Type the name of an extension to install or search."),
|
|
- helpEntries: [{ description: localize('installExtensionQuickAccessHelp', "Install or Search Extensions") }]
|
|
- });
|
|
- }
|
|
- }
|
|
-
|
|
- // Global actions
|
|
- private registerGlobalActions(): void {
|
|
- this._register(MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
|
- command: {
|
|
- id: VIEWLET_ID,
|
|
- title: localize({ key: 'miPreferencesExtensions', comment: ['&& denotes a mnemonic'] }, "&&Extensions")
|
|
- },
|
|
- group: '2_configuration',
|
|
- order: 3
|
|
- }));
|
|
- this._register(MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
- command: {
|
|
- id: VIEWLET_ID,
|
|
- title: localize('showExtensions', "Extensions")
|
|
- },
|
|
- group: '2_configuration',
|
|
- order: 3
|
|
- }));
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.focusExtensionsView',
|
|
- title: localize2('focusExtensions', 'Focus on Extensions View'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- f1: true,
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- await accessor.get(IExtensionsWorkbenchService).openSearch('');
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.installExtensions',
|
|
- title: localize2('installExtensions', 'Install Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- accessor.get(IViewsService).openViewContainer(VIEWLET_ID, true);
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showRecommendedKeymapExtensions',
|
|
- title: localize2('showRecommendedKeymapExtensionsShort', 'Keymaps'),
|
|
- category: PreferencesLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: CONTEXT_HAS_GALLERY
|
|
- }, {
|
|
- id: MenuId.EditorTitle,
|
|
- when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_HAS_GALLERY),
|
|
- group: '2_keyboard_discover_actions'
|
|
- }],
|
|
- menuTitles: {
|
|
- [MenuId.EditorTitle.id]: localize('importKeyboardShortcutsFroms', "Migrate Keyboard Shortcuts from...")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@recommended:keymaps ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showLanguageExtensions',
|
|
- title: localize2('showLanguageExtensionsShort', 'Language Extensions'),
|
|
- category: PreferencesLocalizedLabel,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: CONTEXT_HAS_GALLERY
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@recommended:languages ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.checkForUpdates',
|
|
- title: localize2('checkForUpdates', 'Check for Extension Updates'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER))
|
|
- }, {
|
|
- id: MenuId.ViewContainerTitle,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('viewContainer', VIEWLET_ID), CONTEXT_HAS_GALLERY),
|
|
- group: '1_updates',
|
|
- order: 1
|
|
- }],
|
|
- run: async () => {
|
|
- await this.extensionsWorkbenchService.checkForUpdates();
|
|
- const outdated = this.extensionsWorkbenchService.outdated;
|
|
- if (outdated.length) {
|
|
- return this.extensionsWorkbenchService.openSearch('@outdated ');
|
|
- } else {
|
|
- return this.dialogService.info(localize('noUpdatesAvailable', "All extensions are up to date."));
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- const enableAutoUpdateWhenCondition = ContextKeyExpr.equals(`config.${AutoUpdateConfigurationKey}`, false);
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.enableAutoUpdate',
|
|
- title: localize2('enableAutoUpdate', 'Enable Auto Update for All Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- precondition: enableAutoUpdateWhenCondition,
|
|
- menu: [{
|
|
- id: MenuId.ViewContainerTitle,
|
|
- order: 5,
|
|
- group: '1_updates',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('viewContainer', VIEWLET_ID), enableAutoUpdateWhenCondition)
|
|
- }, {
|
|
- id: MenuId.CommandPalette,
|
|
- }],
|
|
- run: (accessor: ServicesAccessor) => accessor.get(IExtensionsWorkbenchService).updateAutoUpdateForAllExtensions(true)
|
|
- });
|
|
-
|
|
- const disableAutoUpdateWhenCondition = ContextKeyExpr.notEquals(`config.${AutoUpdateConfigurationKey}`, false);
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.disableAutoUpdate',
|
|
- title: localize2('disableAutoUpdate', 'Disable Auto Update for All Extensions'),
|
|
- precondition: disableAutoUpdateWhenCondition,
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.ViewContainerTitle,
|
|
- order: 5,
|
|
- group: '1_updates',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('viewContainer', VIEWLET_ID), disableAutoUpdateWhenCondition)
|
|
- }, {
|
|
- id: MenuId.CommandPalette,
|
|
- }],
|
|
- run: (accessor: ServicesAccessor) => accessor.get(IExtensionsWorkbenchService).updateAutoUpdateForAllExtensions(false)
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.updateAllExtensions',
|
|
- title: localize2('updateAll', 'Update All Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- precondition: HasOutdatedExtensionsContext,
|
|
- menu: [
|
|
- {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER))
|
|
- }, {
|
|
- id: MenuId.ViewContainerTitle,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('viewContainer', VIEWLET_ID), ContextKeyExpr.or(ContextKeyExpr.has(`config.${AutoUpdateConfigurationKey}`).negate(), ContextKeyExpr.equals(`config.${AutoUpdateConfigurationKey}`, 'onlyEnabledExtensions'))),
|
|
- group: '1_updates',
|
|
- order: 2
|
|
- }, {
|
|
- id: MenuId.ViewTitle,
|
|
- when: ContextKeyExpr.equals('view', OUTDATED_EXTENSIONS_VIEW_ID),
|
|
- group: 'navigation',
|
|
- order: 1
|
|
- }
|
|
- ],
|
|
- icon: installWorkspaceRecommendedIcon,
|
|
- run: async () => {
|
|
- await this.extensionsWorkbenchService.updateAll();
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.enableAll',
|
|
- title: localize2('enableAll', 'Enable All Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER)
|
|
- }, {
|
|
- id: MenuId.ViewContainerTitle,
|
|
- when: ContextKeyExpr.equals('viewContainer', VIEWLET_ID),
|
|
- group: '2_enablement',
|
|
- order: 1
|
|
- }],
|
|
- run: async () => {
|
|
- const extensionsToEnable = this.extensionsWorkbenchService.local.filter(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && !this.extensionEnablementService.isEnabled(e.local));
|
|
- if (extensionsToEnable.length) {
|
|
- await this.extensionsWorkbenchService.setEnablement(extensionsToEnable, EnablementState.EnabledGlobally);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.enableAllWorkspace',
|
|
- title: localize2('enableAllWorkspace', 'Enable All Extensions for this Workspace'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('empty'), ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER))
|
|
- },
|
|
- run: async () => {
|
|
- const extensionsToEnable = this.extensionsWorkbenchService.local.filter(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && !this.extensionEnablementService.isEnabled(e.local));
|
|
- if (extensionsToEnable.length) {
|
|
- await this.extensionsWorkbenchService.setEnablement(extensionsToEnable, EnablementState.EnabledWorkspace);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.disableAll',
|
|
- title: localize2('disableAll', 'Disable All Installed Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER)
|
|
- }, {
|
|
- id: MenuId.ViewContainerTitle,
|
|
- when: ContextKeyExpr.equals('viewContainer', VIEWLET_ID),
|
|
- group: '2_enablement',
|
|
- order: 2
|
|
- }],
|
|
- run: async () => {
|
|
- const extensionsToDisable = this.extensionsWorkbenchService.local.filter(e => !e.isBuiltin && !!e.local && this.extensionEnablementService.isEnabled(e.local) && this.extensionEnablementService.canChangeEnablement(e.local));
|
|
- if (extensionsToDisable.length) {
|
|
- await this.extensionsWorkbenchService.setEnablement(extensionsToDisable, EnablementState.DisabledGlobally);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.disableAllWorkspace',
|
|
- title: localize2('disableAllWorkspace', 'Disable All Installed Extensions for this Workspace'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('empty'), ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER))
|
|
- },
|
|
- run: async () => {
|
|
- const extensionsToDisable = this.extensionsWorkbenchService.local.filter(e => !e.isBuiltin && !!e.local && this.extensionEnablementService.isEnabled(e.local) && this.extensionEnablementService.canChangeEnablement(e.local));
|
|
- if (extensionsToDisable.length) {
|
|
- await this.extensionsWorkbenchService.setEnablement(extensionsToDisable, EnablementState.DisabledWorkspace);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID,
|
|
- title: localize2('InstallFromVSIX', 'Install from VSIX...'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER)
|
|
- }, {
|
|
- id: MenuId.ViewContainerTitle,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('viewContainer', VIEWLET_ID), ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER)),
|
|
- group: '3_install',
|
|
- order: 1
|
|
- }],
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- const fileDialogService = accessor.get(IFileDialogService);
|
|
- const commandService = accessor.get(ICommandService);
|
|
- const vsixPaths = await fileDialogService.showOpenDialog({
|
|
- title: localize('installFromVSIX', "Install from VSIX"),
|
|
- filters: [{ name: 'VSIX Extensions', extensions: ['vsix'] }],
|
|
- canSelectFiles: true,
|
|
- canSelectMany: true,
|
|
- openLabel: mnemonicButtonLabel(localize({ key: 'installButton', comment: ['&& denotes a mnemonic'] }, "&&Install"))
|
|
- });
|
|
- if (vsixPaths) {
|
|
- await commandService.executeCommand(INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID, vsixPaths);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID,
|
|
- title: localize('installVSIX', "Install Extension VSIX"),
|
|
- menu: [{
|
|
- id: MenuId.ExplorerContext,
|
|
- group: 'extensions',
|
|
- when: ContextKeyExpr.and(ResourceContextKey.Extension.isEqualTo('.vsix'), ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER)),
|
|
- }],
|
|
- run: async (accessor: ServicesAccessor, resources: URI[] | URI) => {
|
|
- const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const hostService = accessor.get(IHostService);
|
|
- const notificationService = accessor.get(INotificationService);
|
|
-
|
|
- const vsixs = Array.isArray(resources) ? resources : [resources];
|
|
- const result = await Promise.allSettled(vsixs.map(async (vsix) => await extensionsWorkbenchService.install(vsix, { installGivenVersion: true })));
|
|
- let error: Error | undefined, requireReload = false, requireRestart = false;
|
|
- for (const r of result) {
|
|
- if (r.status === 'rejected') {
|
|
- error = new Error(r.reason);
|
|
- break;
|
|
- }
|
|
- requireReload = requireReload || r.value.runtimeState?.action === ExtensionRuntimeActionType.ReloadWindow;
|
|
- requireRestart = requireRestart || r.value.runtimeState?.action === ExtensionRuntimeActionType.RestartExtensions;
|
|
- }
|
|
- if (error) {
|
|
- throw error;
|
|
- }
|
|
- if (requireReload) {
|
|
- notificationService.prompt(
|
|
- Severity.Info,
|
|
- vsixs.length > 1 ? localize('InstallVSIXs.successReload', "Completed installing extensions. Please reload Visual Studio Code to enable them.")
|
|
- : localize('InstallVSIXAction.successReload', "Completed installing extension. Please reload Visual Studio Code to enable it."),
|
|
- [{
|
|
- label: localize('InstallVSIXAction.reloadNow', "Reload Now"),
|
|
- run: () => hostService.reload()
|
|
- }]
|
|
- );
|
|
- }
|
|
- else if (requireRestart) {
|
|
- notificationService.prompt(
|
|
- Severity.Info,
|
|
- vsixs.length > 1 ? localize('InstallVSIXs.successRestart', "Completed installing extensions. Please restart extensions to enable them.")
|
|
- : localize('InstallVSIXAction.successRestart', "Completed installing extension. Please restart extensions to enable it."),
|
|
- [{
|
|
- label: localize('InstallVSIXAction.restartExtensions', "Restart Extensions"),
|
|
- run: () => extensionsWorkbenchService.updateRunningExtensions()
|
|
- }]
|
|
- );
|
|
- }
|
|
- else {
|
|
- notificationService.prompt(
|
|
- Severity.Info,
|
|
- vsixs.length > 1 ? localize('InstallVSIXs.successNoReload', "Completed installing extensions.") : localize('InstallVSIXAction.successNoReload', "Completed installing extension."),
|
|
- []
|
|
- );
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.installExtensionFromLocation',
|
|
- title: localize2('installExtensionFromLocation', 'Install Extension from Location...'),
|
|
- category: Categories.Developer,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_WEB_SERVER, CONTEXT_HAS_LOCAL_SERVER)
|
|
- }],
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- const extensionManagementService = accessor.get(IWorkbenchExtensionManagementService);
|
|
- if (isWeb) {
|
|
- return new Promise<void>((c, e) => {
|
|
- const quickInputService = accessor.get(IQuickInputService);
|
|
- const disposables = new DisposableStore();
|
|
- const quickPick = disposables.add(quickInputService.createQuickPick());
|
|
- quickPick.title = localize('installFromLocation', "Install Extension from Location");
|
|
- quickPick.customButton = true;
|
|
- quickPick.customLabel = localize('install button', "Install");
|
|
- quickPick.placeholder = localize('installFromLocationPlaceHolder', "Location of the web extension");
|
|
- quickPick.ignoreFocusOut = true;
|
|
- disposables.add(Event.any(quickPick.onDidAccept, quickPick.onDidCustom)(async () => {
|
|
- quickPick.hide();
|
|
- if (quickPick.value) {
|
|
- try {
|
|
- await extensionManagementService.installFromLocation(URI.parse(quickPick.value));
|
|
- } catch (error) {
|
|
- e(error);
|
|
- return;
|
|
- }
|
|
- }
|
|
- c();
|
|
- }));
|
|
- disposables.add(quickPick.onDidHide(() => disposables.dispose()));
|
|
- quickPick.show();
|
|
- });
|
|
- } else {
|
|
- const fileDialogService = accessor.get(IFileDialogService);
|
|
- const extensionLocation = await fileDialogService.showOpenDialog({
|
|
- canSelectFolders: true,
|
|
- canSelectFiles: false,
|
|
- canSelectMany: false,
|
|
- title: localize('installFromLocation', "Install Extension from Location"),
|
|
- });
|
|
- if (extensionLocation?.[0]) {
|
|
- await extensionManagementService.installFromLocation(extensionLocation[0]);
|
|
- }
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- MenuRegistry.appendMenuItem(extensionsSearchActionsMenu, {
|
|
- submenu: extensionsFilterSubMenu,
|
|
- title: localize('filterExtensions', "Filter Extensions..."),
|
|
- group: 'navigation',
|
|
- order: 2,
|
|
- icon: filterIcon,
|
|
- });
|
|
-
|
|
- const showFeaturedExtensionsId = 'extensions.filter.featured';
|
|
- const featuresExtensionsWhenContext = ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.regex(CONTEXT_GALLERY_FILTER_CAPABILITIES.key, new RegExp(`_${FilterType.Featured}_`)));
|
|
- this.registerExtensionAction({
|
|
- id: showFeaturedExtensionsId,
|
|
- title: localize2('showFeaturedExtensions', 'Show Featured Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: featuresExtensionsWhenContext
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- when: featuresExtensionsWhenContext,
|
|
- group: '1_predefined',
|
|
- order: 1,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('featured filter', "Featured")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@featured ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showPopularExtensions',
|
|
- title: localize2('showPopularExtensions', 'Show Popular Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: CONTEXT_HAS_GALLERY
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- when: CONTEXT_HAS_GALLERY,
|
|
- group: '1_predefined',
|
|
- order: 2,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('most popular filter', "Most Popular")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@popular ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showRecommendedExtensions',
|
|
- title: localize2('showRecommendedExtensions', 'Show Recommended Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: CONTEXT_HAS_GALLERY
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- when: CONTEXT_HAS_GALLERY,
|
|
- group: '1_predefined',
|
|
- order: 2,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('most popular recommended', "Recommended")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@recommended ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.recentlyPublishedExtensions',
|
|
- title: localize2('recentlyPublishedExtensions', 'Show Recently Published Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: CONTEXT_HAS_GALLERY
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- when: CONTEXT_HAS_GALLERY,
|
|
- group: '1_predefined',
|
|
- order: 2,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('recently published filter', "Recently Published")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@recentlyPublished ')
|
|
- });
|
|
-
|
|
- const extensionsCategoryFilterSubMenu = new MenuId('extensionsCategoryFilterSubMenu');
|
|
- MenuRegistry.appendMenuItem(extensionsFilterSubMenu, {
|
|
- submenu: extensionsCategoryFilterSubMenu,
|
|
- title: localize('filter by category', "Category"),
|
|
- when: ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.regex(CONTEXT_GALLERY_FILTER_CAPABILITIES.key, new RegExp(`_${FilterType.Category}_`))),
|
|
- group: '2_categories',
|
|
- order: 1,
|
|
- });
|
|
-
|
|
- EXTENSION_CATEGORIES.forEach((category, index) => {
|
|
- this.registerExtensionAction({
|
|
- id: `extensions.actions.searchByCategory.${category}`,
|
|
- title: category,
|
|
- menu: [{
|
|
- id: extensionsCategoryFilterSubMenu,
|
|
- when: CONTEXT_HAS_GALLERY,
|
|
- order: index,
|
|
- }],
|
|
- run: () => this.extensionsWorkbenchService.openSearch(`@category:"${category.toLowerCase()}"`)
|
|
- });
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.installedExtensions',
|
|
- title: localize2('installedExtensions', 'Show Installed Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- f1: true,
|
|
- menu: [{
|
|
- id: extensionsFilterSubMenu,
|
|
- group: '3_installed',
|
|
- order: 1,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('installed filter', "Installed")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@installed ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.listBuiltInExtensions',
|
|
- title: localize2('showBuiltInExtensions', 'Show Built-in Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER)
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- group: '3_installed',
|
|
- order: 3,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('builtin filter', "Built-in")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@builtin ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.extensionUpdates',
|
|
- title: localize2('extensionUpdates', 'Show Extension Updates'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- precondition: CONTEXT_HAS_GALLERY,
|
|
- f1: true,
|
|
- menu: [{
|
|
- id: extensionsFilterSubMenu,
|
|
- group: '3_installed',
|
|
- when: CONTEXT_HAS_GALLERY,
|
|
- order: 2,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('extension updates filter', "Updates")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@updates')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID,
|
|
- title: localize2('showWorkspaceUnsupportedExtensions', 'Show Extensions Unsupported By Workspace'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER),
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- group: '3_installed',
|
|
- order: 6,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER),
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('workspace unsupported filter', "Workspace Unsupported")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@workspaceUnsupported')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showEnabledExtensions',
|
|
- title: localize2('showEnabledExtensions', 'Show Enabled Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER)
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- group: '3_installed',
|
|
- order: 4,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('enabled filter', "Enabled")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@enabled ')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showDisabledExtensions',
|
|
- title: localize2('showDisabledExtensions', 'Show Disabled Extensions'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER)
|
|
- }, {
|
|
- id: extensionsFilterSubMenu,
|
|
- group: '3_installed',
|
|
- order: 5,
|
|
- }],
|
|
- menuTitles: {
|
|
- [extensionsFilterSubMenu.id]: localize('disabled filter', "Disabled")
|
|
- },
|
|
- run: () => this.extensionsWorkbenchService.openSearch('@disabled ')
|
|
- });
|
|
-
|
|
- const extensionsSortSubMenu = new MenuId('extensionsSortSubMenu');
|
|
- MenuRegistry.appendMenuItem(extensionsFilterSubMenu, {
|
|
- submenu: extensionsSortSubMenu,
|
|
- title: localize('sorty by', "Sort By"),
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.or(CONTEXT_HAS_GALLERY, DefaultViewsContext)),
|
|
- group: '4_sort',
|
|
- order: 1,
|
|
- });
|
|
-
|
|
- [
|
|
- { id: 'installs', title: localize('sort by installs', "Install Count"), precondition: BuiltInExtensionsContext.negate(), sortCapability: SortBy.InstallCount },
|
|
- { id: 'rating', title: localize('sort by rating', "Rating"), precondition: BuiltInExtensionsContext.negate(), sortCapability: SortBy.WeightedRating },
|
|
- { id: 'name', title: localize('sort by name', "Name"), precondition: BuiltInExtensionsContext.negate(), sortCapability: SortBy.Title },
|
|
- { id: 'publishedDate', title: localize('sort by published date', "Published Date"), precondition: BuiltInExtensionsContext.negate(), sortCapability: SortBy.PublishedDate },
|
|
- { id: 'updateDate', title: localize('sort by update date', "Updated Date"), precondition: ContextKeyExpr.and(SearchMarketplaceExtensionsContext.negate(), RecommendedExtensionsContext.negate(), BuiltInExtensionsContext.negate()), sortCapability: 'UpdateDate' },
|
|
- ].map(({ id, title, precondition, sortCapability }, index) => {
|
|
- const sortCapabilityContext = ContextKeyExpr.regex(CONTEXT_GALLERY_SORT_CAPABILITIES.key, new RegExp(`_${sortCapability}_`));
|
|
- this.registerExtensionAction({
|
|
- id: `extensions.sort.${id}`,
|
|
- title,
|
|
- precondition: ContextKeyExpr.and(precondition, ContextKeyExpr.regex(ExtensionsSearchValueContext.key, /^@feature:/).negate(), sortCapabilityContext),
|
|
- menu: [{
|
|
- id: extensionsSortSubMenu,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.or(CONTEXT_HAS_GALLERY, DefaultViewsContext), sortCapabilityContext),
|
|
- order: index,
|
|
- }],
|
|
- toggled: ExtensionsSortByContext.isEqualTo(id),
|
|
- run: async () => {
|
|
- const extensionsViewPaneContainer = ((await this.viewsService.openViewContainer(VIEWLET_ID, true))?.getViewPaneContainer()) as IExtensionsViewPaneContainer | undefined;
|
|
- const currentQuery = Query.parse(extensionsViewPaneContainer?.searchValue ?? '');
|
|
- extensionsViewPaneContainer?.search(new Query(currentQuery.value, id).toString());
|
|
- extensionsViewPaneContainer?.focus();
|
|
- }
|
|
- });
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.clearExtensionsSearchResults',
|
|
- title: localize2('clearExtensionsSearchResults', 'Clear Extensions Search Results'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- icon: clearSearchResultsIcon,
|
|
- f1: true,
|
|
- precondition: SearchHasTextContext,
|
|
- menu: {
|
|
- id: extensionsSearchActionsMenu,
|
|
- group: 'navigation',
|
|
- order: 1,
|
|
- },
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- const viewPaneContainer = accessor.get(IViewsService).getActiveViewPaneContainerWithId(VIEWLET_ID);
|
|
- if (viewPaneContainer) {
|
|
- const extensionsViewPaneContainer = viewPaneContainer as IExtensionsViewPaneContainer;
|
|
- extensionsViewPaneContainer.search('');
|
|
- extensionsViewPaneContainer.focus();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.refreshExtension',
|
|
- title: localize2('refreshExtension', 'Refresh'),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- icon: refreshIcon,
|
|
- f1: true,
|
|
- menu: {
|
|
- id: MenuId.ViewContainerTitle,
|
|
- when: ContextKeyExpr.equals('viewContainer', VIEWLET_ID),
|
|
- group: 'navigation',
|
|
- order: 2
|
|
- },
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- const viewPaneContainer = accessor.get(IViewsService).getActiveViewPaneContainerWithId(VIEWLET_ID);
|
|
- if (viewPaneContainer) {
|
|
- await (viewPaneContainer as IExtensionsViewPaneContainer).refresh();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.installWorkspaceRecommendedExtensions',
|
|
- title: localize('installWorkspaceRecommendedExtensions', "Install Workspace Recommended Extensions"),
|
|
- icon: installWorkspaceRecommendedIcon,
|
|
- menu: {
|
|
- id: MenuId.ViewTitle,
|
|
- when: ContextKeyExpr.equals('view', WORKSPACE_RECOMMENDATIONS_VIEW_ID),
|
|
- group: 'navigation',
|
|
- order: 1
|
|
- },
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- const view = accessor.get(IViewsService).getActiveViewWithId(WORKSPACE_RECOMMENDATIONS_VIEW_ID) as IWorkspaceRecommendedExtensionsView;
|
|
- return view.installWorkspaceRecommendations();
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: ConfigureWorkspaceFolderRecommendedExtensionsAction.ID,
|
|
- title: ConfigureWorkspaceFolderRecommendedExtensionsAction.LABEL,
|
|
- icon: configureRecommendedIcon,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- when: WorkbenchStateContext.notEqualsTo('empty'),
|
|
- }, {
|
|
- id: MenuId.ViewTitle,
|
|
- when: ContextKeyExpr.equals('view', WORKSPACE_RECOMMENDATIONS_VIEW_ID),
|
|
- group: 'navigation',
|
|
- order: 2
|
|
- }],
|
|
- run: () => runAction(this.instantiationService.createInstance(ConfigureWorkspaceFolderRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction.ID, ConfigureWorkspaceFolderRecommendedExtensionsAction.LABEL))
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: InstallSpecificVersionOfExtensionAction.ID,
|
|
- title: { value: InstallSpecificVersionOfExtensionAction.LABEL, original: 'Install Specific Version of Extension...' },
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.or(CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER))
|
|
- },
|
|
- run: () => runAction(this.instantiationService.createInstance(InstallSpecificVersionOfExtensionAction, InstallSpecificVersionOfExtensionAction.ID, InstallSpecificVersionOfExtensionAction.LABEL))
|
|
- });
|
|
- }
|
|
-
|
|
- // Extension Context Menu
|
|
- private registerContextMenuActions(): void {
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: SetColorThemeAction.ID,
|
|
- title: SetColorThemeAction.TITLE,
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: THEME_ACTIONS_GROUP,
|
|
- order: 0,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.not('inExtensionEditor'), ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('extensionHasColorThemes'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extension = extensionWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id: extensionId }));
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(SetColorThemeAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: SetFileIconThemeAction.ID,
|
|
- title: SetFileIconThemeAction.TITLE,
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: THEME_ACTIONS_GROUP,
|
|
- order: 0,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.not('inExtensionEditor'), ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('extensionHasFileIconThemes'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extension = extensionWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id: extensionId }));
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(SetFileIconThemeAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: SetProductIconThemeAction.ID,
|
|
- title: SetProductIconThemeAction.TITLE,
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: THEME_ACTIONS_GROUP,
|
|
- order: 0,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.not('inExtensionEditor'), ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('extensionHasProductIconThemes'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extension = extensionWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id: extensionId }));
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(SetProductIconThemeAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showPreReleaseVersion',
|
|
- title: localize2('show pre-release version', 'Show Pre-Release Version'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: INSTALL_ACTIONS_GROUP,
|
|
- order: 0,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.has('inExtensionEditor'), ContextKeyExpr.has('galleryExtensionHasPreReleaseVersion'), ContextKeyExpr.has('isPreReleaseExtensionAllowed'), ContextKeyExpr.not('showPreReleaseVersion'), ContextKeyExpr.not('isBuiltinExtension'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = (await extensionWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- extensionWorkbenchService.open(extension, { showPreReleaseVersion: true });
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.showReleasedVersion',
|
|
- title: localize2('show released version', 'Show Release Version'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: INSTALL_ACTIONS_GROUP,
|
|
- order: 1,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.has('inExtensionEditor'), ContextKeyExpr.has('galleryExtensionHasPreReleaseVersion'), ContextKeyExpr.has('extensionHasReleaseVersion'), ContextKeyExpr.has('showPreReleaseVersion'), ContextKeyExpr.not('isBuiltinExtension'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = (await extensionWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- extensionWorkbenchService.open(extension, { showPreReleaseVersion: false });
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: ToggleAutoUpdateForExtensionAction.ID,
|
|
- title: ToggleAutoUpdateForExtensionAction.LABEL,
|
|
- category: ExtensionsLocalizedLabel,
|
|
- precondition: ContextKeyExpr.and(ContextKeyExpr.or(ContextKeyExpr.notEquals(`config.${AutoUpdateConfigurationKey}`, 'onlyEnabledExtensions'), ContextKeyExpr.equals('isExtensionEnabled', true)), ContextKeyExpr.not('extensionDisallowInstall'), ContextKeyExpr.has('isExtensionAllowed')),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: UPDATE_ACTIONS_GROUP,
|
|
- order: 1,
|
|
- when: ContextKeyExpr.and(
|
|
- ContextKeyExpr.not('inExtensionEditor'),
|
|
- ContextKeyExpr.equals('extensionStatus', 'installed'),
|
|
- ContextKeyExpr.not('isBuiltinExtension'),
|
|
- )
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = extensionWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id }));
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(ToggleAutoUpdateForExtensionAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: ToggleAutoUpdatesForPublisherAction.ID,
|
|
- title: { value: ToggleAutoUpdatesForPublisherAction.LABEL, original: 'Auto Update (Publisher)' },
|
|
- category: ExtensionsLocalizedLabel,
|
|
- precondition: ContextKeyExpr.equals(`config.${AutoUpdateConfigurationKey}`, false),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: UPDATE_ACTIONS_GROUP,
|
|
- order: 2,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.not('isBuiltinExtension'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = extensionWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id }));
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(ToggleAutoUpdatesForPublisherAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.switchToPreRlease',
|
|
- title: localize('enablePreRleaseLabel', "Switch to Pre-Release Version"),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: INSTALL_ACTIONS_GROUP,
|
|
- order: 2,
|
|
- when: ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.has('galleryExtensionHasPreReleaseVersion'), ContextKeyExpr.has('isPreReleaseExtensionAllowed'), ContextKeyExpr.not('installedExtensionIsOptedToPreRelease'), ContextKeyExpr.not('inExtensionEditor'), ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.not('isBuiltinExtension'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = extensionWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id }));
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(TogglePreReleaseExtensionAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.switchToRelease',
|
|
- title: localize('disablePreRleaseLabel', "Switch to Release Version"),
|
|
- category: ExtensionsLocalizedLabel,
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: INSTALL_ACTIONS_GROUP,
|
|
- order: 2,
|
|
- when: ContextKeyExpr.and(CONTEXT_HAS_GALLERY, ContextKeyExpr.has('galleryExtensionHasPreReleaseVersion'), ContextKeyExpr.has('isExtensionAllowed'), ContextKeyExpr.has('installedExtensionIsOptedToPreRelease'), ContextKeyExpr.not('inExtensionEditor'), ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.not('isBuiltinExtension'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = extensionWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id }));
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(TogglePreReleaseExtensionAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: ClearLanguageAction.ID,
|
|
- title: ClearLanguageAction.TITLE,
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: INSTALL_ACTIONS_GROUP,
|
|
- order: 0,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.not('inExtensionEditor'), ContextKeyExpr.has('canSetLanguage'), ContextKeyExpr.has('isActiveLanguagePackExtension'))
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
- const extension = (await extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- const action = instantiationService.createInstance(ClearLanguageAction);
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.installUnsigned',
|
|
- title: localize('install', "Install"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '0_install',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'uninstalled'), ContextKeyExpr.has('isGalleryExtension'), ContextKeyExpr.not('extensionDisallowInstall'), ContextKeyExpr.has('extensionIsUnsigned'),
|
|
- ContextKeyExpr.or(ContextKeyExpr.and(CONTEXT_GALLERY_ALL_PUBLIC_REPOSITORY_SIGNED, ContextKeyExpr.not('extensionIsPrivate')), ContextKeyExpr.and(CONTEXT_GALLERY_ALL_PRIVATE_REPOSITORY_SIGNED, ContextKeyExpr.has('extensionIsPrivate')))),
|
|
- order: 1
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
|
|
- || (await this.extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(InstallAction, { installPreReleaseVersion: this.extensionManagementService.preferPreReleases });
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.installAndDonotSync',
|
|
- title: localize('install installAndDonotSync', "Install (Do not Sync)"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '0_install',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'uninstalled'), ContextKeyExpr.has('isGalleryExtension'), ContextKeyExpr.has('isExtensionAllowed'), ContextKeyExpr.not('extensionDisallowInstall'), CONTEXT_SYNC_ENABLEMENT),
|
|
- order: 1
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
|
|
- || (await this.extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(InstallAction, {
|
|
- installPreReleaseVersion: this.extensionManagementService.preferPreReleases,
|
|
- isMachineScoped: true,
|
|
- });
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.installPrereleaseAndDonotSync',
|
|
- title: localize('installPrereleaseAndDonotSync', "Install Pre-Release (Do not Sync)"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '0_install',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'uninstalled'), ContextKeyExpr.has('isGalleryExtension'), ContextKeyExpr.has('extensionHasPreReleaseVersion'), ContextKeyExpr.has('isPreReleaseExtensionAllowed'), ContextKeyExpr.not('extensionDisallowInstall'), CONTEXT_SYNC_ENABLEMENT),
|
|
- order: 2
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
|
|
- || (await this.extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- if (extension) {
|
|
- const action = instantiationService.createInstance(InstallAction, {
|
|
- isMachineScoped: true,
|
|
- preRelease: true
|
|
- });
|
|
- action.extension = extension;
|
|
- return action.run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: InstallAnotherVersionAction.ID,
|
|
- title: InstallAnotherVersionAction.LABEL,
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '0_install',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'uninstalled'), ContextKeyExpr.has('isGalleryExtension'), ContextKeyExpr.has('isExtensionAllowed'), ContextKeyExpr.not('extensionDisallowInstall')),
|
|
- order: 3
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const extension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
|
|
- || (await this.extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- if (extension) {
|
|
- return instantiationService.createInstance(InstallAnotherVersionAction, extension, false).run();
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.copyExtension',
|
|
- title: localize2('workbench.extensions.action.copyExtension', 'Copy'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '1_copy'
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- const clipboardService = accessor.get(IClipboardService);
|
|
- const extension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
|
|
- || (await this.extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
- if (extension) {
|
|
- const name = localize('extensionInfoName', 'Name: {0}', extension.displayName);
|
|
- const id = localize('extensionInfoId', 'Id: {0}', extensionId);
|
|
- const description = localize('extensionInfoDescription', 'Description: {0}', extension.description);
|
|
- const verision = localize('extensionInfoVersion', 'Version: {0}', extension.version);
|
|
- const publisher = localize('extensionInfoPublisher', 'Publisher: {0}', extension.publisherDisplayName);
|
|
- const link = extension.url ? localize('extensionInfoVSMarketplaceLink', 'VS Marketplace Link: {0}', `${extension.url}`) : null;
|
|
- const clipboardStr = `${name}\n${id}\n${description}\n${verision}\n${publisher}${link ? '\n' + link : ''}`;
|
|
- await clipboardService.writeText(clipboardStr);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.copyExtensionId',
|
|
- title: localize2('workbench.extensions.action.copyExtensionId', 'Copy Extension ID'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '1_copy'
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => accessor.get(IClipboardService).writeText(id)
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.copyLink',
|
|
- title: localize2('workbench.extensions.action.copyLink', 'Copy Link'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '1_copy',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.has('isGalleryExtension'), CONTEXT_GALLERY_HAS_EXTENSION_LINK),
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, _, extension: IExtensionArg) => {
|
|
- const clipboardService = accessor.get(IClipboardService);
|
|
- if (extension.galleryLink) {
|
|
- await clipboardService.writeText(extension.galleryLink);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.configure',
|
|
- title: localize2('workbench.extensions.action.configure', 'Settings'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '2_configure',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('extensionHasConfiguration')),
|
|
- order: 1
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => accessor.get(IPreferencesService).openSettings({ jsonEditor: false, query: `@ext:${id}` })
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.download',
|
|
- title: localize('download VSIX', "Download VSIX"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.not('extensionDisallowInstall'), ContextKeyExpr.has('isGalleryExtension')),
|
|
- order: this.productService.quality === 'stable' ? 0 : 1
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- accessor.get(IExtensionsWorkbenchService).downloadVSIX(extensionId, 'release');
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.downloadPreRelease',
|
|
- title: localize('download pre-release', "Download Pre-Release VSIX"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.not('extensionDisallowInstall'), ContextKeyExpr.has('isGalleryExtension'), ContextKeyExpr.has('extensionHasPreReleaseVersion')),
|
|
- order: this.productService.quality === 'stable' ? 1 : 0
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- accessor.get(IExtensionsWorkbenchService).downloadVSIX(extensionId, 'prerelease');
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.downloadSpecificVersion',
|
|
- title: localize('download specific version', "Download Specific Version VSIX..."),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.not('extensionDisallowInstall'), ContextKeyExpr.has('isGalleryExtension')),
|
|
- order: 2
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, extensionId: string) => {
|
|
- accessor.get(IExtensionsWorkbenchService).downloadVSIX(extensionId, 'any');
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.manageAccountPreferences',
|
|
- title: localize2('workbench.extensions.action.changeAccountPreference', "Account Preferences"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '2_configure',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('extensionHasAccountPreferences')),
|
|
- order: 2,
|
|
- },
|
|
- run: (accessor: ServicesAccessor, id: string) => accessor.get(ICommandService).executeCommand('_manageAccountPreferencesForExtension', id)
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.configureKeybindings',
|
|
- title: localize2('workbench.extensions.action.configureKeybindings', 'Keyboard Shortcuts'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '2_configure',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('extensionHasKeybindings')),
|
|
- order: 2
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => accessor.get(IPreferencesService).openGlobalKeybindingSettings(false, { query: `@ext:${id}` })
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.toggleApplyToAllProfiles',
|
|
- title: localize2('workbench.extensions.action.toggleApplyToAllProfiles', "Apply Extension to all Profiles"),
|
|
- toggled: ContextKeyExpr.has('isApplicationScopedExtension'),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '2_configure',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('isDefaultApplicationScopedExtension').negate(), ContextKeyExpr.has('isBuiltinExtension').negate(), ContextKeyExpr.equals('isWorkspaceScopedExtension', false)),
|
|
- order: 3
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, _: string, extensionArg: IExtensionArg) => {
|
|
- const uriIdentityService = accessor.get(IUriIdentityService);
|
|
- const extension = extensionArg.location ? this.extensionsWorkbenchService.installed.find(e => uriIdentityService.extUri.isEqual(e.local?.location, extensionArg.location)) : undefined;
|
|
- if (extension) {
|
|
- return this.extensionsWorkbenchService.toggleApplyExtensionToAllProfiles(extension);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: TOGGLE_IGNORE_EXTENSION_ACTION_ID,
|
|
- title: localize2('workbench.extensions.action.toggleIgnoreExtension', "Sync This Extension"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '2_configure',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'installed'), CONTEXT_SYNC_ENABLEMENT, ContextKeyExpr.equals('isWorkspaceScopedExtension', false)),
|
|
- order: 4
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => {
|
|
- const extension = this.extensionsWorkbenchService.local.find(e => areSameExtensions({ id }, e.identifier));
|
|
- if (extension) {
|
|
- return this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(extension);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.ignoreRecommendation',
|
|
- title: localize2('workbench.extensions.action.ignoreRecommendation', "Ignore Recommendation"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '3_recommendations',
|
|
- when: ContextKeyExpr.has('isExtensionRecommended'),
|
|
- order: 1
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => accessor.get(IExtensionIgnoredRecommendationsService).toggleGlobalIgnoredRecommendation(id, true)
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.undoIgnoredRecommendation',
|
|
- title: localize2('workbench.extensions.action.undoIgnoredRecommendation', "Undo Ignored Recommendation"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '3_recommendations',
|
|
- when: ContextKeyExpr.has('isUserIgnoredRecommendation'),
|
|
- order: 1
|
|
- },
|
|
- run: async (accessor: ServicesAccessor, id: string) => accessor.get(IExtensionIgnoredRecommendationsService).toggleGlobalIgnoredRecommendation(id, false)
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.addExtensionToWorkspaceRecommendations',
|
|
- title: localize2('workbench.extensions.action.addExtensionToWorkspaceRecommendations', "Add to Workspace Recommendations"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '3_recommendations',
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('empty'), ContextKeyExpr.has('isBuiltinExtension').negate(), ContextKeyExpr.has('isExtensionWorkspaceRecommended').negate(), ContextKeyExpr.has('isUserIgnoredRecommendation').negate(), ContextKeyExpr.notEquals('extensionSource', 'resource')),
|
|
- order: 2
|
|
- },
|
|
- run: (accessor: ServicesAccessor, id: string) => accessor.get(IWorkspaceExtensionsConfigService).toggleRecommendation(id)
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.removeExtensionFromWorkspaceRecommendations',
|
|
- title: localize2('workbench.extensions.action.removeExtensionFromWorkspaceRecommendations', "Remove from Workspace Recommendations"),
|
|
- menu: {
|
|
- id: MenuId.ExtensionContext,
|
|
- group: '3_recommendations',
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('empty'), ContextKeyExpr.has('isBuiltinExtension').negate(), ContextKeyExpr.has('isExtensionWorkspaceRecommended')),
|
|
- order: 2
|
|
- },
|
|
- run: (accessor: ServicesAccessor, id: string) => accessor.get(IWorkspaceExtensionsConfigService).toggleRecommendation(id)
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.addToWorkspaceRecommendations',
|
|
- title: localize2('workbench.extensions.action.addToWorkspaceRecommendations', "Add Extension to Workspace Recommendations"),
|
|
- category: EXTENSIONS_CATEGORY,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.isEqualTo('workspace'), ContextKeyExpr.equals('resourceScheme', Schemas.extension)),
|
|
- },
|
|
- async run(accessor: ServicesAccessor): Promise<any> {
|
|
- const editorService = accessor.get(IEditorService);
|
|
- const workspaceExtensionsConfigService = accessor.get(IWorkspaceExtensionsConfigService);
|
|
- if (!(editorService.activeEditor instanceof ExtensionsInput)) {
|
|
- return;
|
|
- }
|
|
- const extensionId = editorService.activeEditor.extension.identifier.id.toLowerCase();
|
|
- const recommendations = await workspaceExtensionsConfigService.getRecommendations();
|
|
- if (recommendations.includes(extensionId)) {
|
|
- return;
|
|
- }
|
|
- await workspaceExtensionsConfigService.toggleRecommendation(extensionId);
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.addToWorkspaceFolderRecommendations',
|
|
- title: localize2('workbench.extensions.action.addToWorkspaceFolderRecommendations', "Add Extension to Workspace Folder Recommendations"),
|
|
- category: EXTENSIONS_CATEGORY,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.isEqualTo('folder'), ContextKeyExpr.equals('resourceScheme', Schemas.extension)),
|
|
- },
|
|
- run: () => this.commandService.executeCommand('workbench.extensions.action.addToWorkspaceRecommendations')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.addToWorkspaceIgnoredRecommendations',
|
|
- title: localize2('workbench.extensions.action.addToWorkspaceIgnoredRecommendations', "Add Extension to Workspace Ignored Recommendations"),
|
|
- category: EXTENSIONS_CATEGORY,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.isEqualTo('workspace'), ContextKeyExpr.equals('resourceScheme', Schemas.extension)),
|
|
- },
|
|
- async run(accessor: ServicesAccessor): Promise<any> {
|
|
- const editorService = accessor.get(IEditorService);
|
|
- const workspaceExtensionsConfigService = accessor.get(IWorkspaceExtensionsConfigService);
|
|
- if (!(editorService.activeEditor instanceof ExtensionsInput)) {
|
|
- return;
|
|
- }
|
|
- const extensionId = editorService.activeEditor.extension.identifier.id.toLowerCase();
|
|
- const unwantedRecommendations = await workspaceExtensionsConfigService.getUnwantedRecommendations();
|
|
- if (unwantedRecommendations.includes(extensionId)) {
|
|
- return;
|
|
- }
|
|
- await workspaceExtensionsConfigService.toggleUnwantedRecommendation(extensionId);
|
|
- }
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.addToWorkspaceFolderIgnoredRecommendations',
|
|
- title: localize2('workbench.extensions.action.addToWorkspaceFolderIgnoredRecommendations', "Add Extension to Workspace Folder Ignored Recommendations"),
|
|
- category: EXTENSIONS_CATEGORY,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: ContextKeyExpr.and(WorkbenchStateContext.isEqualTo('folder'), ContextKeyExpr.equals('resourceScheme', Schemas.extension)),
|
|
- },
|
|
- run: () => this.commandService.executeCommand('workbench.extensions.action.addToWorkspaceIgnoredRecommendations')
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: ConfigureWorkspaceRecommendedExtensionsAction.ID,
|
|
- title: { value: ConfigureWorkspaceRecommendedExtensionsAction.LABEL, original: 'Configure Recommended Extensions (Workspace)' },
|
|
- category: EXTENSIONS_CATEGORY,
|
|
- menu: {
|
|
- id: MenuId.CommandPalette,
|
|
- when: WorkbenchStateContext.isEqualTo('workspace'),
|
|
- },
|
|
- run: () => runAction(this.instantiationService.createInstance(ConfigureWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceRecommendedExtensionsAction.ID, ConfigureWorkspaceRecommendedExtensionsAction.LABEL))
|
|
- });
|
|
-
|
|
- this.registerExtensionAction({
|
|
- id: 'workbench.extensions.action.manageTrustedPublishers',
|
|
- title: localize2('workbench.extensions.action.manageTrustedPublishers', "Manage Trusted Extension Publishers"),
|
|
- category: EXTENSIONS_CATEGORY,
|
|
- f1: true,
|
|
- run: async (accessor: ServicesAccessor) => {
|
|
- const quickInputService = accessor.get(IQuickInputService);
|
|
- const extensionManagementService = accessor.get(IWorkbenchExtensionManagementService);
|
|
- const trustedPublishers = extensionManagementService.getTrustedPublishers();
|
|
- const trustedPublisherItems = trustedPublishers.map(publisher => ({
|
|
- id: publisher.publisher,
|
|
- label: publisher.publisherDisplayName,
|
|
- description: publisher.publisher,
|
|
- picked: true,
|
|
- })).sort((a, b) => a.label.localeCompare(b.label));
|
|
- const result = await quickInputService.pick(trustedPublisherItems, {
|
|
- canPickMany: true,
|
|
- title: localize('trustedPublishers', "Manage Trusted Extension Publishers"),
|
|
- placeHolder: localize('trustedPublishersPlaceholder', "Choose which publishers to trust"),
|
|
- });
|
|
- if (result) {
|
|
- const untrustedPublishers = [];
|
|
- for (const { publisher } of trustedPublishers) {
|
|
- if (!result.some(r => r.id === publisher)) {
|
|
- untrustedPublishers.push(publisher);
|
|
- }
|
|
- }
|
|
- trustedPublishers.filter(publisher => !result.some(r => r.id === publisher.publisher));
|
|
- extensionManagementService.untrustPublishers(...untrustedPublishers);
|
|
- }
|
|
- }
|
|
- });
|
|
-
|
|
- }
|
|
-
|
|
- private registerExtensionAction(extensionActionOptions: IExtensionActionOptions): IDisposable {
|
|
- const menus = extensionActionOptions.menu ? Array.isArray(extensionActionOptions.menu) ? extensionActionOptions.menu : [extensionActionOptions.menu] : [];
|
|
- let menusWithOutTitles: ({ id: MenuId } & Omit<IMenuItem, 'command'>)[] = [];
|
|
- const menusWithTitles: { id: MenuId; item: IMenuItem }[] = [];
|
|
- if (extensionActionOptions.menuTitles) {
|
|
- for (let index = 0; index < menus.length; index++) {
|
|
- const menu = menus[index];
|
|
- const menuTitle = extensionActionOptions.menuTitles[menu.id.id];
|
|
- if (menuTitle) {
|
|
- menusWithTitles.push({ id: menu.id, item: { ...menu, command: { id: extensionActionOptions.id, title: menuTitle } } });
|
|
- } else {
|
|
- menusWithOutTitles.push(menu);
|
|
- }
|
|
- }
|
|
- } else {
|
|
- menusWithOutTitles = menus;
|
|
- }
|
|
- const disposables = new DisposableStore();
|
|
- disposables.add(registerAction2(class extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- ...extensionActionOptions,
|
|
- menu: menusWithOutTitles
|
|
- });
|
|
- }
|
|
- run(accessor: ServicesAccessor, ...args: any[]): Promise<any> {
|
|
- return extensionActionOptions.run(accessor, ...args);
|
|
- }
|
|
- }));
|
|
- if (menusWithTitles.length) {
|
|
- disposables.add(MenuRegistry.appendMenuItems(menusWithTitles));
|
|
- }
|
|
- return disposables;
|
|
- }
|
|
-
|
|
-}
|
|
-
|
|
-class ExtensionStorageCleaner implements IWorkbenchContribution {
|
|
-
|
|
- constructor(
|
|
- @IExtensionManagementService extensionManagementService: IExtensionManagementService,
|
|
- @IStorageService storageService: IStorageService,
|
|
- ) {
|
|
- ExtensionStorageService.removeOutdatedExtensionVersions(extensionManagementService, storageService);
|
|
- }
|
|
-}
|
|
-
|
|
-class TrustedPublishersInitializer implements IWorkbenchContribution {
|
|
- constructor(
|
|
- @IWorkbenchExtensionManagementService extensionManagementService: IWorkbenchExtensionManagementService,
|
|
- @IUserDataProfilesService userDataProfilesService: IUserDataProfilesService,
|
|
- @IProductService productService: IProductService,
|
|
- @IStorageService storageService: IStorageService,
|
|
- ) {
|
|
- const trustedPublishersInitStatusKey = 'trusted-publishers-init-migration';
|
|
- if (!storageService.get(trustedPublishersInitStatusKey, StorageScope.APPLICATION)) {
|
|
- for (const profile of userDataProfilesService.profiles) {
|
|
- extensionManagementService.getInstalled(ExtensionType.User, profile.extensionsResource)
|
|
- .then(async extensions => {
|
|
- const trustedPublishers = new Map<string, IPublisherInfo>();
|
|
- for (const extension of extensions) {
|
|
- if (!extension.publisherDisplayName) {
|
|
- continue;
|
|
- }
|
|
- const publisher = extension.manifest.publisher.toLowerCase();
|
|
- if (productService.trustedExtensionPublishers?.includes(publisher)
|
|
- || (extension.publisherDisplayName && productService.trustedExtensionPublishers?.includes(extension.publisherDisplayName.toLowerCase()))) {
|
|
- continue;
|
|
- }
|
|
- trustedPublishers.set(publisher, { publisher, publisherDisplayName: extension.publisherDisplayName });
|
|
- }
|
|
- if (trustedPublishers.size) {
|
|
- extensionManagementService.trustPublishers(...trustedPublishers.values());
|
|
- }
|
|
- storageService.store(trustedPublishersInitStatusKey, 'true', StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
- });
|
|
- }
|
|
- }
|
|
- }
|
|
-}
|
|
-
|
|
-class ExtensionToolsContribution extends Disposable implements IWorkbenchContribution {
|
|
-
|
|
- static readonly ID = 'extensions.chat.toolsContribution';
|
|
-
|
|
- constructor(
|
|
- @ILanguageModelToolsService toolsService: ILanguageModelToolsService,
|
|
- @IInstantiationService instantiationService: IInstantiationService,
|
|
- ) {
|
|
- super();
|
|
- const searchExtensionsTool = instantiationService.createInstance(SearchExtensionsTool);
|
|
- this._register(toolsService.registerToolData(SearchExtensionsToolData));
|
|
- this._register(toolsService.registerToolImplementation(SearchExtensionsToolData.id, searchExtensionsTool));
|
|
- }
|
|
-}
|
|
-
|
|
-const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
|
-workbenchRegistry.registerWorkbenchContribution(ExtensionsContributions, LifecyclePhase.Restored);
|
|
-workbenchRegistry.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Eventually);
|
|
-workbenchRegistry.registerWorkbenchContribution(MaliciousExtensionChecker, LifecyclePhase.Eventually);
|
|
-workbenchRegistry.registerWorkbenchContribution(KeymapExtensions, LifecyclePhase.Restored);
|
|
-workbenchRegistry.registerWorkbenchContribution(ExtensionsViewletViewsContribution, LifecyclePhase.Restored);
|
|
-workbenchRegistry.registerWorkbenchContribution(ExtensionActivationProgress, LifecyclePhase.Eventually);
|
|
-workbenchRegistry.registerWorkbenchContribution(ExtensionDependencyChecker, LifecyclePhase.Eventually);
|
|
-workbenchRegistry.registerWorkbenchContribution(ExtensionEnablementWorkspaceTrustTransitionParticipant, LifecyclePhase.Restored);
|
|
-workbenchRegistry.registerWorkbenchContribution(ExtensionsCompletionItemsProvider, LifecyclePhase.Restored);
|
|
-workbenchRegistry.registerWorkbenchContribution(UnsupportedExtensionsMigrationContrib, LifecyclePhase.Eventually);
|
|
-workbenchRegistry.registerWorkbenchContribution(TrustedPublishersInitializer, LifecyclePhase.Eventually);
|
|
-if (isWeb) {
|
|
- workbenchRegistry.registerWorkbenchContribution(ExtensionStorageCleaner, LifecyclePhase.Eventually);
|
|
-}
|
|
-
|
|
-registerWorkbenchContribution2(ExtensionToolsContribution.ID, ExtensionToolsContribution, WorkbenchPhase.AfterRestored);
|
|
-
|
|
-
|
|
-// Running Extensions
|
|
-registerAction2(ShowRuntimeExtensionsAction);
|
|
-
|
|
-Registry.as<IConfigurationMigrationRegistry>(ConfigurationMigrationExtensions.ConfigurationMigration)
|
|
- .registerConfigurationMigrations([{
|
|
- key: AutoUpdateConfigurationKey,
|
|
- migrateFn: (value, accessor) => {
|
|
- if (value === 'onlySelectedExtensions') {
|
|
- return { value: false };
|
|
- }
|
|
- return [];
|
|
- }
|
|
- }]);
|
|
+registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService, InstantiationType.Delayed);
|
|
diff --git a/src/vs/workbench/contrib/mcp/browser/mcpCommands.ts b/src/vs/workbench/contrib/mcp/browser/mcpCommands.ts
|
|
index 27b1e707779..d8f1ee0792e 100644
|
|
--- a/src/vs/workbench/contrib/mcp/browser/mcpCommands.ts
|
|
+++ b/src/vs/workbench/contrib/mcp/browser/mcpCommands.ts
|
|
@@ -55,7 +55,6 @@ import { VSBuffer } from '../../../../base/common/buffer.js';
|
|
import { IProductService } from '../../../../platform/product/common/productService.js';
|
|
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
|
|
import { CHAT_CONFIG_MENU_ID } from '../../chat/browser/actions/chatActions.js';
|
|
-import { VIEW_CONTAINER } from '../../extensions/browser/extensions.contribution.js';
|
|
|
|
// acroynms do not get localized
|
|
const category: ILocalizedString = {
|
|
@@ -738,7 +737,6 @@ export class ShowInstalledMcpServersCommand extends Action2 {
|
|
const viewsService = accessor.get(IViewsService);
|
|
const view = await viewsService.openView(InstalledMcpServersViewId, true);
|
|
if (!view) {
|
|
- await viewsService.openViewContainer(VIEW_CONTAINER.id);
|
|
await viewsService.openView(InstalledMcpServersViewId, true);
|
|
}
|
|
}
|
|
diff --git a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
|
|
index f54a3bd4327..d73f849d00d 100644
|
|
--- a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
|
|
+++ b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
|
|
@@ -10,9 +10,9 @@ import { IListContextMenuEvent, IListRenderer } from '../../../../base/browser/u
|
|
import { Emitter, Event } from '../../../../base/common/event.js';
|
|
import { combinedDisposable, Disposable, DisposableStore, dispose, IDisposable, isDisposable } from '../../../../base/common/lifecycle.js';
|
|
import { DelayedPagedModel, IPagedModel, PagedModel } from '../../../../base/common/paging.js';
|
|
-import { localize, localize2 } from '../../../../nls.js';
|
|
+import { localize } from '../../../../nls.js';
|
|
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
|
-import { ContextKeyExpr, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
+import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
|
|
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
|
|
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
@@ -23,8 +23,8 @@ import { IOpenerService } from '../../../../platform/opener/common/opener.js';
|
|
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
|
|
import { getLocationBasedViewColors, ViewPane } from '../../../browser/parts/views/viewPane.js';
|
|
import { IViewletViewOptions } from '../../../browser/parts/views/viewsViewlet.js';
|
|
-import { IViewDescriptorService, IViewsRegistry, Extensions as ViewExtensions } from '../../../common/views.js';
|
|
-import { HasInstalledMcpServersContext, IMcpWorkbenchService, InstalledMcpServersViewId, IWorkbenchMcpServer, McpServerContainers, mcpServerIcon, McpServerInstallState } from '../common/mcpTypes.js';
|
|
+import { IViewDescriptorService } from '../../../common/views.js';
|
|
+import { IMcpWorkbenchService, IWorkbenchMcpServer, McpServerContainers, mcpServerIcon, McpServerInstallState } from '../common/mcpTypes.js';
|
|
import { DropDownAction, InstallAction, InstallingLabelAction, ManageMcpServerAction } from './mcpServerActions.js';
|
|
import { PublisherWidget, InstallCountWidget, RatingsWidget, McpServerIconWidget } from './mcpServerWidgets.js';
|
|
import { ActionRunner, IAction, Separator } from '../../../../base/common/actions.js';
|
|
@@ -33,14 +33,9 @@ import { IMcpGalleryService } from '../../../../platform/mcp/common/mcpManagemen
|
|
import { URI } from '../../../../base/common/uri.js';
|
|
import { ThemeIcon } from '../../../../base/common/themables.js';
|
|
import { IProductService } from '../../../../platform/product/common/productService.js';
|
|
-import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
import { IWorkbenchContribution } from '../../../common/contributions.js';
|
|
-import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
|
|
-import { DefaultViewsContext, SearchMcpServersContext } from '../../extensions/common/extensions.js';
|
|
-import { VIEW_CONTAINER } from '../../extensions/browser/extensions.contribution.js';
|
|
import { renderMarkdown } from '../../../../base/browser/markdownRenderer.js';
|
|
import { MarkdownString } from '../../../../base/common/htmlContent.js';
|
|
-import { ChatContextKeys } from '../../chat/common/chatContextKeys.js';
|
|
|
|
export interface McpServerListViewOptions {
|
|
showWelcomeOnEmpty?: boolean;
|
|
@@ -380,32 +375,5 @@ export class McpServersViewsContribution extends Disposable implements IWorkbenc
|
|
|
|
constructor() {
|
|
super();
|
|
-
|
|
- Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry).registerViews([
|
|
- {
|
|
- id: InstalledMcpServersViewId,
|
|
- name: localize2('mcp-installed', "MCP Servers - Installed"),
|
|
- ctorDescriptor: new SyncDescriptor(McpServersListView, [{ showWelcomeOnEmpty: false }]),
|
|
- when: ContextKeyExpr.and(DefaultViewsContext, HasInstalledMcpServersContext),
|
|
- weight: 40,
|
|
- order: 4,
|
|
- canToggleVisibility: true
|
|
- },
|
|
- {
|
|
- id: 'workbench.views.mcp.default.marketplace',
|
|
- name: localize2('mcp', "MCP Servers"),
|
|
- ctorDescriptor: new SyncDescriptor(DefaultBrowseMcpServersView, [{ showWelcomeOnEmpty: true }]),
|
|
- when: ContextKeyExpr.and(DefaultViewsContext, HasInstalledMcpServersContext.toNegated(), ChatContextKeys.Setup.hidden.negate()),
|
|
- weight: 40,
|
|
- order: 4,
|
|
- canToggleVisibility: true
|
|
- },
|
|
- {
|
|
- id: 'workbench.views.mcp.marketplace',
|
|
- name: localize2('mcp', "MCP Servers"),
|
|
- ctorDescriptor: new SyncDescriptor(McpServersListView, [{ showWelcomeOnEmpty: true }]),
|
|
- when: ContextKeyExpr.and(SearchMcpServersContext),
|
|
- }
|
|
- ], VIEW_CONTAINER);
|
|
}
|
|
}
|
|
diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
|
|
index 5e374fb135a..da493f9b655 100644
|
|
--- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
|
|
+++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
|
|
@@ -3,654 +3,15 @@
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
-import { localize, localize2 } from '../../../../nls.js';
|
|
-import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
-import { IWorkbenchContributionsRegistry, registerWorkbenchContribution2, Extensions as WorkbenchExtensions, WorkbenchPhase } from '../../../common/contributions.js';
|
|
-import { QuickDiffWorkbenchController } from './quickDiffDecorator.js';
|
|
-import { VIEWLET_ID, ISCMService, VIEW_PANE_ID, ISCMProvider, ISCMViewService, REPOSITORIES_VIEW_PANE_ID, HISTORY_VIEW_PANE_ID } from '../common/scm.js';
|
|
-import { KeyMod, KeyCode } from '../../../../base/common/keyCodes.js';
|
|
-import { MenuRegistry, MenuId } from '../../../../platform/actions/common/actions.js';
|
|
-import { SCMActiveResourceContextKeyController, SCMActiveRepositoryController } from './activity.js';
|
|
-import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
|
|
-import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from '../../../../platform/configuration/common/configurationRegistry.js';
|
|
-import { IContextKeyService, ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
|
|
-import { CommandsRegistry, ICommandService } from '../../../../platform/commands/common/commands.js';
|
|
-import { KeybindingsRegistry, KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
|
|
+import { ISCMService, ISCMViewService } from '../common/scm.js';
|
|
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
|
import { SCMService } from '../common/scmService.js';
|
|
-import { IViewContainersRegistry, ViewContainerLocation, Extensions as ViewContainerExtensions, IViewsRegistry } from '../../../common/views.js';
|
|
-import { SCMViewPaneContainer } from './scmViewPaneContainer.js';
|
|
-import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
|
|
-import { ModesRegistry } from '../../../../editor/common/languages/modesRegistry.js';
|
|
-import { Codicon } from '../../../../base/common/codicons.js';
|
|
-import { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';
|
|
-import { ContextKeys, SCMViewPane } from './scmViewPane.js';
|
|
-import { RepositoryPicker, SCMViewService } from './scmViewService.js';
|
|
-import { SCMRepositoriesViewPane } from './scmRepositoriesViewPane.js';
|
|
-import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
|
|
-import { Context as SuggestContext } from '../../../../editor/contrib/suggest/browser/suggest.js';
|
|
-import { MANAGE_TRUST_COMMAND_ID, WorkspaceTrustContext } from '../../workspace/common/workspace.js';
|
|
+import { SCMViewService } from './scmViewService.js';
|
|
import { IQuickDiffService } from '../common/quickDiff.js';
|
|
import { QuickDiffService } from '../common/quickDiffService.js';
|
|
-import { getActiveElement, isActiveElement } from '../../../../base/browser/dom.js';
|
|
-import { SCMWorkingSetController } from './workingSet.js';
|
|
-import { IViewsService } from '../../../services/views/common/viewsService.js';
|
|
-import { IListService, WorkbenchList } from '../../../../platform/list/browser/listService.js';
|
|
-import { isSCMRepository } from './util.js';
|
|
-import { SCMHistoryViewPane } from './scmHistoryViewPane.js';
|
|
-import { QuickDiffModelService, IQuickDiffModelService } from './quickDiffModel.js';
|
|
-import { QuickDiffEditorController } from './quickDiffWidget.js';
|
|
-import { EditorContributionInstantiation, registerEditorContribution } from '../../../../editor/browser/editorExtensions.js';
|
|
-import { RemoteNameContext } from '../../../common/contextkeys.js';
|
|
-import { AccessibleViewRegistry } from '../../../../platform/accessibility/browser/accessibleViewRegistry.js';
|
|
-import { SCMAccessibilityHelp } from './scmAccessibilityHelp.js';
|
|
-import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js';
|
|
-import { SCMHistoryItemContextContribution } from './scmHistoryChatContext.js';
|
|
-
|
|
-ModesRegistry.registerLanguage({
|
|
- id: 'scminput',
|
|
- extensions: [],
|
|
- aliases: [], // hide from language selector
|
|
- mimetypes: ['text/x-scm-input']
|
|
-});
|
|
-
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
|
- .registerWorkbenchContribution(QuickDiffWorkbenchController, LifecyclePhase.Restored);
|
|
-
|
|
-registerEditorContribution(QuickDiffEditorController.ID,
|
|
- QuickDiffEditorController, EditorContributionInstantiation.AfterFirstRender);
|
|
-
|
|
-const sourceControlViewIcon = registerIcon('source-control-view-icon', Codicon.sourceControl, localize('sourceControlViewIcon', 'View icon of the Source Control view.'));
|
|
-
|
|
-const viewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
|
|
- id: VIEWLET_ID,
|
|
- title: localize2('source control', 'Source Control'),
|
|
- ctorDescriptor: new SyncDescriptor(SCMViewPaneContainer),
|
|
- storageId: 'workbench.scm.views.state',
|
|
- icon: sourceControlViewIcon,
|
|
- alwaysUseContainerInfo: true,
|
|
- order: 2,
|
|
- hideIfEmpty: true,
|
|
-}, ViewContainerLocation.Sidebar, { doNotRegisterOpenCommand: true });
|
|
-
|
|
-const viewsRegistry = Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry);
|
|
-const containerTitle = localize('source control view', "Source Control");
|
|
-
|
|
-viewsRegistry.registerViewWelcomeContent(VIEW_PANE_ID, {
|
|
- content: localize('no open repo', "No source control providers registered."),
|
|
- when: 'default'
|
|
-});
|
|
-
|
|
-viewsRegistry.registerViewWelcomeContent(VIEW_PANE_ID, {
|
|
- content: localize('no open repo in an untrusted workspace', "None of the registered source control providers work in Restricted Mode."),
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('scm.providerCount', 0), WorkspaceTrustContext.IsEnabled, WorkspaceTrustContext.IsTrusted.toNegated())
|
|
-});
|
|
-
|
|
-viewsRegistry.registerViewWelcomeContent(VIEW_PANE_ID, {
|
|
- content: `[${localize('manageWorkspaceTrustAction', "Manage Workspace Trust")}](command:${MANAGE_TRUST_COMMAND_ID})`,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.equals('scm.providerCount', 0), WorkspaceTrustContext.IsEnabled, WorkspaceTrustContext.IsTrusted.toNegated())
|
|
-});
|
|
-
|
|
-viewsRegistry.registerViewWelcomeContent(HISTORY_VIEW_PANE_ID, {
|
|
- content: localize('no history items', "The selected source control provider does not have any source control history items."),
|
|
- when: ContextKeys.SCMHistoryItemCount.isEqualTo(0)
|
|
-});
|
|
-
|
|
-viewsRegistry.registerViews([{
|
|
- id: REPOSITORIES_VIEW_PANE_ID,
|
|
- containerTitle,
|
|
- name: localize2('scmRepositories', "Repositories"),
|
|
- singleViewPaneContainerTitle: localize('source control repositories', "Source Control Repositories"),
|
|
- ctorDescriptor: new SyncDescriptor(SCMRepositoriesViewPane),
|
|
- canToggleVisibility: true,
|
|
- hideByDefault: true,
|
|
- canMoveView: true,
|
|
- weight: 20,
|
|
- order: 0,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.has('scm.providerCount'), ContextKeyExpr.notEquals('scm.providerCount', 0)),
|
|
- // readonly when = ContextKeyExpr.or(ContextKeyExpr.equals('config.scm.alwaysShowProviders', true), ContextKeyExpr.and(ContextKeyExpr.notEquals('scm.providerCount', 0), ContextKeyExpr.notEquals('scm.providerCount', 1)));
|
|
- containerIcon: sourceControlViewIcon
|
|
-}], viewContainer);
|
|
-
|
|
-viewsRegistry.registerViews([{
|
|
- id: VIEW_PANE_ID,
|
|
- containerTitle,
|
|
- name: localize2('scmChanges', 'Changes'),
|
|
- singleViewPaneContainerTitle: containerTitle,
|
|
- ctorDescriptor: new SyncDescriptor(SCMViewPane),
|
|
- canToggleVisibility: true,
|
|
- canMoveView: true,
|
|
- weight: 40,
|
|
- order: 1,
|
|
- containerIcon: sourceControlViewIcon,
|
|
- openCommandActionDescriptor: {
|
|
- id: viewContainer.id,
|
|
- mnemonicTitle: localize({ key: 'miViewSCM', comment: ['&& denotes a mnemonic'] }, "Source &&Control"),
|
|
- keybindings: {
|
|
- primary: 0,
|
|
- win: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyG },
|
|
- linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyG },
|
|
- mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KeyG },
|
|
- },
|
|
- order: 2,
|
|
- }
|
|
-}], viewContainer);
|
|
-
|
|
-viewsRegistry.registerViews([{
|
|
- id: HISTORY_VIEW_PANE_ID,
|
|
- containerTitle,
|
|
- name: localize2('scmGraph', "Graph"),
|
|
- singleViewPaneContainerTitle: localize('source control graph', "Source Control Graph"),
|
|
- ctorDescriptor: new SyncDescriptor(SCMHistoryViewPane),
|
|
- canToggleVisibility: true,
|
|
- canMoveView: true,
|
|
- weight: 40,
|
|
- order: 2,
|
|
- when: ContextKeyExpr.and(
|
|
- ContextKeyExpr.has('scm.historyProviderCount'),
|
|
- ContextKeyExpr.notEquals('scm.historyProviderCount', 0),
|
|
- ),
|
|
- containerIcon: sourceControlViewIcon
|
|
-}], viewContainer);
|
|
-
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
|
- .registerWorkbenchContribution(SCMActiveRepositoryController, LifecyclePhase.Restored);
|
|
-
|
|
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
|
- .registerWorkbenchContribution(SCMActiveResourceContextKeyController, LifecyclePhase.Restored);
|
|
-
|
|
-registerWorkbenchContribution2(
|
|
- SCMWorkingSetController.ID,
|
|
- SCMWorkingSetController,
|
|
- WorkbenchPhase.AfterRestored
|
|
-);
|
|
-
|
|
-registerWorkbenchContribution2(
|
|
- SCMHistoryItemContextContribution.ID,
|
|
- SCMHistoryItemContextContribution,
|
|
- WorkbenchPhase.AfterRestored
|
|
-);
|
|
-
|
|
-Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
|
|
- id: 'scm',
|
|
- order: 5,
|
|
- title: localize('scmConfigurationTitle', "Source Control"),
|
|
- type: 'object',
|
|
- scope: ConfigurationScope.RESOURCE,
|
|
- properties: {
|
|
- 'scm.diffDecorations': {
|
|
- type: 'string',
|
|
- enum: ['all', 'gutter', 'overview', 'minimap', 'none'],
|
|
- enumDescriptions: [
|
|
- localize('scm.diffDecorations.all', "Show the diff decorations in all available locations."),
|
|
- localize('scm.diffDecorations.gutter', "Show the diff decorations only in the editor gutter."),
|
|
- localize('scm.diffDecorations.overviewRuler', "Show the diff decorations only in the overview ruler."),
|
|
- localize('scm.diffDecorations.minimap', "Show the diff decorations only in the minimap."),
|
|
- localize('scm.diffDecorations.none', "Do not show the diff decorations.")
|
|
- ],
|
|
- default: 'all',
|
|
- description: localize('diffDecorations', "Controls diff decorations in the editor.")
|
|
- },
|
|
- 'scm.diffDecorationsGutterWidth': {
|
|
- type: 'number',
|
|
- enum: [1, 2, 3, 4, 5],
|
|
- default: 3,
|
|
- description: localize('diffGutterWidth', "Controls the width(px) of diff decorations in gutter (added & modified).")
|
|
- },
|
|
- 'scm.diffDecorationsGutterVisibility': {
|
|
- type: 'string',
|
|
- enum: ['always', 'hover'],
|
|
- enumDescriptions: [
|
|
- localize('scm.diffDecorationsGutterVisibility.always', "Show the diff decorator in the gutter at all times."),
|
|
- localize('scm.diffDecorationsGutterVisibility.hover', "Show the diff decorator in the gutter only on hover.")
|
|
- ],
|
|
- description: localize('scm.diffDecorationsGutterVisibility', "Controls the visibility of the Source Control diff decorator in the gutter."),
|
|
- default: 'always'
|
|
- },
|
|
- 'scm.diffDecorationsGutterAction': {
|
|
- type: 'string',
|
|
- enum: ['diff', 'none'],
|
|
- enumDescriptions: [
|
|
- localize('scm.diffDecorationsGutterAction.diff', "Show the inline diff Peek view on click."),
|
|
- localize('scm.diffDecorationsGutterAction.none', "Do nothing.")
|
|
- ],
|
|
- description: localize('scm.diffDecorationsGutterAction', "Controls the behavior of Source Control diff gutter decorations."),
|
|
- default: 'diff'
|
|
- },
|
|
- 'scm.diffDecorationsGutterPattern': {
|
|
- type: 'object',
|
|
- description: localize('diffGutterPattern', "Controls whether a pattern is used for the diff decorations in gutter."),
|
|
- additionalProperties: false,
|
|
- properties: {
|
|
- 'added': {
|
|
- type: 'boolean',
|
|
- description: localize('diffGutterPatternAdded', "Use pattern for the diff decorations in gutter for added lines."),
|
|
- },
|
|
- 'modified': {
|
|
- type: 'boolean',
|
|
- description: localize('diffGutterPatternModifed', "Use pattern for the diff decorations in gutter for modified lines."),
|
|
- },
|
|
- },
|
|
- default: {
|
|
- 'added': false,
|
|
- 'modified': true
|
|
- }
|
|
- },
|
|
- 'scm.diffDecorationsIgnoreTrimWhitespace': {
|
|
- type: 'string',
|
|
- enum: ['true', 'false', 'inherit'],
|
|
- enumDescriptions: [
|
|
- localize('scm.diffDecorationsIgnoreTrimWhitespace.true', "Ignore leading and trailing whitespace."),
|
|
- localize('scm.diffDecorationsIgnoreTrimWhitespace.false', "Do not ignore leading and trailing whitespace."),
|
|
- localize('scm.diffDecorationsIgnoreTrimWhitespace.inherit', "Inherit from `diffEditor.ignoreTrimWhitespace`.")
|
|
- ],
|
|
- description: localize('diffDecorationsIgnoreTrimWhitespace', "Controls whether leading and trailing whitespace is ignored in Source Control diff gutter decorations."),
|
|
- default: 'false'
|
|
- },
|
|
- 'scm.alwaysShowActions': {
|
|
- type: 'boolean',
|
|
- description: localize('alwaysShowActions', "Controls whether inline actions are always visible in the Source Control view."),
|
|
- default: false
|
|
- },
|
|
- 'scm.countBadge': {
|
|
- type: 'string',
|
|
- enum: ['all', 'focused', 'off'],
|
|
- enumDescriptions: [
|
|
- localize('scm.countBadge.all', "Show the sum of all Source Control Provider count badges."),
|
|
- localize('scm.countBadge.focused', "Show the count badge of the focused Source Control Provider."),
|
|
- localize('scm.countBadge.off', "Disable the Source Control count badge.")
|
|
- ],
|
|
- description: localize('scm.countBadge', "Controls the count badge on the Source Control icon on the Activity Bar."),
|
|
- default: 'all'
|
|
- },
|
|
- 'scm.providerCountBadge': {
|
|
- type: 'string',
|
|
- enum: ['hidden', 'auto', 'visible'],
|
|
- enumDescriptions: [
|
|
- localize('scm.providerCountBadge.hidden', "Hide Source Control Provider count badges."),
|
|
- localize('scm.providerCountBadge.auto', "Only show count badge for Source Control Provider when non-zero."),
|
|
- localize('scm.providerCountBadge.visible', "Show Source Control Provider count badges.")
|
|
- ],
|
|
- markdownDescription: localize('scm.providerCountBadge', "Controls the count badges on Source Control Provider headers. These headers appear in the Source Control view when there is more than one provider or when the {0} setting is enabled, and in the Source Control Repositories view.", '\`#scm.alwaysShowRepositories#\`'),
|
|
- default: 'hidden'
|
|
- },
|
|
- 'scm.defaultViewMode': {
|
|
- type: 'string',
|
|
- enum: ['tree', 'list'],
|
|
- enumDescriptions: [
|
|
- localize('scm.defaultViewMode.tree', "Show the repository changes as a tree."),
|
|
- localize('scm.defaultViewMode.list', "Show the repository changes as a list.")
|
|
- ],
|
|
- description: localize('scm.defaultViewMode', "Controls the default Source Control repository view mode."),
|
|
- default: 'list'
|
|
- },
|
|
- 'scm.defaultViewSortKey': {
|
|
- type: 'string',
|
|
- enum: ['name', 'path', 'status'],
|
|
- enumDescriptions: [
|
|
- localize('scm.defaultViewSortKey.name', "Sort the repository changes by file name."),
|
|
- localize('scm.defaultViewSortKey.path', "Sort the repository changes by path."),
|
|
- localize('scm.defaultViewSortKey.status', "Sort the repository changes by Source Control status.")
|
|
- ],
|
|
- description: localize('scm.defaultViewSortKey', "Controls the default Source Control repository changes sort order when viewed as a list."),
|
|
- default: 'path'
|
|
- },
|
|
- 'scm.autoReveal': {
|
|
- type: 'boolean',
|
|
- description: localize('autoReveal', "Controls whether the Source Control view should automatically reveal and select files when opening them."),
|
|
- default: true
|
|
- },
|
|
- 'scm.inputFontFamily': {
|
|
- type: 'string',
|
|
- markdownDescription: localize('inputFontFamily', "Controls the font for the input message. Use `default` for the workbench user interface font family, `editor` for the `#editor.fontFamily#`'s value, or a custom font family."),
|
|
- default: 'default'
|
|
- },
|
|
- 'scm.inputFontSize': {
|
|
- type: 'number',
|
|
- markdownDescription: localize('inputFontSize', "Controls the font size for the input message in pixels."),
|
|
- default: 13
|
|
- },
|
|
- 'scm.inputMaxLineCount': {
|
|
- type: 'number',
|
|
- markdownDescription: localize('inputMaxLines', "Controls the maximum number of lines that the input will auto-grow to."),
|
|
- minimum: 1,
|
|
- maximum: 50,
|
|
- default: 10
|
|
- },
|
|
- 'scm.inputMinLineCount': {
|
|
- type: 'number',
|
|
- markdownDescription: localize('inputMinLines', "Controls the minimum number of lines that the input will auto-grow from."),
|
|
- minimum: 1,
|
|
- maximum: 50,
|
|
- default: 1
|
|
- },
|
|
- 'scm.alwaysShowRepositories': {
|
|
- type: 'boolean',
|
|
- markdownDescription: localize('alwaysShowRepository', "Controls whether repositories should always be visible in the Source Control view."),
|
|
- default: false
|
|
- },
|
|
- 'scm.repositories.sortOrder': {
|
|
- type: 'string',
|
|
- enum: ['discovery time', 'name', 'path'],
|
|
- enumDescriptions: [
|
|
- localize('scm.repositoriesSortOrder.discoveryTime', "Repositories in the Source Control Repositories view are sorted by discovery time. Repositories in the Source Control view are sorted in the order that they were selected."),
|
|
- localize('scm.repositoriesSortOrder.name', "Repositories in the Source Control Repositories and Source Control views are sorted by repository name."),
|
|
- localize('scm.repositoriesSortOrder.path', "Repositories in the Source Control Repositories and Source Control views are sorted by repository path.")
|
|
- ],
|
|
- description: localize('repositoriesSortOrder', "Controls the sort order of the repositories in the source control repositories view."),
|
|
- default: 'discovery time'
|
|
- },
|
|
- 'scm.repositories.visible': {
|
|
- type: 'number',
|
|
- description: localize('providersVisible', "Controls how many repositories are visible in the Source Control Repositories section. Set to 0, to be able to manually resize the view."),
|
|
- default: 10
|
|
- },
|
|
- 'scm.showActionButton': {
|
|
- type: 'boolean',
|
|
- markdownDescription: localize('showActionButton', "Controls whether an action button can be shown in the Source Control view."),
|
|
- default: true
|
|
- },
|
|
- 'scm.showInputActionButton': {
|
|
- type: 'boolean',
|
|
- markdownDescription: localize('showInputActionButton', "Controls whether an action button can be shown in the Source Control input."),
|
|
- default: true
|
|
- },
|
|
- 'scm.workingSets.enabled': {
|
|
- type: 'boolean',
|
|
- description: localize('scm.workingSets.enabled', "Controls whether to store editor working sets when switching between source control history item groups."),
|
|
- default: false
|
|
- },
|
|
- 'scm.workingSets.default': {
|
|
- type: 'string',
|
|
- enum: ['empty', 'current'],
|
|
- enumDescriptions: [
|
|
- localize('scm.workingSets.default.empty', "Use an empty working set when switching to a source control history item group that does not have a working set."),
|
|
- localize('scm.workingSets.default.current', "Use the current working set when switching to a source control history item group that does not have a working set.")
|
|
- ],
|
|
- description: localize('scm.workingSets.default', "Controls the default working set to use when switching to a source control history item group that does not have a working set."),
|
|
- default: 'current'
|
|
- },
|
|
- 'scm.compactFolders': {
|
|
- type: 'boolean',
|
|
- description: localize('scm.compactFolders', "Controls whether the Source Control view should render folders in a compact form. In such a form, single child folders will be compressed in a combined tree element."),
|
|
- default: true
|
|
- },
|
|
- 'scm.graph.pageOnScroll': {
|
|
- type: 'boolean',
|
|
- description: localize('scm.graph.pageOnScroll', "Controls whether the Source Control Graph view will load the next page of items when you scroll to the end of the list."),
|
|
- default: true
|
|
- },
|
|
- 'scm.graph.pageSize': {
|
|
- type: 'number',
|
|
- description: localize('scm.graph.pageSize', "The number of items to show in the Source Control Graph view by default and when loading more items."),
|
|
- minimum: 1,
|
|
- maximum: 1000,
|
|
- default: 50
|
|
- },
|
|
- 'scm.graph.badges': {
|
|
- type: 'string',
|
|
- enum: ['all', 'filter'],
|
|
- enumDescriptions: [
|
|
- localize('scm.graph.badges.all', "Show badges of all history item groups in the Source Control Graph view."),
|
|
- localize('scm.graph.badges.filter', "Show only the badges of history item groups used as a filter in the Source Control Graph view.")
|
|
- ],
|
|
- description: localize('scm.graph.badges', "Controls which badges are shown in the Source Control Graph view. The badges are shown on the right side of the graph indicating the names of history item groups."),
|
|
- default: 'filter'
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- id: 'scm.acceptInput',
|
|
- metadata: { description: localize('scm accept', "Source Control: Accept Input"), args: [] },
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- when: ContextKeyExpr.has('scmRepository'),
|
|
- primary: KeyMod.CtrlCmd | KeyCode.Enter,
|
|
- handler: accessor => {
|
|
- const contextKeyService = accessor.get(IContextKeyService);
|
|
- const context = contextKeyService.getContext(getActiveElement());
|
|
- const repositoryId = context.getValue<string | undefined>('scmRepository');
|
|
-
|
|
- if (!repositoryId) {
|
|
- return Promise.resolve(null);
|
|
- }
|
|
-
|
|
- const scmService = accessor.get(ISCMService);
|
|
- const repository = scmService.getRepository(repositoryId);
|
|
-
|
|
- if (!repository?.provider.acceptInputCommand) {
|
|
- return Promise.resolve(null);
|
|
- }
|
|
-
|
|
- const id = repository.provider.acceptInputCommand.id;
|
|
- const args = repository.provider.acceptInputCommand.arguments;
|
|
- const commandService = accessor.get(ICommandService);
|
|
-
|
|
- return commandService.executeCommand(id, ...(args || []));
|
|
- }
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- id: 'scm.clearInput',
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.has('scmRepository'), SuggestContext.Visible.toNegated(), EditorContextKeys.hasNonEmptySelection.toNegated()),
|
|
- primary: KeyCode.Escape,
|
|
- handler: async (accessor) => {
|
|
- const scmService = accessor.get(ISCMService);
|
|
- const contextKeyService = accessor.get(IContextKeyService);
|
|
-
|
|
- const context = contextKeyService.getContext(getActiveElement());
|
|
- const repositoryId = context.getValue<string | undefined>('scmRepository');
|
|
- const repository = repositoryId ? scmService.getRepository(repositoryId) : undefined;
|
|
- repository?.input.setValue('', true);
|
|
- }
|
|
-});
|
|
-
|
|
-const viewNextCommitCommand = {
|
|
- description: { description: localize('scm view next commit', "Source Control: View Next Commit"), args: [] },
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- handler: (accessor: ServicesAccessor) => {
|
|
- const contextKeyService = accessor.get(IContextKeyService);
|
|
- const scmService = accessor.get(ISCMService);
|
|
- const context = contextKeyService.getContext(getActiveElement());
|
|
- const repositoryId = context.getValue<string | undefined>('scmRepository');
|
|
- const repository = repositoryId ? scmService.getRepository(repositoryId) : undefined;
|
|
- repository?.input.showNextHistoryValue();
|
|
- }
|
|
-};
|
|
-
|
|
-const viewPreviousCommitCommand = {
|
|
- description: { description: localize('scm view previous commit', "Source Control: View Previous Commit"), args: [] },
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- handler: (accessor: ServicesAccessor) => {
|
|
- const contextKeyService = accessor.get(IContextKeyService);
|
|
- const scmService = accessor.get(ISCMService);
|
|
- const context = contextKeyService.getContext(getActiveElement());
|
|
- const repositoryId = context.getValue<string | undefined>('scmRepository');
|
|
- const repository = repositoryId ? scmService.getRepository(repositoryId) : undefined;
|
|
- repository?.input.showPreviousHistoryValue();
|
|
- }
|
|
-};
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- ...viewNextCommitCommand,
|
|
- id: 'scm.viewNextCommit',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.has('scmRepository'), ContextKeyExpr.has('scmInputIsInLastPosition'), SuggestContext.Visible.toNegated()),
|
|
- primary: KeyCode.DownArrow
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- ...viewPreviousCommitCommand,
|
|
- id: 'scm.viewPreviousCommit',
|
|
- when: ContextKeyExpr.and(ContextKeyExpr.has('scmRepository'), ContextKeyExpr.has('scmInputIsInFirstPosition'), SuggestContext.Visible.toNegated()),
|
|
- primary: KeyCode.UpArrow
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- ...viewNextCommitCommand,
|
|
- id: 'scm.forceViewNextCommit',
|
|
- when: ContextKeyExpr.has('scmRepository'),
|
|
- primary: KeyMod.Alt | KeyCode.DownArrow
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- ...viewPreviousCommitCommand,
|
|
- id: 'scm.forceViewPreviousCommit',
|
|
- when: ContextKeyExpr.has('scmRepository'),
|
|
- primary: KeyMod.Alt | KeyCode.UpArrow
|
|
-});
|
|
-
|
|
-CommandsRegistry.registerCommand('scm.openInIntegratedTerminal', async (accessor, ...providers: ISCMProvider[]) => {
|
|
- if (!providers || providers.length === 0) {
|
|
- return;
|
|
- }
|
|
-
|
|
- const commandService = accessor.get(ICommandService);
|
|
- const listService = accessor.get(IListService);
|
|
-
|
|
- let provider = providers.length === 1 ? providers[0] : undefined;
|
|
-
|
|
- if (!provider) {
|
|
- const list = listService.lastFocusedList;
|
|
- const element = list?.getHTMLElement();
|
|
-
|
|
- if (list instanceof WorkbenchList && element && isActiveElement(element)) {
|
|
- const [index] = list.getFocus();
|
|
- const focusedElement = list.element(index);
|
|
-
|
|
- // Source Control Repositories
|
|
- if (isSCMRepository(focusedElement)) {
|
|
- provider = focusedElement.provider;
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- if (!provider?.rootUri) {
|
|
- return;
|
|
- }
|
|
-
|
|
- await commandService.executeCommand('openInIntegratedTerminal', provider.rootUri);
|
|
-});
|
|
-
|
|
-CommandsRegistry.registerCommand('scm.openInTerminal', async (accessor, provider: ISCMProvider) => {
|
|
- if (!provider || !provider.rootUri) {
|
|
- return;
|
|
- }
|
|
-
|
|
- const commandService = accessor.get(ICommandService);
|
|
- await commandService.executeCommand('openInTerminal', provider.rootUri);
|
|
-});
|
|
-
|
|
-CommandsRegistry.registerCommand('scm.setActiveProvider', async (accessor) => {
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- const scmViewService = accessor.get(ISCMViewService);
|
|
-
|
|
- const placeHolder = localize('scmActiveRepositoryPlaceHolder', "Select the active repository, type to filter all repositories");
|
|
- const autoQuickItemDescription = localize('scmActiveRepositoryAutoDescription', "The active repository is updated based on focused repository/active editor");
|
|
- const repositoryPicker = instantiationService.createInstance(RepositoryPicker, placeHolder, autoQuickItemDescription);
|
|
-
|
|
- const result = await repositoryPicker.pickRepository();
|
|
- if (result?.repository) {
|
|
- const repository = result.repository !== 'auto' ? result.repository : undefined;
|
|
- scmViewService.pinActiveRepository(repository);
|
|
- }
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.SCMSourceControl, {
|
|
- group: '100_end',
|
|
- command: {
|
|
- id: 'scm.openInTerminal',
|
|
- title: localize('open in external terminal', "Open in External Terminal")
|
|
- },
|
|
- when: ContextKeyExpr.and(
|
|
- RemoteNameContext.isEqualTo(''),
|
|
- ContextKeyExpr.equals('scmProviderHasRootUri', true),
|
|
- ContextKeyExpr.or(
|
|
- ContextKeyExpr.equals('config.terminal.sourceControlRepositoriesKind', 'external'),
|
|
- ContextKeyExpr.equals('config.terminal.sourceControlRepositoriesKind', 'both')))
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.SCMSourceControl, {
|
|
- group: '100_end',
|
|
- command: {
|
|
- id: 'scm.openInIntegratedTerminal',
|
|
- title: localize('open in integrated terminal', "Open in Integrated Terminal")
|
|
- },
|
|
- when: ContextKeyExpr.and(
|
|
- ContextKeyExpr.equals('scmProviderHasRootUri', true),
|
|
- ContextKeyExpr.or(
|
|
- ContextKeyExpr.equals('config.terminal.sourceControlRepositoriesKind', 'integrated'),
|
|
- ContextKeyExpr.equals('config.terminal.sourceControlRepositoriesKind', 'both')))
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- id: 'workbench.scm.action.focusPreviousInput',
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- when: ContextKeys.RepositoryVisibilityCount.notEqualsTo(0),
|
|
- handler: async accessor => {
|
|
- const viewsService = accessor.get(IViewsService);
|
|
- const scmView = await viewsService.openView<SCMViewPane>(VIEW_PANE_ID);
|
|
- if (scmView) {
|
|
- scmView.focusPreviousInput();
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- id: 'workbench.scm.action.focusNextInput',
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- when: ContextKeys.RepositoryVisibilityCount.notEqualsTo(0),
|
|
- handler: async accessor => {
|
|
- const viewsService = accessor.get(IViewsService);
|
|
- const scmView = await viewsService.openView<SCMViewPane>(VIEW_PANE_ID);
|
|
- if (scmView) {
|
|
- scmView.focusNextInput();
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- id: 'workbench.scm.action.focusPreviousResourceGroup',
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- handler: async accessor => {
|
|
- const viewsService = accessor.get(IViewsService);
|
|
- const scmView = await viewsService.openView<SCMViewPane>(VIEW_PANE_ID);
|
|
- if (scmView) {
|
|
- scmView.focusPreviousResourceGroup();
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
- id: 'workbench.scm.action.focusNextResourceGroup',
|
|
- weight: KeybindingWeight.WorkbenchContrib,
|
|
- handler: async accessor => {
|
|
- const viewsService = accessor.get(IViewsService);
|
|
- const scmView = await viewsService.openView<SCMViewPane>(VIEW_PANE_ID);
|
|
- if (scmView) {
|
|
- scmView.focusNextResourceGroup();
|
|
- }
|
|
- }
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.EditorLineNumberContext, {
|
|
- title: localize('quickDiffDecoration', "Diff Decorations"),
|
|
- submenu: MenuId.SCMQuickDiffDecorations,
|
|
- when: ContextKeyExpr.or(
|
|
- ContextKeyExpr.equals('config.scm.diffDecorations', 'all'),
|
|
- ContextKeyExpr.equals('config.scm.diffDecorations', 'gutter')),
|
|
- group: '9_quickDiffDecorations'
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(MenuId.SCMHistoryItemContext, {
|
|
- title: localize('scmHistoryItemChatContext', "Copilot"),
|
|
- submenu: MenuId.SCMHistoryItemChatContext,
|
|
- group: '8_chat'
|
|
-});
|
|
+import { IQuickDiffModelService, QuickDiffModelService } from './quickDiffModel.js';
|
|
|
|
registerSingleton(ISCMService, SCMService, InstantiationType.Delayed);
|
|
registerSingleton(ISCMViewService, SCMViewService, InstantiationType.Delayed);
|
|
registerSingleton(IQuickDiffService, QuickDiffService, InstantiationType.Delayed);
|
|
registerSingleton(IQuickDiffModelService, QuickDiffModelService, InstantiationType.Delayed);
|
|
-
|
|
-AccessibleViewRegistry.register(new SCMAccessibilityHelp());
|
|
diff --git a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts
|
|
index ba5dc5bf06d..5a62cadb89d 100644
|
|
--- a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts
|
|
+++ b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts
|
|
@@ -5,7 +5,7 @@
|
|
|
|
import { localize, localize2 } from '../../../../nls.js';
|
|
import { KeyMod, KeyChord, KeyCode } from '../../../../base/common/keyCodes.js';
|
|
-import { MenuRegistry, MenuId, Action2, registerAction2, ISubmenuItem } from '../../../../platform/actions/common/actions.js';
|
|
+import { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';
|
|
import { equalsIgnoreCase } from '../../../../base/common/strings.js';
|
|
import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
|
|
@@ -808,41 +808,3 @@ registerAction2(class extends Action2 {
|
|
await marketplaceThemePicker.openQuickPick('', themeService.getColorTheme(), selectTheme).then(undefined, onUnexpectedError);
|
|
}
|
|
});
|
|
-
|
|
-const ThemesSubMenu = new MenuId('ThemesSubMenu');
|
|
-MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
- title: localize('themes', "Themes"),
|
|
- submenu: ThemesSubMenu,
|
|
- group: '2_configuration',
|
|
- order: 7
|
|
-} satisfies ISubmenuItem);
|
|
-MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
|
- title: localize({ key: 'miSelectTheme', comment: ['&& denotes a mnemonic'] }, "&&Themes"),
|
|
- submenu: ThemesSubMenu,
|
|
- group: '2_configuration',
|
|
- order: 7
|
|
-} satisfies ISubmenuItem);
|
|
-
|
|
-MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
- command: {
|
|
- id: SelectColorThemeCommandId,
|
|
- title: localize('selectTheme.label', 'Color Theme')
|
|
- },
|
|
- order: 1
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
- command: {
|
|
- id: SelectFileIconThemeCommandId,
|
|
- title: localize('themes.selectIconTheme.label', "File Icon Theme")
|
|
- },
|
|
- order: 2
|
|
-});
|
|
-
|
|
-MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
- command: {
|
|
- id: SelectProductIconThemeCommandId,
|
|
- title: localize('themes.selectProductIconTheme.label', "Product Icon Theme")
|
|
- },
|
|
- order: 3
|
|
-});
|
|
diff --git a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts
|
|
index 5af51edebe9..f31649c1d46 100644
|
|
--- a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts
|
|
+++ b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts
|
|
@@ -3,24 +3,19 @@
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
-import { Disposable, DisposableStore, IDisposable, MutableDisposable } from '../../../../base/common/lifecycle.js';
|
|
+import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
import { isWeb } from '../../../../base/common/platform.js';
|
|
-import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';
|
|
-import { localize, localize2 } from '../../../../nls.js';
|
|
-import { Action2, MenuId, MenuRegistry, registerAction2 } from '../../../../platform/actions/common/actions.js';
|
|
-import { ContextKeyExpr, IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
-import { IUserDataProfile, IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js';
|
|
+import { localize } from '../../../../nls.js';
|
|
+import { MenuId } from '../../../../platform/actions/common/actions.js';
|
|
+import { IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
+import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js';
|
|
import { IWorkbenchContribution } from '../../../common/contributions.js';
|
|
import { ILifecycleService, LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
|
|
-import { CURRENT_PROFILE_CONTEXT, HAS_PROFILES_CONTEXT, IS_CURRENT_PROFILE_TRANSIENT_CONTEXT, IUserDataProfileManagementService, IUserDataProfileService, PROFILES_CATEGORY, PROFILES_TITLE, isProfileURL } from '../../../services/userDataProfile/common/userDataProfile.js';
|
|
-import { IQuickInputService, IQuickPickItem } from '../../../../platform/quickinput/common/quickInput.js';
|
|
-import { INotificationService } from '../../../../platform/notification/common/notification.js';
|
|
+import { CURRENT_PROFILE_CONTEXT, HAS_PROFILES_CONTEXT, IS_CURRENT_PROFILE_TRANSIENT_CONTEXT, IUserDataProfileService, isProfileURL } from '../../../services/userDataProfile/common/userDataProfile.js';
|
|
import { URI } from '../../../../base/common/uri.js';
|
|
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
|
|
import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.js';
|
|
import { IWorkspaceTagsService } from '../../tags/common/workspaceTags.js';
|
|
-import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
|
|
-import { IOpenerService } from '../../../../platform/opener/common/opener.js';
|
|
import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
import { EditorPaneDescriptor, IEditorPaneRegistry } from '../../../browser/editor.js';
|
|
import { EditorExtensions, IEditorFactoryRegistry } from '../../../common/editor.js';
|
|
@@ -28,13 +23,11 @@ import { UserDataProfilesEditor, UserDataProfilesEditorInput, UserDataProfilesEd
|
|
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
|
|
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
|
|
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
-import { IHostService } from '../../../services/host/browser/host.js';
|
|
import { IUserDataProfilesEditor } from '../common/userDataProfile.js';
|
|
import { IURLService } from '../../../../platform/url/common/url.js';
|
|
import { IBrowserWorkbenchEnvironmentService } from '../../../services/environment/browser/environmentService.js';
|
|
|
|
export const OpenProfileMenu = new MenuId('OpenProfile');
|
|
-const ProfilesMenu = new MenuId('Profiles');
|
|
|
|
export class UserDataProfilesWorkbenchContribution extends Disposable implements IWorkbenchContribution {
|
|
|
|
@@ -47,7 +40,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
|
|
constructor(
|
|
@IUserDataProfileService private readonly userDataProfileService: IUserDataProfileService,
|
|
@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,
|
|
- @IUserDataProfileManagementService private readonly userDataProfileManagementService: IUserDataProfileManagementService,
|
|
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
|
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
|
|
@IWorkspaceTagsService private readonly workspaceTagsService: IWorkspaceTagsService,
|
|
@@ -65,14 +57,14 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
|
|
|
|
this.currentProfileContext.set(this.userDataProfileService.currentProfile.id);
|
|
this.isCurrentProfileTransientContext.set(!!this.userDataProfileService.currentProfile.isTransient);
|
|
- this._register(this.userDataProfileService.onDidChangeCurrentProfile(e => {
|
|
+ this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => {
|
|
this.currentProfileContext.set(this.userDataProfileService.currentProfile.id);
|
|
this.isCurrentProfileTransientContext.set(!!this.userDataProfileService.currentProfile.isTransient);
|
|
}));
|
|
|
|
this.hasProfilesContext = HAS_PROFILES_CONTEXT.bindTo(contextKeyService);
|
|
this.hasProfilesContext.set(this.userDataProfilesService.profiles.length > 1);
|
|
- this._register(this.userDataProfilesService.onDidChangeProfiles(e => this.hasProfilesContext.set(this.userDataProfilesService.profiles.length > 1)));
|
|
+ this._register(this.userDataProfilesService.onDidChangeProfiles(() => this.hasProfilesContext.set(this.userDataProfilesService.profiles.length > 1)));
|
|
|
|
this.registerEditor();
|
|
this.registerActions();
|
|
@@ -121,383 +113,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
|
|
}
|
|
|
|
private registerActions(): void {
|
|
- this.registerProfileSubMenu();
|
|
- this._register(this.registerManageProfilesAction());
|
|
- this._register(this.registerSwitchProfileAction());
|
|
-
|
|
- this.registerOpenProfileSubMenu();
|
|
- this.registerNewWindowWithProfileAction();
|
|
- this.registerProfilesActions();
|
|
- this._register(this.userDataProfilesService.onDidChangeProfiles(() => this.registerProfilesActions()));
|
|
-
|
|
- this._register(this.registerExportCurrentProfileAction());
|
|
-
|
|
- this.registerCreateFromCurrentProfileAction();
|
|
- this.registerNewProfileAction();
|
|
- this.registerDeleteProfileAction();
|
|
-
|
|
- this.registerHelpAction();
|
|
- }
|
|
-
|
|
- private registerProfileSubMenu(): void {
|
|
- const getProfilesTitle = () => {
|
|
- return localize('profiles', "Profile ({0})", this.userDataProfileService.currentProfile.name);
|
|
- };
|
|
- MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
- get title() {
|
|
- return getProfilesTitle();
|
|
- },
|
|
- submenu: ProfilesMenu,
|
|
- group: '2_configuration',
|
|
- order: 1,
|
|
- when: HAS_PROFILES_CONTEXT
|
|
- });
|
|
- MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
|
- get title() {
|
|
- return getProfilesTitle();
|
|
- },
|
|
- submenu: ProfilesMenu,
|
|
- group: '2_configuration',
|
|
- order: 1,
|
|
- when: HAS_PROFILES_CONTEXT
|
|
- });
|
|
- }
|
|
-
|
|
- private registerOpenProfileSubMenu(): void {
|
|
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
|
|
- title: localize('New Profile Window', "New Window with Profile"),
|
|
- submenu: OpenProfileMenu,
|
|
- group: '1_new',
|
|
- order: 4,
|
|
- });
|
|
- }
|
|
-
|
|
- private readonly profilesDisposable = this._register(new MutableDisposable<DisposableStore>());
|
|
- private registerProfilesActions(): void {
|
|
- this.profilesDisposable.value = new DisposableStore();
|
|
- for (const profile of this.userDataProfilesService.profiles) {
|
|
- if (!profile.isTransient) {
|
|
- this.profilesDisposable.value.add(this.registerProfileEntryAction(profile));
|
|
- this.profilesDisposable.value.add(this.registerNewWindowAction(profile));
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- private registerProfileEntryAction(profile: IUserDataProfile): IDisposable {
|
|
- const that = this;
|
|
- return registerAction2(class ProfileEntryAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: `workbench.profiles.actions.profileEntry.${profile.id}`,
|
|
- title: profile.name,
|
|
- metadata: {
|
|
- description: localize2('change profile', "Switch to {0} profile", profile.name),
|
|
- },
|
|
- toggled: ContextKeyExpr.equals(CURRENT_PROFILE_CONTEXT.key, profile.id),
|
|
- menu: [
|
|
- {
|
|
- id: ProfilesMenu,
|
|
- group: '0_profiles',
|
|
- }
|
|
- ]
|
|
- });
|
|
- }
|
|
- async run(accessor: ServicesAccessor) {
|
|
- if (that.userDataProfileService.currentProfile.id !== profile.id) {
|
|
- return that.userDataProfileManagementService.switchProfile(profile);
|
|
- }
|
|
- }
|
|
- });
|
|
- }
|
|
-
|
|
- private registerNewWindowWithProfileAction(): IDisposable {
|
|
- return registerAction2(class NewWindowWithProfileAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: `workbench.profiles.actions.newWindowWithProfile`,
|
|
- title: localize2('newWindowWithProfile', "New Window with Profile..."),
|
|
- category: PROFILES_CATEGORY,
|
|
- precondition: HAS_PROFILES_CONTEXT,
|
|
- f1: true,
|
|
- });
|
|
- }
|
|
- async run(accessor: ServicesAccessor) {
|
|
- const quickInputService = accessor.get(IQuickInputService);
|
|
- const userDataProfilesService = accessor.get(IUserDataProfilesService);
|
|
- const hostService = accessor.get(IHostService);
|
|
-
|
|
- const pick = await quickInputService.pick(
|
|
- userDataProfilesService.profiles.map(profile => ({
|
|
- label: profile.name,
|
|
- profile
|
|
- })),
|
|
- {
|
|
- title: localize('new window with profile', "New Window with Profile"),
|
|
- placeHolder: localize('pick profile', "Select Profile"),
|
|
- canPickMany: false
|
|
- });
|
|
- if (pick) {
|
|
- return hostService.openWindow({ remoteAuthority: null, forceProfile: pick.profile.name });
|
|
- }
|
|
- }
|
|
- });
|
|
- }
|
|
-
|
|
- private registerNewWindowAction(profile: IUserDataProfile): IDisposable {
|
|
- const disposables = new DisposableStore();
|
|
-
|
|
- const id = `workbench.action.openProfile.${profile.name.replace('/\s+/', '_')}`;
|
|
-
|
|
- disposables.add(registerAction2(class NewWindowAction extends Action2 {
|
|
-
|
|
- constructor() {
|
|
- super({
|
|
- id,
|
|
- title: localize2('openShort', "{0}", profile.name),
|
|
- metadata: {
|
|
- description: localize2('open profile', "Open New Window with {0} Profile", profile.name),
|
|
- },
|
|
- menu: {
|
|
- id: OpenProfileMenu,
|
|
- group: '0_profiles',
|
|
- when: HAS_PROFILES_CONTEXT
|
|
- }
|
|
- });
|
|
- }
|
|
-
|
|
- override run(accessor: ServicesAccessor): Promise<void> {
|
|
- const hostService = accessor.get(IHostService);
|
|
- return hostService.openWindow({ remoteAuthority: null, forceProfile: profile.name });
|
|
- }
|
|
- }));
|
|
-
|
|
- disposables.add(MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
|
- command: {
|
|
- id,
|
|
- category: PROFILES_CATEGORY,
|
|
- title: localize2('open', "Open {0} Profile", profile.name),
|
|
- precondition: HAS_PROFILES_CONTEXT
|
|
- },
|
|
- }));
|
|
-
|
|
- return disposables;
|
|
- }
|
|
-
|
|
- private registerSwitchProfileAction(): IDisposable {
|
|
- const that = this;
|
|
- return registerAction2(class SwitchProfileAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: `workbench.profiles.actions.switchProfile`,
|
|
- title: localize2('switchProfile', 'Switch Profile...'),
|
|
- category: PROFILES_CATEGORY,
|
|
- f1: true,
|
|
- });
|
|
- }
|
|
- async run(accessor: ServicesAccessor) {
|
|
- const quickInputService = accessor.get(IQuickInputService);
|
|
-
|
|
- const items: Array<IQuickPickItem & { profile: IUserDataProfile }> = [];
|
|
- for (const profile of that.userDataProfilesService.profiles) {
|
|
- items.push({
|
|
- id: profile.id,
|
|
- label: profile.id === that.userDataProfileService.currentProfile.id ? `$(check) ${profile.name}` : profile.name,
|
|
- profile,
|
|
- });
|
|
- }
|
|
-
|
|
- const result = await quickInputService.pick(items.sort((a, b) => a.profile.name.localeCompare(b.profile.name)), {
|
|
- placeHolder: localize('selectProfile', "Select Profile")
|
|
- });
|
|
- if (result) {
|
|
- await that.userDataProfileManagementService.switchProfile(result.profile);
|
|
- }
|
|
- }
|
|
- });
|
|
- }
|
|
-
|
|
- private registerManageProfilesAction(): IDisposable {
|
|
- const disposables = new DisposableStore();
|
|
- disposables.add(registerAction2(class ManageProfilesAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: `workbench.profiles.actions.manageProfiles`,
|
|
- title: {
|
|
- ...localize2('manage profiles', "Profiles"),
|
|
- mnemonicTitle: localize({ key: 'miOpenProfiles', comment: ['&& denotes a mnemonic'] }, "&&Profiles"),
|
|
- },
|
|
- menu: [
|
|
- {
|
|
- id: MenuId.GlobalActivity,
|
|
- group: '2_configuration',
|
|
- order: 1,
|
|
- when: HAS_PROFILES_CONTEXT.negate()
|
|
- },
|
|
- {
|
|
- id: MenuId.MenubarPreferencesMenu,
|
|
- group: '2_configuration',
|
|
- order: 1,
|
|
- when: HAS_PROFILES_CONTEXT.negate()
|
|
- },
|
|
- {
|
|
- id: ProfilesMenu,
|
|
- group: '1_manage',
|
|
- order: 1,
|
|
- },
|
|
- ]
|
|
- });
|
|
- }
|
|
- run(accessor: ServicesAccessor) {
|
|
- const editorGroupsService = accessor.get(IEditorGroupsService);
|
|
- const instantiationService = accessor.get(IInstantiationService);
|
|
- return editorGroupsService.activeGroup.openEditor(new UserDataProfilesEditorInput(instantiationService));
|
|
- }
|
|
- }));
|
|
- disposables.add(MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
|
- command: {
|
|
- id: 'workbench.profiles.actions.manageProfiles',
|
|
- category: Categories.Preferences,
|
|
- title: localize2('open profiles', "Open Profiles (UI)"),
|
|
- },
|
|
- }));
|
|
-
|
|
- return disposables;
|
|
- }
|
|
-
|
|
- private registerExportCurrentProfileAction(): IDisposable {
|
|
- const that = this;
|
|
- const disposables = new DisposableStore();
|
|
- const id = 'workbench.profiles.actions.exportProfile';
|
|
- disposables.add(registerAction2(class ExportProfileAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id,
|
|
- title: localize2('export profile', "Export Profile..."),
|
|
- category: PROFILES_CATEGORY,
|
|
- f1: true,
|
|
- });
|
|
- }
|
|
-
|
|
- async run() {
|
|
- const editor = await that.openProfilesEditor();
|
|
- editor?.selectProfile(that.userDataProfileService.currentProfile);
|
|
- }
|
|
- }));
|
|
- disposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarShare, {
|
|
- command: {
|
|
- id,
|
|
- title: localize2('export profile in share', "Export Profile ({0})...", that.userDataProfileService.currentProfile.name),
|
|
- },
|
|
- }));
|
|
- return disposables;
|
|
- }
|
|
-
|
|
-
|
|
- private registerCreateFromCurrentProfileAction(): void {
|
|
- const that = this;
|
|
- this._register(registerAction2(class CreateFromCurrentProfileAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: 'workbench.profiles.actions.createFromCurrentProfile',
|
|
- title: localize2('save profile as', "Save Current Profile As..."),
|
|
- category: PROFILES_CATEGORY,
|
|
- f1: true,
|
|
- });
|
|
- }
|
|
-
|
|
- async run() {
|
|
- const editor = await that.openProfilesEditor();
|
|
- editor?.createNewProfile(that.userDataProfileService.currentProfile);
|
|
- }
|
|
- }));
|
|
- }
|
|
-
|
|
- private registerNewProfileAction(): void {
|
|
- const that = this;
|
|
- this._register(registerAction2(class CreateProfileAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: 'workbench.profiles.actions.createProfile',
|
|
- title: localize2('create profile', "New Profile..."),
|
|
- category: PROFILES_CATEGORY,
|
|
- f1: true,
|
|
- menu: [
|
|
- {
|
|
- id: OpenProfileMenu,
|
|
- group: '1_manage_profiles',
|
|
- order: 1
|
|
- }
|
|
- ]
|
|
- });
|
|
- }
|
|
-
|
|
- async run(accessor: ServicesAccessor) {
|
|
- const editor = await that.openProfilesEditor();
|
|
- return editor?.createNewProfile();
|
|
- }
|
|
- }));
|
|
- }
|
|
-
|
|
- private registerDeleteProfileAction(): void {
|
|
- this._register(registerAction2(class DeleteProfileAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: 'workbench.profiles.actions.deleteProfile',
|
|
- title: localize2('delete profile', "Delete Profile..."),
|
|
- category: PROFILES_CATEGORY,
|
|
- f1: true,
|
|
- precondition: HAS_PROFILES_CONTEXT,
|
|
- });
|
|
- }
|
|
-
|
|
- async run(accessor: ServicesAccessor) {
|
|
- const quickInputService = accessor.get(IQuickInputService);
|
|
- const userDataProfileService = accessor.get(IUserDataProfileService);
|
|
- const userDataProfilesService = accessor.get(IUserDataProfilesService);
|
|
- const userDataProfileManagementService = accessor.get(IUserDataProfileManagementService);
|
|
- const notificationService = accessor.get(INotificationService);
|
|
-
|
|
- const profiles = userDataProfilesService.profiles.filter(p => !p.isDefault && !p.isTransient);
|
|
- if (profiles.length) {
|
|
- const picks = await quickInputService.pick(
|
|
- profiles.map(profile => ({
|
|
- label: profile.name,
|
|
- description: profile.id === userDataProfileService.currentProfile.id ? localize('current', "Current") : undefined,
|
|
- profile
|
|
- })),
|
|
- {
|
|
- title: localize('delete specific profile', "Delete Profile..."),
|
|
- placeHolder: localize('pick profile to delete', "Select Profiles to Delete"),
|
|
- canPickMany: true
|
|
- });
|
|
- if (picks) {
|
|
- try {
|
|
- await Promise.all(picks.map(pick => userDataProfileManagementService.removeProfile(pick.profile)));
|
|
- } catch (error) {
|
|
- notificationService.error(error);
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- }));
|
|
- }
|
|
-
|
|
- private registerHelpAction(): void {
|
|
- this._register(registerAction2(class HelpAction extends Action2 {
|
|
- constructor() {
|
|
- super({
|
|
- id: 'workbench.profiles.actions.help',
|
|
- title: PROFILES_TITLE,
|
|
- category: Categories.Help,
|
|
- menu: [{
|
|
- id: MenuId.CommandPalette,
|
|
- }],
|
|
- });
|
|
- }
|
|
- run(accessor: ServicesAccessor): unknown {
|
|
- return accessor.get(IOpenerService).open(URI.parse('https://aka.ms/vscode-profiles-help'));
|
|
- }
|
|
- }));
|
|
}
|
|
|
|
private async reportWorkspaceProfileInfo(): Promise<void> {
|
|
diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts
|
|
index 750087f2e72..ac4c7b4bf09 100644
|
|
--- a/src/vs/workbench/workbench.common.main.ts
|
|
+++ b/src/vs/workbench/workbench.common.main.ts
|
|
@@ -183,9 +183,6 @@ registerSingleton(IMcpManagementService, McpManagementService, InstantiationType
|
|
|
|
//#region --- workbench contributions
|
|
|
|
-// Telemetry
|
|
-import './contrib/telemetry/browser/telemetry.contribution.js';
|
|
-
|
|
// Preferences
|
|
import './contrib/preferences/browser/preferences.contribution.js';
|
|
import './contrib/preferences/browser/keybindingsEditorContribution.js';
|
|
@@ -247,11 +244,6 @@ import './contrib/scm/browser/scm.contribution.js';
|
|
|
|
// Debug
|
|
import './contrib/debug/browser/debug.contribution.js';
|
|
-import './contrib/debug/browser/debugEditorContribution.js';
|
|
-import './contrib/debug/browser/breakpointEditorContribution.js';
|
|
-import './contrib/debug/browser/callStackEditorContribution.js';
|
|
-import './contrib/debug/browser/repl.js';
|
|
-import './contrib/debug/browser/debugViewlet.js';
|
|
|
|
// Markers
|
|
import './contrib/markers/browser/markers.contribution.js';
|
|
@@ -285,7 +277,6 @@ import './contrib/externalUriOpener/common/externalUriOpener.contribution.js';
|
|
|
|
// Extensions Management
|
|
import './contrib/extensions/browser/extensions.contribution.js';
|
|
-import './contrib/extensions/browser/extensionsViewlet.js';
|
|
|
|
// Output View
|
|
import './contrib/output/browser/output.contribution.js';
|
|
@@ -417,8 +408,4 @@ import './contrib/inlineCompletions/browser/inlineCompletions.contribution.js';
|
|
// Drop or paste into
|
|
import './contrib/dropOrPasteInto/browser/dropOrPasteInto.contribution.js';
|
|
|
|
-// Edit Telemetry
|
|
-import './contrib/editTelemetry/browser/editTelemetry.contribution.js';
|
|
-
|
|
-
|
|
//#endregion
|