Skip to content

Commit

Permalink
Rebase against the upstream a11a0d7
Browse files Browse the repository at this point in the history
vscode-upstream-sha1: a11a0d7
  • Loading branch information
Eclipse Che Sync committed Jun 26, 2024
2 parents 29f6668 + a11a0d7 commit 1b0e173
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 97 deletions.
52 changes: 25 additions & 27 deletions code/extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2103,38 +2103,36 @@ export class CommandCenter {
}
}

if (!opts.amend) {
// no changes, and the user has not configured to commit all in this case
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.all) {
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
// no changes, and the user has not configured to commit all in this case
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.all) {
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;

if (!suggestSmartCommit) {
return;
}

// prompt the user if we want to commit all or not
const message = l10n.t('There are no staged changes to commit.\n\nWould you like to stage all your changes and commit them directly?');
const yes = l10n.t('Yes');
const always = l10n.t('Always');
const never = l10n.t('Never');
const pick = await window.showWarningMessage(message, { modal: true }, yes, always, never);

if (pick === always) {
config.update('enableSmartCommit', true, true);
} else if (pick === never) {
config.update('suggestSmartCommit', false, true);
return;
} else if (pick !== yes) {
return; // do not commit on cancel
}
if (!suggestSmartCommit) {
return;
}

if (opts.all === undefined) {
opts = { ...opts, all: noStagedChanges };
} else if (!opts.all && noStagedChanges) {
opts = { ...opts, all: true };
// prompt the user if we want to commit all or not
const message = l10n.t('There are no staged changes to commit.\n\nWould you like to stage all your changes and commit them directly?');
const yes = l10n.t('Yes');
const always = l10n.t('Always');
const never = l10n.t('Never');
const pick = await window.showWarningMessage(message, { modal: true }, yes, always, never);

if (pick === always) {
config.update('enableSmartCommit', true, true);
} else if (pick === never) {
config.update('suggestSmartCommit', false, true);
return;
} else if (pick !== yes) {
return; // do not commit on cancel
}
}

if (opts.all === undefined) {
opts = { ...opts, all: noStagedChanges };
} else if (!opts.all && noStagedChanges) {
opts = { ...opts, all: true };
}
}

// enable signing of commits if configured
Expand Down
3 changes: 1 addition & 2 deletions code/src/vs/base/browser/trustedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { mainWindow } from 'vs/base/browser/window';
import { onUnexpectedError } from 'vs/base/common/errors';

export function createTrustedTypesPolicy<Options extends TrustedTypePolicyOptions>(
Expand All @@ -28,7 +27,7 @@ export function createTrustedTypesPolicy<Options extends TrustedTypePolicyOption
}
}
try {
return mainWindow.trustedTypes?.createPolicy(policyName, policyOptions);
return (globalThis as any).trustedTypes?.createPolicy(policyName, policyOptions);
} catch (err) {
onUnexpectedError(err);
return undefined;
Expand Down
3 changes: 2 additions & 1 deletion code/src/vs/platform/actions/browser/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ export class WorkbenchToolBar extends ToolBar {
if (action instanceof MenuItemAction && action.menuKeybinding) {
primaryActions.push(action.menuKeybinding);
} else if (!(action instanceof SubmenuItemAction || action instanceof ToggleMenuAction)) {
primaryActions.push(createConfigureKeybindingAction(action.id, undefined, this._commandService, this._keybindingService));
const isDisabled = action.id.startsWith('statusbaraction'); // We can't support keybinding configuration for scm statusbar actions
primaryActions.push(createConfigureKeybindingAction(this._commandService, this._keybindingService, action.id, undefined, !isDisabled));
}

// -- Hide Actions --
Expand Down
5 changes: 3 additions & 2 deletions code/src/vs/platform/actions/common/menuService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class MenuInfo {
const menuHide = createMenuHide(this._id, isMenuItem ? item.command : item, this._hiddenStates);
if (isMenuItem) {
// MenuItemAction
const menuKeybinding = createConfigureKeybindingAction(item.command.id, item.when, this._commandService, this._keybindingService);
const menuKeybinding = createConfigureKeybindingAction(this._commandService, this._keybindingService, item.command.id, item.when);
(activeActions ??= []).push(new MenuItemAction(item.command, item.alt, options, menuHide, menuKeybinding, this._contextKeyService, this._commandService));
} else {
// SubmenuItemAction
Expand Down Expand Up @@ -442,10 +442,11 @@ function createMenuHide(menu: MenuId, command: ICommandAction | ISubmenuItem, st
};
}

export function createConfigureKeybindingAction(commandId: string, when: ContextKeyExpression | undefined = undefined, commandService: ICommandService, keybindingService: IKeybindingService): IAction {
export function createConfigureKeybindingAction(commandService: ICommandService, keybindingService: IKeybindingService, commandId: string, when: ContextKeyExpression | undefined = undefined, enabled = true): IAction {
return toAction({
id: `configureKeybinding/${commandId}`,
label: localize('configure keybinding', "Configure Keybinding"),
enabled,
run() {
// Only set the when clause when there is no keybinding
// It is possible that the action and the keybinding have different when clauses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,15 @@ class MenuCopier implements IDisposable {
updateMenu();
}
});
const listener2 = configService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(InlineChatConfigKeys.ExpTextButtons)) {
updateMenu();
}
});

this.dispose = () => {
listener.dispose();
listener2.dispose();
store.dispose();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ export interface IInlineChatWidgetConstructionOptions {
*/
statusMenuId: MenuId | { menu: MenuId; options: IWorkbenchButtonBarOptions };

/**
* The men that rendered in the lower right corner, use for feedback
*/
feedbackMenuId?: MenuId;

/**
* The options for the chat widget
*/
Expand Down Expand Up @@ -97,9 +92,9 @@ export class InlineChatWidget {
h('div.accessibleViewer@accessibleViewer'),
h('div.status@status', [
h('div.label.info.hidden@infoLabel'),
h('div.actions.hidden@statusToolbar'),
h('div.actions.text-style.hidden@toolbar1'),
h('div.actions.button-style.hidden@toolbar2'),
h('div.label.status.hidden@statusLabel'),
h('div.actions.hidden@feedbackToolbar'),
]),
]
);
Expand Down Expand Up @@ -200,46 +195,34 @@ export class InlineChatWidget {

const statusMenuId = options.statusMenuId instanceof MenuId ? options.statusMenuId : options.statusMenuId.menu;

if (this._configurationService.getValue(InlineChatConfigKeys.ExpTextButtons)) {
// TEXT-ONLY bar
const statusToolbarMenu = scopedInstaService.createInstance(MenuWorkbenchToolBar, this._elements.statusToolbar, statusMenuId, {
hiddenItemStrategy: HiddenItemStrategy.NoHide,
telemetrySource: options.chatWidgetViewOptions?.menus?.telemetrySource,
actionViewItemProvider: action => action instanceof MenuItemAction ? this._instantiationService.createInstance(TextOnlyMenuEntryActionViewItem, action, { conversational: true }) : undefined,
toolbarOptions: { primaryGroup: '0_main' },
menuOptions: { renderShortTitle: true },
label: true,
icon: false
});
this._store.add(statusToolbarMenu.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
this._store.add(statusToolbarMenu);

} else {
// BUTTON bar
const statusMenuOptions = options.statusMenuId instanceof MenuId ? undefined : options.statusMenuId.options;
const statusButtonBar = scopedInstaService.createInstance(MenuWorkbenchButtonBar, this._elements.statusToolbar, statusMenuId, {
toolbarOptions: { primaryGroup: '0_main' },
telemetrySource: options.chatWidgetViewOptions?.menus?.telemetrySource,
menuOptions: { renderShortTitle: true },
...statusMenuOptions,
});
this._store.add(statusButtonBar.onDidChange(() => this._onDidChangeHeight.fire()));
this._store.add(statusButtonBar);
}

const workbenchToolbarOptions = {
// TEXT-ONLY bar
const statusToolbarMenu = scopedInstaService.createInstance(MenuWorkbenchToolBar, this._elements.toolbar1, statusMenuId, {
hiddenItemStrategy: HiddenItemStrategy.NoHide,
toolbarOptions: {
primaryGroup: () => true,
useSeparatorsInPrimaryActions: true
}
};
telemetrySource: options.chatWidgetViewOptions?.menus?.telemetrySource,
actionViewItemProvider: action => action instanceof MenuItemAction ? this._instantiationService.createInstance(TextOnlyMenuEntryActionViewItem, action, { conversational: true }) : undefined,
toolbarOptions: { primaryGroup: '0_main' },
menuOptions: { renderShortTitle: true },
label: true,
icon: false
});
this._store.add(statusToolbarMenu.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
this._store.add(statusToolbarMenu);

// BUTTON bar
const statusMenuOptions = options.statusMenuId instanceof MenuId ? undefined : options.statusMenuId.options;
const statusButtonBar = scopedInstaService.createInstance(MenuWorkbenchButtonBar, this._elements.toolbar2, statusMenuId, {
toolbarOptions: { primaryGroup: '0_main' },
telemetrySource: options.chatWidgetViewOptions?.menus?.telemetrySource,
menuOptions: { renderShortTitle: true },
...statusMenuOptions,
});
this._store.add(statusButtonBar.onDidChange(() => this._onDidChangeHeight.fire()));
this._store.add(statusButtonBar);

const toggleToolbar = () => this._elements.status.classList.toggle('text', this._configurationService.getValue(InlineChatConfigKeys.ExpTextButtons));
this._store.add(this._configurationService.onDidChangeConfiguration(e => e.affectsConfiguration(InlineChatConfigKeys.ExpTextButtons) && toggleToolbar()));
toggleToolbar();

if (options.feedbackMenuId) {
const feedbackToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.feedbackToolbar, options.feedbackMenuId, { ...workbenchToolbarOptions, hiddenItemStrategy: HiddenItemStrategy.Ignore });
this._store.add(feedbackToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
this._store.add(feedbackToolbar);
}

this._store.add(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(AccessibilityVerbositySettingId.InlineChat)) {
Expand Down Expand Up @@ -402,8 +385,8 @@ export class InlineChatWidget {

updateToolbar(show: boolean) {
this._elements.root.classList.toggle('toolbar', show);
this._elements.statusToolbar.classList.toggle('hidden', !show);
this._elements.feedbackToolbar.classList.toggle('hidden', !show);
this._elements.toolbar1.classList.toggle('hidden', !show);
this._elements.toolbar2.classList.toggle('hidden', !show);
this._elements.status.classList.toggle('actions', show);
this._elements.infoLabel.classList.toggle('hidden', show);
this._onDidChangeHeight.fire();
Expand Down Expand Up @@ -533,8 +516,8 @@ export class InlineChatWidget {

reset(this._elements.statusLabel);
this._elements.statusLabel.classList.toggle('hidden', true);
this._elements.statusToolbar.classList.add('hidden');
this._elements.feedbackToolbar.classList.add('hidden');
this._elements.toolbar1.classList.add('hidden');
this._elements.toolbar2.classList.add('hidden');
this.updateInfo('');

this.chatWidget.setModel(this._defaultChatModel, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
}

.monaco-workbench .inline-chat .chat-widget .interactive-session .interactive-list .interactive-item-container.minimal > .header {
top: 5px;
right: 10px;
}

Expand Down Expand Up @@ -89,7 +90,8 @@
overflow: hidden;
color: var(--vscode-descriptionForeground);
font-size: 11px;
display: inline-flex;
display: flex;
white-space: nowrap;
}

.monaco-workbench .inline-chat .status .label.info {
Expand All @@ -114,7 +116,7 @@
}

.monaco-workbench .inline-chat .status .label > .codicon {
padding: 0 5px;
padding: 0 3px;
font-size: 12px;
line-height: 18px;
}
Expand Down Expand Up @@ -185,6 +187,24 @@
}
}

.monaco-workbench .inline-chat .status {
.actions.text-style {
display: none;
}
.actions.button-style {
display: inherit;
}
}

.monaco-workbench .inline-chat .status.text {
.actions.text-style {
display: inherit;
}
.actions.button-style {
display: none;
}
}

.monaco-workbench .inline-chat .status .actions > .monaco-button,
.monaco-workbench .inline-chat .status .actions > .monaco-button-dropdown {
margin-right: 4px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
padding: 0;
}

.monaco-workbench .inline-chat-content-widget.interactive-session .interactive-list {
display: none;
}

.monaco-workbench .inline-chat-content-widget.interactive-session .toolbar {
display: none;
padding-top: 4px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
],
},
[InlineChatConfigKeys.ExpTextButtons]: {
description: localize('txtButtons', "Whether to use textual buttons (Requires restart)."),
description: localize('txtButtons', "Whether to use textual buttons."),
default: false,
type: 'boolean',
tags: ['experimental']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';

export class CellComments extends CellContentPart {
private readonly _commentThreadWidget = new MutableDisposable<CommentThreadWidget<ICellRange>>;
private readonly _commentThreadWidget: MutableDisposable<CommentThreadWidget<ICellRange>>;
private currentElement: CodeCellViewModel | undefined;
private readonly _commentThreadDisposables = this._register(new DisposableStore());

constructor(
private readonly notebookEditor: INotebookEditorDelegate,
private readonly container: HTMLElement,

@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IThemeService private readonly themeService: IThemeService,
@ICommentService private readonly commentService: ICommentService,
Expand All @@ -37,6 +36,8 @@ export class CellComments extends CellContentPart {
super();
this.container.classList.add('review-widget');

this._register(this._commentThreadWidget = new MutableDisposable<CommentThreadWidget<ICellRange>>());

this._register(this.themeService.onDidColorThemeChange(this._applyTheme, this));
// TODO @rebornix onDidChangeLayout (font change)
// this._register(this.notebookEditor.onDidchangeLa)
Expand Down Expand Up @@ -108,7 +109,7 @@ export class CellComments extends CellContentPart {
if (this._commentThreadWidget.value) {
if (!info) {
this._commentThreadDisposables.clear();
this._commentThreadWidget.dispose();
this._commentThreadWidget.value = undefined;
this.currentElement.commentHeight = 0;
return;
}
Expand Down Expand Up @@ -154,7 +155,6 @@ export class CellComments extends CellContentPart {

override didRenderCell(element: ICellViewModel): void {
if (element.cellKind === CellKind.Code) {
this.currentElement = element as CodeCellViewModel;
this.initialize(element);
this._bindListeners();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,10 @@ export class SettingsEditor2 extends EditorPane {
this.createTOC(this.tocTreeContainer);
this.createSettingsTree(this.settingsTreeContainer);

this.splitView = new SplitView(this.bodyContainer, {
this.splitView = this._register(new SplitView(this.bodyContainer, {
orientation: Orientation.HORIZONTAL,
proportionalLayout: true
});
}));
const startingWidth = this.storageService.getNumber('settingsEditor2.splitViewWidth', StorageScope.PROFILE, SettingsEditor2.TOC_RESET_WIDTH);
this.splitView.addView({
onDidChange: Event.None,
Expand Down Expand Up @@ -914,7 +914,7 @@ export class SettingsEditor2 extends EditorPane {
}

private createSettingsTree(container: HTMLElement): void {
this.settingRenderers = this.instantiationService.createInstance(SettingTreeRenderers);
this.settingRenderers = this._register(this.instantiationService.createInstance(SettingTreeRenderers));
this._register(this.settingRenderers.onDidChangeSetting(e => this.onDidChangeSetting(e.key, e.value, e.type, e.manualReset, e.scope)));
this._register(this.settingRenderers.onDidOpenSettings(settingKey => {
this.openSettingsFile({ revealSetting: { key: settingKey, edit: true } });
Expand Down
Loading

0 comments on commit 1b0e173

Please sign in to comment.