Skip to content

Commit

Permalink
Rebase against the upstream 4789314
Browse files Browse the repository at this point in the history
vscode-upstream-sha1: 4789314
  • Loading branch information
Eclipse Che Sync committed Jul 19, 2023
2 parents bce4ae6 + 4789314 commit 420d4a5
Show file tree
Hide file tree
Showing 14 changed files with 297 additions and 198 deletions.
1 change: 0 additions & 1 deletion code/build/lib/stylelint/vscode-known-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@
"--vscode-inlineChatInput-border",
"--vscode-inlineChatInput-focusBorder",
"--vscode-inlineChatInput-placeholderForeground",
"--vscode-inlineChatrDiff-removed",
"--vscode-input-background",
"--vscode-input-border",
"--vscode-input-foreground",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { IStringDictionary } from 'vs/base/common/collections';
import { CONTEXT_KEYBINDINGS_EDITOR } from 'vs/workbench/contrib/preferences/common/preferences';
import { DeprecatedExtensionsChecker } from 'vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker';
import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';

// Singletons
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService, InstantiationType.Eager /* Auto updates extensions */);
Expand Down Expand Up @@ -477,6 +478,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IDialogService private readonly dialogService: IDialogService,
@ICommandService private readonly commandService: ICommandService,
@IUserDataProfileService private readonly userDataProfileService: IUserDataProfileService,
) {
super();
const hasGalleryContext = CONTEXT_HAS_GALLERY.bindTo(contextKeyService);
Expand Down Expand Up @@ -520,22 +522,31 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi

// 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
}));
const getTitle = (title: string) => !this.userDataProfileService.currentProfile.isDefault && this.userDataProfileService.currentProfile.useDefaultFlags?.extensions
? `${title} (${localize('default profile', "Default Profile")})`
: title;
const registerOpenExtensionsActionDisposables = this._register(new DisposableStore());
const registerOpenExtensionsAction = () => {
registerOpenExtensionsActionDisposables.clear();
registerOpenExtensionsActionDisposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
command: {
id: VIEWLET_ID,
title: getTitle(localize({ key: 'miPreferencesExtensions', comment: ['&& denotes a mnemonic'] }, "&&Extensions"))
},
group: '2_configuration',
order: 3
}));
registerOpenExtensionsActionDisposables.add(MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
command: {
id: VIEWLET_ID,
title: getTitle(localize('showExtensions', "Extensions"))
},
group: '2_configuration',
order: 3
}));
};
registerOpenExtensionsAction();
this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => registerOpenExtensionsAction()));

this.registerExtensionAction({
id: 'workbench.extensions.action.installExtensions',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,37 +187,46 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
}

private registerSettingsActions() {
this._register(registerAction2(class extends Action2 {
constructor() {
super({
id: SETTINGS_COMMAND_OPEN_SETTINGS,
title: {
value: nls.localize('settings', "Settings"),
mnemonicTitle: nls.localize({ key: 'miOpenSettings', comment: ['&& denotes a mnemonic'] }, "&&Settings"),
original: 'Settings'
},
keybinding: {
weight: KeybindingWeight.WorkbenchContrib,
when: null,
primary: KeyMod.CtrlCmd | KeyCode.Comma,
},
menu: [{
id: MenuId.GlobalActivity,
group: '2_configuration',
order: 1
}, {
id: MenuId.MenubarPreferencesMenu,
group: '2_configuration',
order: 1
}],
});
}
run(accessor: ServicesAccessor, args: string | IOpenSettingsActionOptions) {
// args takes a string for backcompat
const opts = typeof args === 'string' ? { query: args } : sanitizeOpenSettingsArgs(args);
return accessor.get(IPreferencesService).openSettings(opts);
}
}));
const registerOpenSettingsActionDisposables = this._register(new DisposableStore());
const registerOpenSettingsAction = () => {
registerOpenSettingsActionDisposables.clear();
const getTitle = (title: string) => !this.userDataProfileService.currentProfile.isDefault && this.userDataProfileService.currentProfile.useDefaultFlags?.settings
? `${title} (${nls.localize('default profile', "Default Profile")})`
: title;
registerOpenSettingsActionDisposables.add(registerAction2(class extends Action2 {
constructor() {
super({
id: SETTINGS_COMMAND_OPEN_SETTINGS,
title: {
value: getTitle(nls.localize('settings', "Settings")),
mnemonicTitle: getTitle(nls.localize({ key: 'miOpenSettings', comment: ['&& denotes a mnemonic'] }, "&&Settings")),
original: 'Settings'
},
keybinding: {
weight: KeybindingWeight.WorkbenchContrib,
when: null,
primary: KeyMod.CtrlCmd | KeyCode.Comma,
},
menu: [{
id: MenuId.GlobalActivity,
group: '2_configuration',
order: 1
}, {
id: MenuId.MenubarPreferencesMenu,
group: '2_configuration',
order: 1
}],
});
}
run(accessor: ServicesAccessor, args: string | IOpenSettingsActionOptions) {
// args takes a string for backcompat
const opts = typeof args === 'string' ? { query: args } : sanitizeOpenSettingsArgs(args);
return accessor.get(IPreferencesService).openSettings(opts);
}
}));
};
registerOpenSettingsAction();
this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => registerOpenSettingsAction()));
registerAction2(class extends Action2 {
constructor() {
super({
Expand Down Expand Up @@ -296,13 +305,13 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
}
});

const registerOpenUserSettingsEditorFromJsonActionDisposables = this._register(new MutableDisposable());
const registerOpenUserSettingsEditorFromJsonActionDisposable = this._register(new MutableDisposable());
const openUserSettingsEditorWhen = ContextKeyExpr.and(
ContextKeyExpr.or(ResourceContextKey.Resource.isEqualTo(this.userDataProfileService.currentProfile.settingsResource.toString()),
ResourceContextKey.Resource.isEqualTo(this.userDataProfilesService.defaultProfile.settingsResource.toString())),
ContextKeyExpr.not('isInDiffEditor'));
const registerOpenUserSettingsEditorFromJsonAction = () => {
registerOpenUserSettingsEditorFromJsonActionDisposables.value = registerAction2(class extends Action2 {
registerOpenUserSettingsEditorFromJsonActionDisposable.value = registerAction2(class extends Action2 {
constructor() {
super({
id: '_workbench.openUserSettingsEditor',
Expand Down Expand Up @@ -806,49 +815,58 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
private registerKeybindingsActions() {
const that = this;
const category = { value: nls.localize('preferences', "Preferences"), original: 'Preferences' };
const id = 'workbench.action.openGlobalKeybindings';
this._register(registerAction2(class extends Action2 {
constructor() {
super({
id,
title: { value: nls.localize('openGlobalKeybindings', "Open Keyboard Shortcuts"), original: 'Open Keyboard Shortcuts' },
shortTitle: nls.localize('keyboardShortcuts', "Keyboard Shortcuts"),
category,
icon: preferencesOpenSettingsIcon,
keybinding: {
when: null,
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyCode.KeyS)
},
menu: [
{ id: MenuId.CommandPalette },
{
id: MenuId.EditorTitle,
when: ResourceContextKey.Resource.isEqualTo(that.userDataProfileService.currentProfile.keybindingsResource.toString()),
group: 'navigation',
order: 1,
const registerOpenGlobalKeybindingsActionDisposables = this._register(new DisposableStore());
const registerOpenGlobalKeybindingsAction = () => {
registerOpenGlobalKeybindingsActionDisposables.clear();
const id = 'workbench.action.openGlobalKeybindings';
const shortTitle = !that.userDataProfileService.currentProfile.isDefault && that.userDataProfileService.currentProfile.useDefaultFlags?.keybindings
? nls.localize('keyboardShortcutsFromDefault', "Keyboard Shortcuts ({0})", nls.localize('default profile', "Default Profile"))
: nls.localize('keyboardShortcuts', "Keyboard Shortcuts");
registerOpenGlobalKeybindingsActionDisposables.add(registerAction2(class extends Action2 {
constructor() {
super({
id,
title: { value: nls.localize('openGlobalKeybindings', "Open Keyboard Shortcuts"), original: 'Open Keyboard Shortcuts' },
shortTitle,
category,
icon: preferencesOpenSettingsIcon,
keybinding: {
when: null,
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyCode.KeyS)
},
{
id: MenuId.GlobalActivity,
group: '2_configuration',
order: 3
}
]
});
}
run(accessor: ServicesAccessor, args: string | undefined) {
const query = typeof args === 'string' ? args : undefined;
return accessor.get(IPreferencesService).openGlobalKeybindingSettings(false, { query });
}
}));
this._register(MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
command: {
id,
title: nls.localize('keyboardShortcuts', "Keyboard Shortcuts"),
},
group: '2_configuration',
order: 3
}));
menu: [
{ id: MenuId.CommandPalette },
{
id: MenuId.EditorTitle,
when: ResourceContextKey.Resource.isEqualTo(that.userDataProfileService.currentProfile.keybindingsResource.toString()),
group: 'navigation',
order: 1,
},
{
id: MenuId.GlobalActivity,
group: '2_configuration',
order: 3
}
]
});
}
run(accessor: ServicesAccessor, args: string | undefined) {
const query = typeof args === 'string' ? args : undefined;
return accessor.get(IPreferencesService).openGlobalKeybindingSettings(false, { query });
}
}));
registerOpenGlobalKeybindingsActionDisposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
command: {
id,
title: shortTitle,
},
group: '2_configuration',
order: 3
}));
};
registerOpenGlobalKeybindingsAction();
this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => registerOpenGlobalKeybindingsAction()));
registerAction2(class extends Action2 {
constructor() {
super({
Expand Down
Loading

0 comments on commit 420d4a5

Please sign in to comment.