Merge from vscode 2e5312cd61ff99c570299ecc122c52584265eda2

This commit is contained in:
ADS Merger
2020-04-23 02:50:35 +00:00
committed by Anthony Dresser
parent 3603f55d97
commit 7f1d8fc32f
659 changed files with 22709 additions and 12497 deletions

View File

@@ -46,7 +46,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { Emitter, Event } from 'vs/base/common/event';
import { MenuRegistry, MenuId, isIMenuItem } from 'vs/platform/actions/common/actions';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
const $ = DOM.$;
@@ -456,7 +456,6 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditorP
this.keybindingsListContainer = DOM.append(parent, $('.keybindings-list-container'));
this.keybindingsList = this._register(this.instantiationService.createInstance(WorkbenchList, 'KeybindingsEditor', this.keybindingsListContainer, new Delegate(), [new KeybindingItemRenderer(this, this.instantiationService)], {
identityProvider: { getId: (e: IListEntry) => e.id },
ariaLabel: localize('keybindingsLabel', "Keybindings"),
setRowLineHeight: false,
horizontalScrolling: false,
accessibilityProvider: new AccessibilityProvider(),
@@ -464,6 +463,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditorP
listBackground: editorBackground
}
})) as WorkbenchList<IListEntry>;
this._register(this.keybindingsList.onContextMenu(e => this.onContextMenu(e)));
this._register(this.keybindingsList.onDidChangeFocus(e => this.onFocusChange(e)));
this._register(this.keybindingsList.onDidFocus(() => {
@@ -1104,7 +1104,11 @@ class WhenColumn extends Column {
}
}
class AccessibilityProvider implements IAccessibilityProvider<IKeybindingItemEntry> {
class AccessibilityProvider implements IListAccessibilityProvider<IKeybindingItemEntry> {
getWidgetAriaLabel(): string {
return localize('keybindingsLabel', "Keybindings");
}
getAriaLabel(keybindingItemEntry: IKeybindingItemEntry): string {
let ariaLabel = localize('commandAriaLabel', "Command is {0}.", keybindingItemEntry.keybindingItem.commandLabel ? keybindingItemEntry.keybindingItem.commandLabel : keybindingItemEntry.keybindingItem.command);

View File

@@ -35,9 +35,12 @@ export class KeyboardLayoutPickerContribution extends Disposable implements IWor
let layout = this.keymapService.getCurrentKeyboardLayout();
if (layout) {
let layoutInfo = parseKeyboardLayoutDescription(layout);
const text = nls.localize('keyboardLayout', "Layout: {0}", layoutInfo.label);
this.pickerElement.value = this.statusbarService.addEntry(
{
text: nls.localize('keyboardLayout', "Layout: {0}", layoutInfo.label),
text,
ariaLabel: text,
command: KEYBOARD_LAYOUT_OPEN_PICKER
},
'status.workbench.keyboardLayout',
@@ -51,14 +54,18 @@ export class KeyboardLayoutPickerContribution extends Disposable implements IWor
let layoutInfo = parseKeyboardLayoutDescription(layout);
if (this.pickerElement.value) {
const text = nls.localize('keyboardLayout', "Layout: {0}", layoutInfo.label);
this.pickerElement.value.update({
text: nls.localize('keyboardLayout', "Layout: {0}", layoutInfo.label),
text,
ariaLabel: text,
command: KEYBOARD_LAYOUT_OPEN_PICKER
});
} else {
const text = nls.localize('keyboardLayout', "Layout: {0}", layoutInfo.label);
this.pickerElement.value = this.statusbarService.addEntry(
{
text: nls.localize('keyboardLayout', "Layout: {0}", layoutInfo.label),
text,
ariaLabel: text,
command: KEYBOARD_LAYOUT_OPEN_PICKER
},
'status.workbench.keyboardLayout',
@@ -176,4 +183,4 @@ export class KeyboardLayoutPickerAction extends Action {
}
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.create(KeyboardLayoutPickerAction, KeyboardLayoutPickerAction.ID, KeyboardLayoutPickerAction.LABEL, {}), 'Preferences: Change Keyboard Layout', nls.localize('preferences', "Preferences"));
registry.registerWorkbenchAction(SyncActionDescriptor.from(KeyboardLayoutPickerAction, {}), 'Preferences: Change Keyboard Layout', nls.localize('preferences', "Preferences"));

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.06065 3.85356L5.91421 6L5.2071 5.29289L6.49999 4H3.5C3.10218 4 2.72064 4.15804 2.43934 4.43934C2.15804 4.72065 2 5.10218 2 5.5C2 5.89783 2.15804 6.27936 2.43934 6.56066C2.72064 6.84197 3.10218 7 3.5 7H4V8H3.5C2.83696 8 2.20107 7.73661 1.73223 7.26777C1.26339 6.79893 1 6.16305 1 5.5C1 4.83696 1.26339 4.20108 1.73223 3.73224C2.20107 3.2634 2.83696 3 3.5 3H6.49999L6.49999 3H6.49996L6 2.50004V2.50001L5.2071 1.70711L5.91421 1L8.06065 3.14645L8.06065 3.85356ZM5 6.50003L5.91421 7.41424L6 7.32845V14H14V7H10V3H9.06065V2.73227L8.32838 2H11.2L11.5 2.1L14.9 5.6L15 6V14.5L14.5 15H5.5L5 14.5V9.00003V6.50003ZM11 3V6H13.9032L11 3Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 796 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.06065 3.85356L5.91421 6L5.2071 5.29289L6.49999 4H3.5C3.10218 4 2.72064 4.15804 2.43934 4.43934C2.15804 4.72065 2 5.10218 2 5.5C2 5.89783 2.15804 6.27936 2.43934 6.56066C2.72064 6.84197 3.10218 7 3.5 7H4V8H3.5C2.83696 8 2.20107 7.73661 1.73223 7.26777C1.26339 6.79893 1 6.16305 1 5.5C1 4.83696 1.26339 4.20108 1.73223 3.73224C2.20107 3.2634 2.83696 3 3.5 3H6.49999L6.49999 3H6.49996L6 2.50004V2.50001L5.2071 1.70711L5.91421 1L8.06065 3.14645L8.06065 3.85356ZM5 6.50003L5.91421 7.41424L6 7.32845V14H14V7H10V3H9.06065V2.73227L8.32838 2H11.2L11.5 2.1L14.9 5.6L15 6V14.5L14.5 15H5.5L5 14.5V9.00003V6.50003ZM11 3V6H13.9032L11 3Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 796 B

View File

@@ -72,6 +72,11 @@
opacity: 0.9;
}
.settings-editor > .settings-header > .settings-header-controls .last-synced-label {
padding-top: 7px;
opacity: 0.9;
}
.settings-editor .settings-tabs-widget > .monaco-action-bar .action-item .action-details {
opacity: 0.9;
}

View File

@@ -471,7 +471,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
id: SETTINGS_EDITOR_COMMAND_FILTER_MODIFIED,
title: { value: nls.localize('filterModifiedLabel', "Show modified settings"), original: 'Show modified settings' },
menu: {
id: MenuId.ExplorerContext,
id: MenuId.EditorTitle,
group: '1_filter',
order: 1,
when: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_JSON_EDITOR.toNegated())
@@ -491,7 +491,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
id: SETTINGS_EDITOR_COMMAND_FILTER_ONLINE,
title: { value: nls.localize('filterOnlineServicesLabel', "Show settings for online services"), original: 'Show settings for online services' },
menu: {
id: MenuId.ExplorerContext,
id: MenuId.EditorTitle,
group: '1_filter',
order: 2,
when: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_JSON_EDITOR.toNegated())

View File

@@ -609,7 +609,7 @@ class PreferencesRenderersController extends Disposable {
const message = getErrorMessage(err).trim();
if (message && message !== 'Error') {
// "Error" = any generic network error
this.telemetryService.publicLog('defaultSettings.searchError', { message });
this.telemetryService.publicLog('defaultSettings.searchError', { message }, true);
this.logService.info('Setting search error: ' + message);
}
return undefined;
@@ -1063,7 +1063,7 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
}
protected getAriaLabel(): string {
return nls.localize('preferencesAriaLabel', "Default preferences. Readonly editor.");
return nls.localize('preferencesAriaLabel', "Default preferences. Readonly.");
}
}

View File

@@ -519,7 +519,7 @@ export class SettingMatches {
const valueMatches = or(matchesPrefix, matchesContiguousSubString)(searchString, setting.value);
valueRanges = valueMatches ? valueMatches.map(match => this.toValueRange(setting, match)) : this.getRangesForWords(words, this.valueMatchingWords, [this.keyMatchingWords, this.descriptionMatchingWords]);
} else {
valueRanges = this.valuesMatcher ? this.valuesMatcher(searchString, setting) : [];
valueRanges = this.valuesMatcher(searchString, setting);
}
return [...descriptionRanges, ...keyRanges, ...valueRanges];

View File

@@ -57,6 +57,7 @@ import { IPreferencesService, ISearchResult, ISettingsEditorModel, ISettingsEdit
import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { Settings2EditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { fromNow } from 'vs/base/common/date';
import { Emitter } from 'vs/base/common/event';
function createGroupIterator(group: SettingsTreeGroupElement): Iterable<ITreeElement<SettingsTreeGroupChild>> {
return Iterable.map(group.children, g => {
@@ -75,6 +76,8 @@ interface IFocusEventFromScroll extends KeyboardEvent {
fromScroll: true;
}
const searchBoxLabel = localize('SearchSettings.AriaLabel', "Search settings");
const SETTINGS_AUTOSAVE_NOTIFIED_KEY = 'hasNotifiedOfSettingsAutosave';
const SETTINGS_EDITOR_STATE_KEY = 'settingsEditorState';
export class SettingsEditor2 extends BaseEditor {
@@ -413,6 +416,13 @@ export class SettingsEditor2 extends BaseEditor {
this.searchWidget.setValue(query.trim());
}
private updateInputAriaLabel(lastSyncedLabel: string) {
const label = lastSyncedLabel ?
`${searchBoxLabel}. ${lastSyncedLabel}` :
searchBoxLabel;
this.searchWidget.updateAriaLabel(label);
}
private createHeader(parent: HTMLElement): void {
this.headerContainer = DOM.append(parent, $('.settings-header'));
@@ -420,7 +430,6 @@ export class SettingsEditor2 extends BaseEditor {
const clearInputAction = new Action(SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Settings Search Input"), 'codicon-clear-all', false, () => { this.clearSearchResults(); return Promise.resolve(null); });
const searchBoxLabel = localize('SearchSettings.AriaLabel', "Search settings");
this.searchWidget = this._register(this.instantiationService.createInstance(SuggestEnabledInput, `${SettingsEditor2.ID}.searchbox`, searchContainer, {
triggerCharacters: ['@'],
provideResults: (query: string) => {
@@ -468,7 +477,8 @@ export class SettingsEditor2 extends BaseEditor {
this.settingsTargetsWidget.onDidTargetChange(target => this.onDidSettingsTargetChange(target));
if (syncAllowed(this.productService, this.configurationService)) {
this._register(this.instantiationService.createInstance(SyncControls, headerControlsContainer));
const syncControls = this._register(this.instantiationService.createInstance(SyncControls, headerControlsContainer));
this._register(syncControls.onDidChangeLastSyncedLabel(lastSyncedLabel => this.updateInputAriaLabel(lastSyncedLabel)));
}
this.controlsElement = DOM.append(searchContainer, DOM.$('.settings-clear-widget'));
@@ -1356,7 +1366,7 @@ export class SettingsEditor2 extends BaseEditor {
const message = getErrorMessage(err).trim();
if (message && message !== 'Error') {
// "Error" = any generic network error
this.telemetryService.publicLog('settingsEditor.searchError', { message });
this.telemetryService.publicLog('settingsEditor.searchError', { message }, true);
this.logService.info('Setting search error: ' + message);
}
return null;
@@ -1392,6 +1402,9 @@ class SyncControls extends Disposable {
private readonly lastSyncedLabel!: HTMLElement;
private readonly turnOnSyncButton!: Button;
private readonly _onDidChangeLastSyncedLabel = this._register(new Emitter<string>());
public readonly onDidChangeLastSyncedLabel = this._onDidChangeLastSyncedLabel.event;
constructor(
container: HTMLElement,
@ICommandService private readonly commandService: ICommandService,
@@ -1434,12 +1447,16 @@ class SyncControls extends Disposable {
private updateLastSyncedTime(): void {
const last = this.userDataSyncService.lastSyncTime;
let label: string;
if (typeof last === 'number') {
const d = fromNow(last, true);
this.lastSyncedLabel.textContent = localize('lastSyncedLabel', "Last synced: {0}", d);
label = localize('lastSyncedLabel', "Last synced: {0}", d);
} else {
this.lastSyncedLabel.textContent = '';
label = '';
}
this.lastSyncedLabel.textContent = label;
this._onDidChangeLastSyncedLabel.fire(label);
}
private update(): void {

View File

@@ -184,6 +184,11 @@ export const tocData: ITOCEntry = {
id: 'features/timeline',
label: localize('timeline', "Timeline"),
settings: ['timeline.*']
},
{
id: 'features/notebook',
label: localize('notebook', 'Notebook'),
settings: ['notebook.*']
}
]
},

View File

@@ -13,7 +13,7 @@ import { alert as ariaAlert } from 'vs/base/browser/ui/aria/aria';
import { Button } from 'vs/base/browser/ui/button/button';
import { Checkbox } from 'vs/base/browser/ui/checkbox/checkbox';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { CachedListVirtualDelegate, ListAriaRootRole } from 'vs/base/browser/ui/list/list';
import { CachedListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { DefaultStyleController } from 'vs/base/browser/ui/list/listWidget';
import { ISelectOptionItem, SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
@@ -50,7 +50,9 @@ import { SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/contrib/
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ISetting, ISettingsGroup, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
import { IUserDataSyncEnablementService, getDefaultIgnoredSettings } from 'vs/platform/userDataSync/common/userDataSync';
import { CodiconLabel } from 'vs/base/browser/ui/codiconLabel/codiconLabel';
import { getInvalidTypeError } from 'vs/workbench/services/preferences/common/preferencesValidation';
import { Codicon } from 'vs/base/common/codicons';
import { CodiconLabel } from 'vs/base/browser/ui/codicons/codiconLabel';
const $ = DOM.$;
@@ -228,6 +230,7 @@ interface ISettingEnumItemTemplate extends ISettingItemTemplate<number> {
interface ISettingComplexItemTemplate extends ISettingItemTemplate<void> {
button: Button;
validationErrorMessageElement: HTMLElement;
}
interface ISettingListItemTemplate extends ISettingItemTemplate<string[] | undefined> {
@@ -706,9 +709,13 @@ export class SettingComplexRenderer extends AbstractSettingRenderer implements I
buttonForeground: 'foreground'
}));
const validationErrorMessageElement = $('.setting-item-validation-message');
common.containerElement.appendChild(validationErrorMessageElement);
const template: ISettingComplexItemTemplate = {
...common,
button: openSettingsButton
button: openSettingsButton,
validationErrorMessageElement
};
this.addSettingElementFocusHandler(template);
@@ -720,8 +727,20 @@ export class SettingComplexRenderer extends AbstractSettingRenderer implements I
super.renderSettingElement(element, index, templateData);
}
protected renderValue(dataElement: SettingsTreeSettingElement, template: ISettingExcludeItemTemplate, onChange: (value: string) => void): void {
protected renderValue(dataElement: SettingsTreeSettingElement, template: ISettingComplexItemTemplate, onChange: (value: string) => void): void {
template.onChange = () => this._onDidOpenSettings.fire(dataElement.setting.key);
this.renderValidations(dataElement, template);
}
private renderValidations(dataElement: SettingsTreeSettingElement, template: ISettingComplexItemTemplate) {
const errMsg = getInvalidTypeError(dataElement.value, dataElement.setting.type);
if (errMsg) {
DOM.addClass(template.containerElement, 'invalid-input');
template.validationErrorMessageElement.innerText = errMsg;
return;
}
DOM.removeClass(template.containerElement, 'invalid-input');
}
}
@@ -1133,7 +1152,7 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
const deprecationWarningElement = DOM.append(container, $('.setting-item-deprecation-message'));
const toDispose = new DisposableStore();
const checkbox = new Checkbox({ actionClassName: 'codicon-check setting-value-checkbox', isChecked: true, title: '', inputActiveOptionBorder: undefined });
const checkbox = new Checkbox({ icon: Codicon.check, actionClassName: 'setting-value-checkbox', isChecked: true, title: '', inputActiveOptionBorder: undefined });
controlElement.appendChild(checkbox.domNode);
toDispose.add(checkbox);
toDispose.add(checkbox.onChange(() => {
@@ -1460,6 +1479,11 @@ class SettingsTreeDelegate extends CachedListVirtualDelegate<SettingsTreeGroupCh
}
if (element instanceof SettingsTreeSettingElement) {
const invalidTypeError = getInvalidTypeError(element.value, element.setting.type);
if (invalidTypeError) {
return SETTINGS_COMPLEX_TEMPLATE_ID;
}
if (element.valueType === SettingValueType.Boolean) {
return SETTINGS_BOOL_TEMPLATE_ID;
}
@@ -1534,13 +1558,23 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
renderers,
{
supportDynamicHeights: true,
ariaRole: ListAriaRootRole.FORM,
ariaLabel: localize('treeAriaLabel', "Settings"),
identityProvider: {
getId(e) {
return e.id;
}
},
accessibilityProvider: {
getWidgetRole() {
return 'form';
},
getAriaLabel() {
// TODO@roblourens https://github.com/microsoft/vscode/issues/95862
return '';
},
getWidgetAriaLabel() {
return localize('settings', "Settings");
}
},
styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id),
filter: instantiationService.createInstance(SettingsTreeFilter, viewState)
});

View File

@@ -5,7 +5,7 @@
import * as DOM from 'vs/base/browser/dom';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { DefaultStyleController, IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { DefaultStyleController, IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { IObjectTreeOptions, ObjectTree } from 'vs/base/browser/ui/tree/objectTree';
import { ITreeElement, ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/tree/tree';
import { Iterable } from 'vs/base/common/iterator';
@@ -155,7 +155,11 @@ export function createTOCIterator(model: TOCTreeModel | SettingsTreeGroupElement
});
}
class SettingsAccessibilityProvider implements IAccessibilityProvider<SettingsTreeGroupElement> {
class SettingsAccessibilityProvider implements IListAccessibilityProvider<SettingsTreeGroupElement> {
getWidgetAriaLabel(): string {
return localize('settingsTOC', "Settings Table of Contents");
}
getAriaLabel(element: SettingsTreeElement): string {
if (!element) {
return '';

View File

@@ -58,7 +58,9 @@ export class PreferencesContribution implements IWorkbenchContribution {
// install editor opening listener unless user has disabled this
if (!!this.configurationService.getValue(USE_SPLIT_JSON_SETTING)) {
this.editorOpeningListener = this.editorService.overrideOpenEditor((editor, options, group) => this.onEditorOpening(editor, options, group));
this.editorOpeningListener = this.editorService.overrideOpenEditor({
open: (editor, options, group) => this.onEditorOpening(editor, options, group)
});
}
}