Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)

* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c

* remove files we don't want

* fix hygiene

* update distro

* update distro

* fix hygiene

* fix strict nulls

* distro

* distro

* fix tests

* fix tests

* add another edit

* fix viewlet icon

* fix azure dialog

* fix some padding

* fix more padding issues
This commit is contained in:
Anthony Dresser
2019-12-04 19:28:22 -08:00
committed by GitHub
parent a8818ab0df
commit f5ce7fb2a5
1507 changed files with 42813 additions and 27370 deletions

View File

@@ -82,7 +82,7 @@ export class KeybindingsSearchWidget extends SearchWidget {
stopRecordingKeys(): void {
this._reset();
this.recordDisposables.dispose();
this.recordDisposables.clear();
}
setInputValue(value: string): void {
@@ -164,7 +164,7 @@ export class DefineKeybindingWidget extends Widget {
readonly onShowExistingKeybidings: Event<string | null> = this._onShowExistingKeybindings.event;
constructor(
parent: HTMLElement,
parent: HTMLElement | null,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IThemeService private readonly themeService: IThemeService
) {

View File

@@ -34,7 +34,7 @@ import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector }
import { IContextKeyService, IContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { StandardKeyboardEvent, IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { listHighlightForeground, badgeBackground, contrastBorder, badgeForeground, listActiveSelectionForeground, listInactiveSelectionForeground, listHoverForeground, listFocusForeground } from 'vs/platform/theme/common/colorRegistry';
import { listHighlightForeground, badgeBackground, contrastBorder, badgeForeground, listActiveSelectionForeground, listInactiveSelectionForeground, listHoverForeground, listFocusForeground, editorBackground } from 'vs/platform/theme/common/colorRegistry';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions';
import { WorkbenchList } from 'vs/platform/list/browser/listService';
@@ -65,22 +65,22 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private _onLayout: Emitter<void> = this._register(new Emitter<void>());
readonly onLayout: Event<void> = this._onLayout.event;
private keybindingsEditorModel: KeybindingsEditorModel;
private keybindingsEditorModel: KeybindingsEditorModel | null = null;
private headerContainer: HTMLElement;
private actionsContainer: HTMLElement;
private searchWidget: KeybindingsSearchWidget;
private headerContainer!: HTMLElement;
private actionsContainer!: HTMLElement;
private searchWidget!: KeybindingsSearchWidget;
private overlayContainer: HTMLElement;
private defineKeybindingWidget: DefineKeybindingWidget;
private overlayContainer!: HTMLElement;
private defineKeybindingWidget!: DefineKeybindingWidget;
private columnItems: ColumnItem[] = [];
private keybindingsListContainer: HTMLElement;
private unAssignedKeybindingItemToRevealAndFocus: IKeybindingItemEntry | null;
private listEntries: IListEntry[];
private keybindingsList: WorkbenchList<IListEntry>;
private keybindingsListContainer!: HTMLElement;
private unAssignedKeybindingItemToRevealAndFocus: IKeybindingItemEntry | null = null;
private listEntries: IListEntry[] = [];
private keybindingsList!: WorkbenchList<IListEntry>;
private dimension: DOM.Dimension;
private dimension: DOM.Dimension | null = null;
private delayedFiltering: Delayer<void>;
private latestEmptyFilters: string[] = [];
private delayedFilterLogging: Delayer<void>;
@@ -88,11 +88,10 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private keybindingFocusContextKey: IContextKey<boolean>;
private searchFocusContextKey: IContextKey<boolean>;
private actionBar: ActionBar;
private sortByPrecedenceAction: Action;
private recordKeysAction: Action;
private readonly sortByPrecedenceAction: Action;
private readonly recordKeysAction: Action;
private ariaLabelElement: HTMLElement;
private ariaLabelElement!: HTMLElement;
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@@ -115,6 +114,16 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.searchFocusContextKey = CONTEXT_KEYBINDINGS_SEARCH_FOCUS.bindTo(this.contextKeyService);
this.keybindingFocusContextKey = CONTEXT_KEYBINDING_FOCUS.bindTo(this.contextKeyService);
this.delayedFilterLogging = new Delayer<void>(1000);
const recordKeysActionKeybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS);
const recordKeysActionLabel = localize('recordKeysLabel', "Record Keys");
this.recordKeysAction = new Action(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS, recordKeysActionKeybinding ? localize('recordKeysLabelWithKeybinding', "{0} ({1})", recordKeysActionLabel, recordKeysActionKeybinding.getLabel()) : recordKeysActionLabel, 'codicon-record-keys');
this.recordKeysAction.checked = false;
const sortByPrecedenceActionKeybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_SORTBY_PRECEDENCE);
const sortByPrecedenceActionLabel = localize('sortByPrecedeneLabel', "Sort by Precedence");
this.sortByPrecedenceAction = new Action('keybindings.editor.sortByPrecedence', sortByPrecedenceActionKeybinding ? localize('sortByPrecedeneLabelWithKeybinding', "{0} ({1})", sortByPrecedenceActionLabel, sortByPrecedenceActionKeybinding.getLabel()) : sortByPrecedenceActionLabel, 'codicon-sort-precedence');
this.sortByPrecedenceAction.checked = false;
}
createEditor(parent: HTMLElement): void {
@@ -298,7 +307,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.overlayContainer.style.position = 'absolute';
this.overlayContainer.style.zIndex = '10';
this.defineKeybindingWidget = this._register(this.instantiationService.createInstance(DefineKeybindingWidget, this.overlayContainer));
this._register(this.defineKeybindingWidget.onDidChange(keybindingStr => this.defineKeybindingWidget.printExisting(this.keybindingsEditorModel.fetch(`"${keybindingStr}"`).length)));
this._register(this.defineKeybindingWidget.onDidChange(keybindingStr => this.defineKeybindingWidget.printExisting(this.keybindingsEditorModel!.fetch(`"${keybindingStr}"`).length)));
this._register(this.defineKeybindingWidget.onShowExistingKeybidings(keybindingStr => this.searchWidget.setValue(`"${keybindingStr}"`)));
this.hideOverlayContainer();
}
@@ -337,10 +346,6 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.actionsContainer = DOM.append(searchContainer, DOM.$('.keybindings-search-actions-container'));
const recordingBadge = this.createRecordingBadge(this.actionsContainer);
const sortByPrecedenceActionKeybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_SORTBY_PRECEDENCE);
const sortByPrecedenceActionLabel = localize('sortByPrecedeneLabel', "Sort by Precedence");
this.sortByPrecedenceAction = new Action('keybindings.editor.sortByPrecedence', sortByPrecedenceActionKeybinding ? localize('sortByPrecedeneLabelWithKeybinding', "{0} ({1})", sortByPrecedenceActionLabel, sortByPrecedenceActionKeybinding.getLabel()) : sortByPrecedenceActionLabel, 'codicon-sort-precedence');
this.sortByPrecedenceAction.checked = false;
this._register(this.sortByPrecedenceAction.onDidChange(e => {
if (e.checked !== undefined) {
this.renderKeybindingsEntries(false);
@@ -348,10 +353,6 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.updateSearchOptions();
}));
const recordKeysActionKeybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS);
const recordKeysActionLabel = localize('recordKeysLabel', "Record Keys");
this.recordKeysAction = new Action(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS, recordKeysActionKeybinding ? localize('recordKeysLabelWithKeybinding', "{0} ({1})", recordKeysActionLabel, recordKeysActionKeybinding.getLabel()) : recordKeysActionLabel, 'codicon-record-keys');
this.recordKeysAction.checked = false;
this._register(this.recordKeysAction.onDidChange(e => {
if (e.checked !== undefined) {
DOM.toggleClass(recordingBadge, 'disabled', !e.checked);
@@ -370,7 +371,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
}));
this.actionBar = this._register(new ActionBar(this.actionsContainer, {
const actionBar = this._register(new ActionBar(this.actionsContainer, {
animated: false,
actionViewItemProvider: (action: Action) => {
if (action.id === this.sortByPrecedenceAction.id) {
@@ -383,7 +384,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
}));
this.actionBar.push([this.recordKeysAction, this.sortByPrecedenceAction, clearInputAction], { label: false, icon: true });
actionBar.push([this.recordKeysAction, this.sortByPrecedenceAction, clearInputAction], { label: false, icon: true });
}
private updateSearchOptions(): void {
@@ -456,7 +457,10 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
identityProvider: { getId: (e: IListEntry) => e.id },
ariaLabel: localize('keybindingsLabel', "Keybindings"),
setRowLineHeight: false,
horizontalScrolling: false
horizontalScrolling: false,
overrideStyles: {
listBackground: editorBackground
}
}));
this._register(this.keybindingsList.onContextMenu(e => this.onContextMenu(e)));
this._register(this.keybindingsList.onFocusChange(e => this.onFocusChange(e)));
@@ -563,6 +567,9 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
private layoutKeybindingsList(): void {
if (!this.dimension) {
return;
}
let width = this.dimension.width - 27;
for (const columnItem of this.columnItems) {
if (columnItem.width && !columnItem.proportion) {
@@ -855,7 +862,7 @@ abstract class Column extends Disposable {
class ActionsColumn extends Column {
private actionBar: ActionBar;
private readonly actionBar: ActionBar;
readonly element: HTMLElement;
constructor(
@@ -864,13 +871,8 @@ class ActionsColumn extends Column {
@IKeybindingService private keybindingsService: IKeybindingService
) {
super(keybindingsEditor);
this.element = this.create(parent);
}
create(parent: HTMLElement): HTMLElement {
const actionsContainer = DOM.append(parent, $('.column.actions', { id: 'actions_' + ++Column.COUNTER }));
this.actionBar = new ActionBar(actionsContainer, { animated: false });
return actionsContainer;
this.element = DOM.append(parent, $('.column.actions', { id: 'actions_' + ++Column.COUNTER }));
this.actionBar = new ActionBar(this.element, { animated: false });
}
render(keybindingItemEntry: IKeybindingItemEntry): void {
@@ -914,7 +916,7 @@ class ActionsColumn extends Column {
class CommandColumn extends Column {
private commandColumn: HTMLElement;
private readonly commandColumn: HTMLElement;
readonly element: HTMLElement;
constructor(
@@ -922,12 +924,7 @@ class CommandColumn extends Column {
keybindingsEditor: IKeybindingsEditor,
) {
super(keybindingsEditor);
this.element = this.create(parent);
}
private create(parent: HTMLElement): HTMLElement {
this.commandColumn = DOM.append(parent, $('.column.command', { id: 'command_' + ++Column.COUNTER }));
return this.commandColumn;
this.element = this.commandColumn = DOM.append(parent, $('.column.command', { id: 'command_' + ++Column.COUNTER }));
}
render(keybindingItemEntry: IKeybindingItemEntry): void {
@@ -962,7 +959,7 @@ class CommandColumn extends Column {
class KeybindingColumn extends Column {
private keybindingLabel: HTMLElement;
private readonly keybindingLabel: HTMLElement;
readonly element: HTMLElement;
constructor(
@@ -970,13 +967,9 @@ class KeybindingColumn extends Column {
keybindingsEditor: IKeybindingsEditor,
) {
super(keybindingsEditor);
this.element = this.create(parent);
}
private create(parent: HTMLElement): HTMLElement {
const column = DOM.append(parent, $('.column.keybinding', { id: 'keybinding_' + ++Column.COUNTER }));
this.keybindingLabel = DOM.append(column, $('div.keybinding-label'));
return column;
this.element = DOM.append(parent, $('.column.keybinding', { id: 'keybinding_' + ++Column.COUNTER }));
this.keybindingLabel = DOM.append(this.element, $('div.keybinding-label'));
}
render(keybindingItemEntry: IKeybindingItemEntry): void {
@@ -994,7 +987,7 @@ class KeybindingColumn extends Column {
class SourceColumn extends Column {
private sourceColumn: HTMLElement;
private readonly sourceColumn: HTMLElement;
readonly element: HTMLElement;
constructor(
@@ -1002,12 +995,7 @@ class SourceColumn extends Column {
keybindingsEditor: IKeybindingsEditor,
) {
super(keybindingsEditor);
this.element = this.create(parent);
}
create(parent: HTMLElement): HTMLElement {
this.sourceColumn = DOM.append(parent, $('.column.source', { id: 'source_' + ++Column.COUNTER }));
return this.sourceColumn;
this.element = this.sourceColumn = DOM.append(parent, $('.column.source', { id: 'source_' + ++Column.COUNTER }));
}
render(keybindingItemEntry: IKeybindingItemEntry): void {
@@ -1024,8 +1012,8 @@ class SourceColumn extends Column {
class WhenColumn extends Column {
readonly element: HTMLElement;
private whenLabel: HTMLElement;
private whenInput: InputBox;
private readonly whenLabel: HTMLElement;
private readonly whenInput: InputBox;
private readonly renderDisposables = this._register(new DisposableStore());
private _onDidAccept: Emitter<void> = this._register(new Emitter<void>());
@@ -1041,14 +1029,11 @@ class WhenColumn extends Column {
@IThemeService private readonly themeService: IThemeService
) {
super(keybindingsEditor);
this.element = this.create(parent);
}
private create(parent: HTMLElement): HTMLElement {
const column = DOM.append(parent, $('.column.when', { id: 'when_' + ++Column.COUNTER }));
this.element = DOM.append(parent, $('.column.when', { id: 'when_' + ++Column.COUNTER }));
this.whenLabel = DOM.append(column, $('div.when-label'));
this.whenInput = new InputBox(column, this.contextViewService, {
this.whenLabel = DOM.append(this.element, $('div.when-label'));
this.whenInput = new InputBox(this.element, this.contextViewService, {
validationOptions: {
validation: (value) => {
try {
@@ -1068,8 +1053,6 @@ class WhenColumn extends Column {
this._register(attachInputBoxStyler(this.whenInput, this.themeService));
this._register(DOM.addStandardDisposableListener(this.whenInput.inputElement, DOM.EventType.KEY_DOWN, e => this.onInputKeyDown(e)));
this._register(DOM.addDisposableListener(this.whenInput.inputElement, DOM.EventType.BLUR, () => this.cancelEditing()));
return column;
}
private onInputKeyDown(e: IKeyboardEvent): void {
@@ -1151,7 +1134,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
collector.addRule(`.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list:focus .monaco-list-row.selected > .column .monaco-keybinding-key { color: ${listActiveSelectionForegroundColor}; }`);
}
const listInactiveFocusAndSelectionForegroundColor = theme.getColor(listInactiveSelectionForeground);
if (listActiveSelectionForegroundColor) {
if (listInactiveFocusAndSelectionForegroundColor) {
collector.addRule(`.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list .monaco-list-row.selected > .column .monaco-keybinding-key { color: ${listInactiveFocusAndSelectionForegroundColor}; }`);
}
const listHoverForegroundColor = theme.getColor(listHoverForeground);

View File

@@ -14,7 +14,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { registerEditorContribution, ServicesAccessor, registerEditorCommand, EditorCommand } from 'vs/editor/browser/editorExtensions';
import { ICodeEditor, IActiveCodeEditor } from 'vs/editor/browser/editorBrowser';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2';
import { SmartSnippetInserter } from 'vs/workbench/contrib/preferences/common/smartSnippetInserter';
import { DefineKeybindingOverlayWidget } from 'vs/workbench/contrib/preferences/browser/keybindingWidgets';
@@ -30,6 +30,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
import { KeybindingParser } from 'vs/base/common/keybindingParser';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { equals } from 'vs/base/common/arrays';
import { assertIsDefined } from 'vs/base/common/types';
const NLS_LAUNCH_MESSAGE = nls.localize('defineKeybinding.start', "Define Keybinding");
const NLS_KB_LAYOUT_ERROR_MESSAGE = nls.localize('defineKeybinding.kbLayoutErrorMessage', "You won't be able to produce this key combination under your current keyboard layout.");
@@ -164,14 +165,14 @@ export class KeybindingEditorDecorationsRenderer extends Disposable {
private _dec: string[] = [];
constructor(
private _editor: IActiveCodeEditor,
private _editor: ICodeEditor,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
) {
super();
this._updateDecorations = this._register(new RunOnceScheduler(() => this._updateDecorationsNow(), 500));
const model = this._editor.getModel();
const model = assertIsDefined(this._editor.getModel());
this._register(model.onDidChangeContent(() => this._updateDecorations.schedule()));
this._register(this._keybindingService.onDidUpdateKeybindings((e) => this._updateDecorations.schedule()));
this._register({
@@ -184,7 +185,7 @@ export class KeybindingEditorDecorationsRenderer extends Disposable {
}
private _updateDecorationsNow(): void {
const model = this._editor.getModel();
const model = assertIsDefined(this._editor.getModel());
const newDecorations: IModelDeltaDecoration[] = [];

View File

@@ -176,4 +176,4 @@ export class KeyboardLayoutPickerAction extends Action {
}
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(KeyboardLayoutPickerAction, KeyboardLayoutPickerAction.ID, KeyboardLayoutPickerAction.LABEL, {}), 'Preferences: Change Keyboard Layout', nls.localize('preferences', "Preferences"));
registry.registerWorkbenchAction(SyncActionDescriptor.create(KeyboardLayoutPickerAction, KeyboardLayoutPickerAction.ID, KeyboardLayoutPickerAction.LABEL, {}), 'Preferences: Change Keyboard Layout', nls.localize('preferences', "Preferences"));

View File

@@ -139,6 +139,7 @@
.monaco-editor .settings-header-widget .title-container {
display: flex;
user-select: none;
-webkit-user-select: none;
}
.vs .monaco-editor .settings-header-widget .title-container {
@@ -170,6 +171,7 @@
cursor: pointer;
font-weight: bold;
user-select: none;
-webkit-user-select: none;
display: flex;
}

View File

@@ -216,14 +216,13 @@
overflow: hidden;
text-overflow: ellipsis;
line-height: 22px;
opacity: 0.9;
flex-shrink: 1;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row .settings-toc-count {
display: none;
line-height: 22px;
opacity: 0.7;
opacity: 0.8;
margin-left: 3px;
}
@@ -231,17 +230,8 @@
display: block;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row .monaco-tl-twistie {
opacity: 0.9;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row.selected .monaco-tl-twistie {
opacity: 1;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row.selected .settings-toc-entry {
font-weight: bold;
opacity: 1;
}
.settings-editor > .settings-body .settings-tree-container {
@@ -345,6 +335,7 @@
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-category {
font-weight: 600;
user-select: text;
-webkit-user-select: text;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-category {
@@ -354,15 +345,18 @@
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-deprecation-message {
margin-top: 3px;
user-select: text;
-webkit-user-select: text;
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents.is-deprecated .setting-item-deprecation-message {
display: block;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description {
margin-top: -1px;
user-select: text;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-deprecation-message {
position: absolute;
-webkit-user-select: text;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-validation-message {
@@ -395,6 +389,11 @@
-webkit-appearance: none !important;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-number input[type=number] {
/* Hide arrow button that shows in type=number fields */
-moz-appearance: textfield !important;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description-markdown * {
margin: 0px;
}
@@ -480,6 +479,7 @@
width: initial;
font: inherit;
height: 26px;
padding: 2px 8px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-new-extensions {

View File

@@ -39,10 +39,9 @@ import { ExplorerRootContext, ExplorerFolderContext } from 'vs/workbench/contrib
import { ILabelService } from 'vs/platform/label/common/label';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
import { registerAndGetAmdImageURL } from 'vs/base/common/amd';
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor(
EditorDescriptor.create(
PreferencesEditor,
PreferencesEditor.ID,
nls.localize('defaultPreferencesEditor', "Default Preferences Editor")
@@ -53,7 +52,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor(
EditorDescriptor.create(
SettingsEditor2,
SettingsEditor2.ID,
nls.localize('settingsEditor2', "Settings Editor 2")
@@ -64,7 +63,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor(
EditorDescriptor.create(
KeybindingsEditor,
KeybindingsEditor.ID,
nls.localize('keybindingsEditor', "Keybindings Editor")
@@ -199,15 +198,15 @@ Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactor
// Contribute Global Actions
const category = nls.localize('preferences', "Preferences");
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawDefaultSettingsAction, OpenRawDefaultSettingsAction.ID, OpenRawDefaultSettingsAction.LABEL), 'Preferences: Open Default Settings (JSON)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsJsonAction, OpenSettingsJsonAction.ID, OpenSettingsJsonAction.LABEL), 'Preferences: Open Settings (JSON)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL), 'Preferences: Open Settings (UI)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenRawDefaultSettingsAction, OpenRawDefaultSettingsAction.ID, OpenRawDefaultSettingsAction.LABEL), 'Preferences: Open Default Settings (JSON)', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenSettingsJsonAction, OpenSettingsJsonAction.ID, OpenSettingsJsonAction.LABEL), 'Preferences: Open Settings (JSON)', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL), 'Preferences: Open Settings (UI)', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsAction, OpenGlobalKeybindingsAction.ID, OpenGlobalKeybindingsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_S) }), 'Preferences: Open Keyboard Shortcuts', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDefaultKeybindingsFileAction, OpenDefaultKeybindingsFileAction.ID, OpenDefaultKeybindingsFileAction.LABEL), 'Preferences: Open Default Keyboard Shortcuts (JSON)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL, { primary: 0 }), 'Preferences: Open Keyboard Shortcuts (JSON)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLanguageBasedSettingsAction, ConfigureLanguageBasedSettingsAction.ID, ConfigureLanguageBasedSettingsAction.LABEL), 'Preferences: Configure Language Specific Settings...', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenGlobalKeybindingsAction, OpenGlobalKeybindingsAction.ID, OpenGlobalKeybindingsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_S) }), 'Preferences: Open Keyboard Shortcuts', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDefaultKeybindingsFileAction, OpenDefaultKeybindingsFileAction.ID, OpenDefaultKeybindingsFileAction.LABEL), 'Preferences: Open Default Keyboard Shortcuts (JSON)', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL, { primary: 0 }), 'Preferences: Open Keyboard Shortcuts (JSON)', category);
registry.registerWorkbenchAction(SyncActionDescriptor.create(ConfigureLanguageBasedSettingsAction, ConfigureLanguageBasedSettingsAction.ID, ConfigureLanguageBasedSettingsAction.LABEL), 'Preferences: Configure Language Specific Settings...', category);
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: SETTINGS_COMMAND_OPEN_SETTINGS,
@@ -215,7 +214,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
when: null,
primary: KeyMod.CtrlCmd | KeyCode.US_COMMA,
handler: (accessor, args: string | undefined) => {
accessor.get(IPreferencesService).openSettings(undefined, typeof args === 'string' ? args : undefined);
const query = typeof args === 'string' ? args : undefined;
accessor.get(IPreferencesService).openSettings(query ? false : undefined, query);
}
});
@@ -367,8 +367,6 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
const PREFERENCES_EDITOR_LIGHT_ICON_URI = URI.parse(registerAndGetAmdImageURL(`vs/workbench/contrib/preferences/browser/media/preferences-editor-light.svg`));
const PREFERENCES_EDITOR_DARK_ICON_URI = URI.parse(registerAndGetAmdImageURL(`vs/workbench/contrib/preferences/browser/media/preferences-editor-dark.svg`));
class PreferencesActionsContribution extends Disposable implements IWorkbenchContribution {
constructor(
@@ -383,10 +381,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
command: {
id: OpenGlobalKeybindingsAction.ID,
title: OpenGlobalKeybindingsAction.LABEL,
iconLocation: {
light: PREFERENCES_EDITOR_LIGHT_ICON_URI,
dark: PREFERENCES_EDITOR_DARK_ICON_URI
}
icon: { id: 'codicon/go-to-file' }
},
when: ResourceContextKey.Resource.isEqualTo(environmentService.keybindingsResource.toString()),
group: 'navigation',
@@ -399,10 +394,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
command: {
id: commandId,
title: OpenSettings2Action.LABEL,
iconLocation: {
light: PREFERENCES_EDITOR_LIGHT_ICON_URI,
dark: PREFERENCES_EDITOR_DARK_ICON_URI
}
icon: { id: 'codicon/go-to-file' }
},
when: ResourceContextKey.Resource.isEqualTo(environmentService.settingsResource.toString()),
group: 'navigation',
@@ -440,10 +432,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
command: {
id: commandId,
title: OpenSettings2Action.LABEL,
iconLocation: {
light: PREFERENCES_EDITOR_LIGHT_ICON_URI,
dark: PREFERENCES_EDITOR_DARK_ICON_URI
}
icon: { id: 'codicon/go-to-file' }
},
when: ContextKeyExpr.and(ResourceContextKey.Resource.isEqualTo(this.preferencesService.workspaceSettingsResource!.toString()), WorkbenchStateContext.isEqualTo('workspace')),
group: 'navigation',
@@ -468,10 +457,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
command: {
id: commandId,
title: OpenSettings2Action.LABEL,
iconLocation: {
light: PREFERENCES_EDITOR_LIGHT_ICON_URI,
dark: PREFERENCES_EDITOR_DARK_ICON_URI
}
icon: { id: 'codicon/go-to-file' }
},
when: ContextKeyExpr.and(ResourceContextKey.Resource.isEqualTo(this.preferencesService.getFolderSettingsResource(folder.uri)!.toString())),
group: 'navigation',
@@ -535,10 +521,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: OpenGlobalKeybindingsFileAction.ID,
title: OpenGlobalKeybindingsFileAction.LABEL,
iconLocation: {
light: PREFERENCES_EDITOR_LIGHT_ICON_URI,
dark: PREFERENCES_EDITOR_DARK_ICON_URI
}
icon: { id: 'codicon/go-to-file' }
},
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR),
group: 'navigation',
@@ -819,10 +802,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON,
title: nls.localize('openSettingsJson', "Open Settings (JSON)"),
iconLocation: {
dark: PREFERENCES_EDITOR_DARK_ICON_URI,
light: PREFERENCES_EDITOR_LIGHT_ICON_URI
}
icon: { id: 'codicon/go-to-file' }
},
group: 'navigation',
order: 1,

View File

@@ -52,8 +52,6 @@ import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor
import { IFilterResult, IPreferencesService, ISetting, ISettingsEditorModel, ISettingsGroup, SettingsEditorOptions } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultPreferencesEditorInput, PreferencesEditorInput } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { DefaultSettingsEditorModel, SettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { withNullAsUndefined, withUndefinedAsNull, assertIsDefined } from 'vs/base/common/types';
export class PreferencesEditor extends BaseEditor {
@@ -254,7 +252,7 @@ export class PreferencesEditor extends BaseEditor {
if (this.editorService.activeControl !== this) {
this.focus();
}
const promise: Promise<boolean> = this.input && this.input.isDirty() ? this.input.save() : Promise.resolve(true);
const promise: Promise<boolean> = this.input && this.input.isDirty() ? this.input.save(this.group!.id) : Promise.resolve(true);
promise.then(() => {
if (target === ConfigurationTarget.USER_LOCAL) {
this.preferencesService.switchSettings(ConfigurationTarget.USER_LOCAL, this.preferencesService.userSettingsResource, true);
@@ -634,7 +632,7 @@ class PreferencesRenderersController extends Disposable {
if (filterResult) {
filterResult.query = filter;
filterResult.exactMatch = searchResult && searchResult.exactMatch;
filterResult.exactMatch = !!searchResult && searchResult.exactMatch;
}
return filterResult;
@@ -978,12 +976,10 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
@IStorageService storageService: IStorageService,
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IThemeService themeService: IThemeService,
@ITextFileService textFileService: ITextFileService,
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IEditorService editorService: IEditorService,
@IHostService hostService: IHostService
@IEditorService editorService: IEditorService
) {
super(DefaultPreferencesEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService, hostService);
super(DefaultPreferencesEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, editorService, editorGroupService);
}
private static _getContributions(): IEditorContributionDescription[] {

View File

@@ -1019,7 +1019,7 @@ class UnsupportedSettingsRenderer extends Disposable {
severity: MarkerSeverity.Hint,
tags: [MarkerTag.Unnecessary],
...setting.range,
message: nls.localize('unsupportedRemoteMachineSetting', "This setting cannot be applied now. It will be applied when you open local window.")
message: nls.localize('unsupportedRemoteMachineSetting', "This setting cannot be applied in this window. It will be applied when you open local window.")
});
}
}
@@ -1054,7 +1054,7 @@ class UnsupportedSettingsRenderer extends Disposable {
severity: MarkerSeverity.Hint,
tags: [MarkerTag.Unnecessary],
...setting.range,
message: nls.localize('unsupportedWindowSetting', "This setting cannot be applied now. It will be applied when you open this folder directly.")
message: nls.localize('unsupportedWindowSetting', "This setting cannot be applied in this workspace. It will be applied when you open the containing workspace folder directly.")
});
}
}

View File

@@ -4,13 +4,18 @@
*--------------------------------------------------------------------------------------------*/
import * as DOM from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { ITreeElement } from 'vs/base/browser/ui/tree/tree';
import { Action } from 'vs/base/common/actions';
import * as arrays from 'vs/base/common/arrays';
import { Delayer, ThrottledDelayer, timeout } from 'vs/base/common/async';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import * as collections from 'vs/base/common/collections';
import { getErrorMessage, isPromiseCanceledError } from 'vs/base/common/errors';
import { Iterator } from 'vs/base/common/iterator';
import { KeyCode } from 'vs/base/common/keyCodes';
import * as platform from 'vs/base/common/platform';
import * as strings from 'vs/base/common/strings';
import { isArray, withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
@@ -39,13 +44,11 @@ import { AbstractSettingRenderer, ISettingLinkClickEvent, ISettingOverrideClickE
import { ISettingsEditorViewState, parseQuery, SearchResultIdx, SearchResultModel, SettingsTreeElement, SettingsTreeGroupChild, SettingsTreeGroupElement, SettingsTreeModel, SettingsTreeSettingElement } from 'vs/workbench/contrib/preferences/browser/settingsTreeModels';
import { settingsTextInputBorder } from 'vs/workbench/contrib/preferences/browser/settingsWidgets';
import { createTOCIterator, TOCTree, TOCTreeModel } from 'vs/workbench/contrib/preferences/browser/tocTree';
import { CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_SEARCH_FOCUS, CONTEXT_TOC_ROW_FOCUS, EXTENSION_SETTING_TAG, IPreferencesSearchService, ISearchProvider, MODIFIED_SETTING_TAG, SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS } from 'vs/workbench/contrib/preferences/common/preferences';
import { CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_SEARCH_FOCUS, CONTEXT_TOC_ROW_FOCUS, EXTENSION_SETTING_TAG, IPreferencesSearchService, ISearchProvider, MODIFIED_SETTING_TAG, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/contrib/preferences/common/preferences';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IPreferencesService, ISearchResult, ISettingsEditorModel, ISettingsEditorOptions, SettingsEditorOptions, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { Settings2EditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { Action } from 'vs/base/common/actions';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
function createGroupIterator(group: SettingsTreeGroupElement): Iterator<ITreeElement<SettingsTreeGroupChild>> {
const groupsIt = Iterator.fromArray(group.children);
@@ -98,6 +101,7 @@ export class SettingsEditor2 extends BaseEditor {
private headerContainer!: HTMLElement;
private searchWidget!: SuggestEnabledInput;
private countElement!: HTMLElement;
private controlsElement!: HTMLElement;
private settingsTargetsWidget!: SettingsTargetsWidget;
private settingsTreeContainer!: HTMLElement;
@@ -134,9 +138,6 @@ export class SettingsEditor2 extends BaseEditor {
private scheduledRefreshes: Map<string, DOM.IFocusTracker>;
private lastFocusedSettingElement: string | null = null;
private actionBar: ActionBar;
private actionsContainer: HTMLElement;
/** Don't spam warnings */
private hasWarnedMissingSettings = false;
@@ -218,6 +219,7 @@ export class SettingsEditor2 extends BaseEditor {
this.createHeader(this.rootElement);
this.createBody(this.rootElement);
this.addCtrlAInterceptor(this.rootElement);
this.updateStyles();
}
@@ -308,7 +310,8 @@ export class SettingsEditor2 extends BaseEditor {
this.layoutTrees(dimension);
const innerWidth = Math.min(1000, dimension.width) - 24 * 2; // 24px padding on left and right;
const monacoWidth = innerWidth - 10 - this.countElement.clientWidth - 12; // minus padding inside inputbox, countElement width, extra padding before countElement
// minus padding inside inputbox, countElement width, controls width, extra padding before countElement
const monacoWidth = innerWidth - 10 - this.countElement.clientWidth - this.controlsElement.clientWidth - 12;
this.searchWidget.layout({ height: 20, width: monacoWidth });
DOM.toggleClass(this.rootElement, 'mid-width', dimension.width < 1000 && dimension.width >= 600);
@@ -330,6 +333,10 @@ export class SettingsEditor2 extends BaseEditor {
this.focusSearch();
}
onHide(): void {
this.searchWidget.onHide();
}
focusSettings(): void {
// Update ARIA global labels
const labelElement = this.settingsAriaExtraLabelsContainer.querySelector('#settings_aria_more_actions_shortcut_label');
@@ -378,6 +385,7 @@ export class SettingsEditor2 extends BaseEditor {
clearSearchResults(): void {
this.searchWidget.setValue('');
this.focusSearch();
}
clearSearchFilters(): void {
@@ -390,17 +398,12 @@ export class SettingsEditor2 extends BaseEditor {
this.searchWidget.setValue(query.trim());
}
clearSearch(): void {
this.clearSearchResults();
this.focusSearch();
}
private createHeader(parent: HTMLElement): void {
this.headerContainer = DOM.append(parent, $('.settings-header'));
const searchContainer = DOM.append(this.headerContainer, $('.search-container'));
const clearInputAction = new Action(SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Settings Search Input"), 'codicon-clear-all', false, () => { this.clearSearch(); return Promise.resolve(null); });
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, {
@@ -449,14 +452,14 @@ export class SettingsEditor2 extends BaseEditor {
this.settingsTargetsWidget.settingsTarget = ConfigurationTarget.USER_LOCAL;
this.settingsTargetsWidget.onDidTargetChange(target => this.onDidSettingsTargetChange(target));
this.actionsContainer = DOM.append(searchContainer, DOM.$('.settings-clear-widget'));
this.controlsElement = DOM.append(searchContainer, DOM.$('.settings-clear-widget'));
this.actionBar = this._register(new ActionBar(this.actionsContainer, {
const actionBar = this._register(new ActionBar(this.controlsElement, {
animated: false,
actionViewItemProvider: (action: Action) => { return undefined; }
}));
this.actionBar.push([clearInputAction], { label: false, icon: true });
actionBar.push([clearInputAction], { label: false, icon: true });
}
private onDidSettingsTargetChange(target: SettingsTarget): void {
@@ -544,7 +547,6 @@ export class SettingsEditor2 extends BaseEditor {
this._register(DOM.addDisposableListener(clearSearch, DOM.EventType.CLICK, (e: MouseEvent) => {
DOM.EventHelper.stop(e, false);
this.clearSearchResults();
this.focusSearch();
}));
DOM.append(this.noResultsMessage, clearSearchContainer);
@@ -561,7 +563,11 @@ export class SettingsEditor2 extends BaseEditor {
if (DOM.findParentWithClass(e.relatedTarget, 'settings-editor-tree')) {
if (this.settingsTree.scrollTop > 0) {
const firstElement = this.settingsTree.firstVisibleElement;
this.settingsTree.reveal(firstElement, 0.1);
if (typeof firstElement !== 'undefined') {
this.settingsTree.reveal(firstElement, 0.1);
}
return true;
}
} else {
@@ -594,6 +600,21 @@ export class SettingsEditor2 extends BaseEditor {
);
}
private addCtrlAInterceptor(container: HTMLElement): void {
this._register(DOM.addStandardDisposableListener(container, DOM.EventType.KEY_DOWN, (e: StandardKeyboardEvent) => {
if (
e.keyCode === KeyCode.KEY_A &&
(platform.isMacintosh ? e.metaKey : e.ctrlKey) &&
e.target.tagName !== 'TEXTAREA' &&
e.target.tagName !== 'INPUT'
) {
// Avoid browser ctrl+a
e.browserEvent.stopPropagation();
e.browserEvent.preventDefault();
}
}));
}
private createFocusSink(container: HTMLElement, callback: (e: any) => boolean, label: string): HTMLElement {
const listFocusSink = DOM.append(container, $('.settings-tree-focus-sink'));
listFocusSink.setAttribute('aria-label', label);
@@ -1316,7 +1337,7 @@ export class SettingsEditor2 extends BaseEditor {
private _filterOrSearchPreferencesModel(filter: string, model: ISettingsEditorModel, provider?: ISearchProvider, token?: CancellationToken): Promise<ISearchResult | null> {
const searchP = provider ? provider.searchModel(model, token) : Promise.resolve(null);
return searchP
.then<ISearchResult>(null, err => {
.then<ISearchResult, ISearchResult | null>(undefined, err => {
if (isPromiseCanceledError(err)) {
return Promise.reject(err);
} else {
@@ -1332,7 +1353,7 @@ export class SettingsEditor2 extends BaseEditor {
this.telemetryService.publicLog('settingsEditor.searchError', { message, filter });
this.logService.info('Setting search error: ' + message);
}
return Promise.resolve(null);
return null;
}
});
}

View File

@@ -147,7 +147,7 @@ export const tocData: ITOCEntry = {
},
{
id: 'features/extensions',
label: localize('extensionViewlet', "Extension Viewlet"),
label: localize('extensions', "Extensions"),
settings: ['extensions.*']
},
{
@@ -202,9 +202,9 @@ export const tocData: ITOCEntry = {
settings: ['telemetry.*']
},
{
id: 'application/configurationSync',
label: localize('configuration sync', "Configuration Sync"),
settings: ['configurationSync.*']
id: 'application/sync',
label: localize('sync', "Sync"),
settings: ['sync.*']
}
]
}

View File

@@ -28,7 +28,6 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import { dispose, IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { ISpliceable } from 'vs/base/common/sequence';
import { escapeRegExpCharacters, startsWith } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { ICommandService } from 'vs/platform/commands/common/commands';
@@ -37,7 +36,7 @@ import { IContextMenuService, IContextViewService } from 'vs/platform/contextvie
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { errorForeground, focusBorder, foreground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, transparent } from 'vs/platform/theme/common/colorRegistry';
import { errorForeground, focusBorder, foreground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, editorBackground } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler, attachStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ITOCEntry } from 'vs/workbench/contrib/preferences/browser/settingsLayout';
@@ -47,6 +46,8 @@ import { SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/contrib/
import { ISetting, ISettingsGroup, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { isArray } from 'vs/base/common/types';
import { BrowserFeatures } from 'vs/base/browser/canIUse';
import { isIOS } from 'vs/base/common/platform';
const $ = DOM.$;
@@ -466,7 +467,10 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
}
const onChange = (value: any) => this._onDidChangeSetting.fire({ key: element.setting.key, value, type: template.context!.valueType });
template.deprecationWarningElement.innerText = element.setting.deprecationMessage || '';
const deprecationText = element.setting.deprecationMessage || '';
template.deprecationWarningElement.innerText = deprecationText;
DOM.toggleClass(template.containerElement, 'is-deprecated', !!deprecationText);
this.renderValue(element, <ISettingItemTemplate>template, onChange);
}
@@ -485,15 +489,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
};
this._onDidClickSettingLink.fire(e);
} else {
let uri: URI | undefined;
try {
uri = URI.parse(content);
} catch (err) {
// ignore
}
if (uri) {
this._openerService.open(uri).catch(onUnexpectedError);
}
this._openerService.open(content).catch(onUnexpectedError);
}
},
disposeables
@@ -918,7 +914,9 @@ export class SettingEnumRenderer extends AbstractSettingRenderer implements ITre
renderTemplate(container: HTMLElement): ISettingEnumItemTemplate {
const common = this.renderCommonTemplate(null, container, 'enum');
const selectBox = new SelectBox([], 0, this._contextViewService, undefined, { useCustomDrawn: true });
const selectBox = new SelectBox([], 0, this._contextViewService, undefined, {
useCustomDrawn: !(isIOS && BrowserFeatures.pointerEvents)
});
common.toDispose.push(selectBox);
common.toDispose.push(attachSelectBoxStyler(selectBox, this._themeService, {
@@ -1456,8 +1454,6 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
@IThemeService themeService: IThemeService,
@IInstantiationService instantiationService: IInstantiationService,
) {
const treeClass = 'settings-editor-tree';
super('SettingsTree', container,
new SettingsTreeDelegate(),
renderers,
@@ -1470,7 +1466,7 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
return e.id;
}
},
styleController: new DefaultStyleController(DOM.createStyleSheet(container), treeClass),
styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id),
filter: instantiationService.createInstance(SettingsTreeFilter, viewState)
});
@@ -1488,6 +1484,8 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
// applying an opacity to the link color.
const fgWithOpacity = new Color(new RGBA(foregroundColor.rgba.r, foregroundColor.rgba.g, foregroundColor.rgba.b, 0.9));
collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description { color: ${fgWithOpacity}; }`);
collector.addRule(`.settings-editor > .settings-body .settings-toc-container .monaco-list-row:not(.selected) { color: ${fgWithOpacity}; }`);
}
const errorColor = theme.getColor(errorForeground);
@@ -1523,23 +1521,24 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
}
}));
this.getHTMLElement().classList.add(treeClass);
this.getHTMLElement().classList.add('settings-editor-tree');
this.disposables.add(attachStyler(themeService, {
listActiveSelectionBackground: transparent(Color.white, 0),
listBackground: editorBackground,
listActiveSelectionBackground: editorBackground,
listActiveSelectionForeground: foreground,
listFocusAndSelectionBackground: transparent(Color.white, 0),
listFocusAndSelectionBackground: editorBackground,
listFocusAndSelectionForeground: foreground,
listFocusBackground: transparent(Color.white, 0),
listFocusBackground: editorBackground,
listFocusForeground: foreground,
listHoverForeground: foreground,
listHoverBackground: transparent(Color.white, 0),
listHoverOutline: transparent(Color.white, 0),
listFocusOutline: transparent(Color.white, 0),
listInactiveSelectionBackground: transparent(Color.white, 0),
listHoverBackground: editorBackground,
listHoverOutline: editorBackground,
listFocusOutline: editorBackground,
listInactiveSelectionBackground: editorBackground,
listInactiveSelectionForeground: foreground,
listInactiveFocusBackground: transparent(Color.white, 0),
listInactiveFocusOutline: transparent(Color.white, 0)
listInactiveFocusBackground: editorBackground,
listInactiveFocusOutline: editorBackground
}, colors => {
this.style(colors);
}));

View File

@@ -23,33 +23,33 @@ import { disposableTimeout } from 'vs/base/common/async';
import { isUndefinedOrNull } from 'vs/base/common/types';
const $ = DOM.$;
export const settingsHeaderForeground = registerColor('settings.headerForeground', { light: '#444444', dark: '#e7e7e7', hc: '#ffffff' }, localize('headerForeground', "(For settings editor preview) The foreground color for a section header or active title."));
export const settingsHeaderForeground = registerColor('settings.headerForeground', { light: '#444444', dark: '#e7e7e7', hc: '#ffffff' }, localize('headerForeground', "The foreground color for a section header or active title."));
export const modifiedItemIndicator = registerColor('settings.modifiedItemIndicator', {
light: new Color(new RGBA(102, 175, 224)),
dark: new Color(new RGBA(12, 125, 157)),
hc: new Color(new RGBA(0, 73, 122))
}, localize('modifiedItemForeground', "(For settings editor preview) The color of the modified setting indicator."));
}, localize('modifiedItemForeground', "The color of the modified setting indicator."));
// Enum control colors
export const settingsSelectBackground = registerColor('settings.dropdownBackground', { dark: selectBackground, light: selectBackground, hc: selectBackground }, localize('settingsDropdownBackground', "(For settings editor preview) Settings editor dropdown background."));
export const settingsSelectForeground = registerColor('settings.dropdownForeground', { dark: selectForeground, light: selectForeground, hc: selectForeground }, localize('settingsDropdownForeground', "(For settings editor preview) Settings editor dropdown foreground."));
export const settingsSelectBorder = registerColor('settings.dropdownBorder', { dark: selectBorder, light: selectBorder, hc: selectBorder }, localize('settingsDropdownBorder', "(For settings editor preview) Settings editor dropdown border."));
export const settingsSelectListBorder = registerColor('settings.dropdownListBorder', { dark: editorWidgetBorder, light: editorWidgetBorder, hc: editorWidgetBorder }, localize('settingsDropdownListBorder', "(For settings editor preview) Settings editor dropdown list border. This surrounds the options and separates the options from the description."));
export const settingsSelectBackground = registerColor('settings.dropdownBackground', { dark: selectBackground, light: selectBackground, hc: selectBackground }, localize('settingsDropdownBackground', "Settings editor dropdown background."));
export const settingsSelectForeground = registerColor('settings.dropdownForeground', { dark: selectForeground, light: selectForeground, hc: selectForeground }, localize('settingsDropdownForeground', "Settings editor dropdown foreground."));
export const settingsSelectBorder = registerColor('settings.dropdownBorder', { dark: selectBorder, light: selectBorder, hc: selectBorder }, localize('settingsDropdownBorder', "Settings editor dropdown border."));
export const settingsSelectListBorder = registerColor('settings.dropdownListBorder', { dark: editorWidgetBorder, light: editorWidgetBorder, hc: editorWidgetBorder }, localize('settingsDropdownListBorder', "Settings editor dropdown list border. This surrounds the options and separates the options from the description."));
// Bool control colors
export const settingsCheckboxBackground = registerColor('settings.checkboxBackground', { dark: simpleCheckboxBackground, light: simpleCheckboxBackground, hc: simpleCheckboxBackground }, localize('settingsCheckboxBackground', "(For settings editor preview) Settings editor checkbox background."));
export const settingsCheckboxForeground = registerColor('settings.checkboxForeground', { dark: simpleCheckboxForeground, light: simpleCheckboxForeground, hc: simpleCheckboxForeground }, localize('settingsCheckboxForeground', "(For settings editor preview) Settings editor checkbox foreground."));
export const settingsCheckboxBorder = registerColor('settings.checkboxBorder', { dark: simpleCheckboxBorder, light: simpleCheckboxBorder, hc: simpleCheckboxBorder }, localize('settingsCheckboxBorder', "(For settings editor preview) Settings editor checkbox border."));
export const settingsCheckboxBackground = registerColor('settings.checkboxBackground', { dark: simpleCheckboxBackground, light: simpleCheckboxBackground, hc: simpleCheckboxBackground }, localize('settingsCheckboxBackground', "Settings editor checkbox background."));
export const settingsCheckboxForeground = registerColor('settings.checkboxForeground', { dark: simpleCheckboxForeground, light: simpleCheckboxForeground, hc: simpleCheckboxForeground }, localize('settingsCheckboxForeground', "Settings editor checkbox foreground."));
export const settingsCheckboxBorder = registerColor('settings.checkboxBorder', { dark: simpleCheckboxBorder, light: simpleCheckboxBorder, hc: simpleCheckboxBorder }, localize('settingsCheckboxBorder', "Settings editor checkbox border."));
// Text control colors
export const settingsTextInputBackground = registerColor('settings.textInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('textInputBoxBackground', "(For settings editor preview) Settings editor text input box background."));
export const settingsTextInputForeground = registerColor('settings.textInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('textInputBoxForeground', "(For settings editor preview) Settings editor text input box foreground."));
export const settingsTextInputBorder = registerColor('settings.textInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('textInputBoxBorder', "(For settings editor preview) Settings editor text input box border."));
export const settingsTextInputBackground = registerColor('settings.textInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('textInputBoxBackground', "Settings editor text input box background."));
export const settingsTextInputForeground = registerColor('settings.textInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('textInputBoxForeground', "Settings editor text input box foreground."));
export const settingsTextInputBorder = registerColor('settings.textInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('textInputBoxBorder', "Settings editor text input box border."));
// Number control colors
export const settingsNumberInputBackground = registerColor('settings.numberInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('numberInputBoxBackground', "(For settings editor preview) Settings editor number input box background."));
export const settingsNumberInputForeground = registerColor('settings.numberInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('numberInputBoxForeground', "(For settings editor preview) Settings editor number input box foreground."));
export const settingsNumberInputBorder = registerColor('settings.numberInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('numberInputBoxBorder', "(For settings editor preview) Settings editor number input box border."));
export const settingsNumberInputBackground = registerColor('settings.numberInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('numberInputBoxBackground', "Settings editor number input box background."));
export const settingsNumberInputForeground = registerColor('settings.numberInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('numberInputBoxForeground', "Settings editor number input box foreground."));
export const settingsNumberInputBorder = registerColor('settings.numberInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('numberInputBoxBorder', "Settings editor number input box border."));
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const checkboxBackgroundColor = theme.getColor(settingsCheckboxBackground);

View File

@@ -10,7 +10,7 @@ import { IObjectTreeOptions, ObjectTree } from 'vs/base/browser/ui/tree/objectTr
import { ITreeElement, ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/tree/tree';
import { Iterator } from 'vs/base/common/iterator';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { editorBackground } from 'vs/platform/theme/common/colorRegistry';
import { editorBackground, transparent, foreground } from 'vs/platform/theme/common/colorRegistry';
import { attachStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { SettingsTreeFilter } from 'vs/workbench/contrib/preferences/browser/settingsTree';
@@ -189,7 +189,6 @@ export class TOCTree extends ObjectTree<SettingsTreeGroupElement> {
) {
// test open mode
const treeClass = 'settings-toc-tree';
const filter = instantiationService.createInstance(SettingsTreeFilter, viewState);
const options: IObjectTreeOptions<SettingsTreeGroupElement> = {
filter,
@@ -199,7 +198,7 @@ export class TOCTree extends ObjectTree<SettingsTreeGroupElement> {
return e.id;
}
},
styleController: new DefaultStyleController(DOM.createStyleSheet(container), treeClass),
styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id),
accessibilityProvider: instantiationService.createInstance(SettingsAccessibilityProvider),
collapseByDefault: true
};
@@ -209,16 +208,15 @@ export class TOCTree extends ObjectTree<SettingsTreeGroupElement> {
[new TOCRenderer()],
options);
this.getHTMLElement().classList.add(treeClass);
this.disposables.add(attachStyler(themeService, {
listBackground: editorBackground,
listActiveSelectionBackground: editorBackground,
listActiveSelectionForeground: settingsHeaderForeground,
listFocusAndSelectionBackground: editorBackground,
listFocusAndSelectionForeground: settingsHeaderForeground,
listFocusBackground: editorBackground,
listFocusForeground: settingsHeaderForeground,
listHoverForeground: settingsHeaderForeground,
listFocusForeground: transparent(foreground, 0.9),
listHoverForeground: transparent(foreground, 0.9),
listHoverBackground: editorBackground,
listInactiveSelectionBackground: editorBackground,
listInactiveSelectionForeground: settingsHeaderForeground,