Merge from vscode 011858832762aaff245b2336fb1c38166e7a10fb (#4663)

This commit is contained in:
Anthony Dresser
2019-03-22 13:07:54 -07:00
committed by GitHub
parent f5c9174c2f
commit 4a87a24235
296 changed files with 2531 additions and 2472 deletions

View File

@@ -376,7 +376,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
if (action.id === this.recordKeysAction.id) {
return new CheckboxActionItem(null, action);
}
return null;
return undefined;
}
}));

View File

@@ -424,7 +424,7 @@ export class FolderSettingsActionItem extends BaseActionItem {
this.contextMenuService.showContextMenu({
getAnchor: () => this.container,
getActions: () => this.getDropdownMenuActions(),
getActionItem: () => null,
getActionItem: () => undefined,
onHide: () => {
this.anchorElement.blur();
}
@@ -495,7 +495,7 @@ export class SettingsTargetsWidget extends Widget {
orientation: ActionsOrientation.HORIZONTAL,
ariaLabel: localize('settingsSwitcherBarAriaLabel', "Settings Switcher"),
animated: false,
actionItemProvider: (action: Action) => action.id === 'folderSettings' ? this.folderSettings : null
actionItemProvider: (action: Action) => action.id === 'folderSettings' ? this.folderSettings : undefined
}));
this.userSettings = new Action('userSettings', localize('userSettings', "User Settings"), '.settings-tab', true, () => this.updateTarget(ConfigurationTarget.USER));

View File

@@ -439,7 +439,7 @@ export abstract class AbstractSettingRenderer implements ITreeRenderer<SettingsT
}
}
const onChange = value => this._onDidChangeSetting.fire({ key: element.setting.key, value, type: template.context!.valueType });
const onChange = (value: any) => this._onDidChangeSetting.fire({ key: element.setting.key, value, type: template.context!.valueType });
template.deprecationWarningElement.innerText = element.setting.deprecationMessage || '';
this.renderValue(element, <ISettingItemTemplate>template, onChange);
@@ -698,7 +698,7 @@ export class SettingExcludeRenderer extends AbstractSettingRenderer implements I
}
}
const sortKeys = (obj) => {
const sortKeys = (obj: Object) => {
const keyArray = Object.keys(obj)
.map(key => ({ key, val: obj[key] }))
.sort((a, b) => a.key.localeCompare(b.key));
@@ -901,7 +901,7 @@ export class SettingNumberRenderer extends AbstractSettingRenderer implements IT
? parseInt : parseFloat;
const nullNumParseFn = (dataElement.valueType === 'nullable-integer' || dataElement.valueType === 'nullable-number')
? (v => v === '' ? null : numParseFn(v)) : numParseFn;
? ((v: string) => v === '' ? null : numParseFn(v)) : numParseFn;
const label = this.setElementAriaLabels(dataElement, SETTINGS_NUMBER_TEMPLATE_ID, template);

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as arrays from 'vs/base/common/arrays';
import { isArray } from 'vs/base/common/types';
import { isArray, withUndefinedAsNull } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -262,11 +262,11 @@ export class SettingsTreeModel {
}
getElementById(id: string): SettingsTreeElement | null {
return this._treeElementsById.get(id) || null;
return withUndefinedAsNull(this._treeElementsById.get(id));
}
getElementsByName(name: string): SettingsTreeSettingElement[] | null {
return this._treeElementsBySettingName.get(name) || null;
return withUndefinedAsNull(this._treeElementsBySettingName.get(name));
}
updateElementsByName(name: string): void {
@@ -378,7 +378,7 @@ function wordifyKey(key: string): string {
}
function trimCategoryForGroup(category: string, groupId: string): string {
const doTrim = forward => {
const doTrim = (forward: boolean) => {
const parts = groupId.split('.');
while (parts.length) {
const reg = new RegExp(`^${parts.join('\\.')}(\\.|$)`, 'i');

View File

@@ -403,7 +403,7 @@ export class ExcludeSettingWidget extends Disposable {
private renderEditItem(item: IExcludeViewItem): HTMLElement {
const rowElement = $('.setting-exclude-edit-row');
const onSubmit = edited => {
const onSubmit = (edited: boolean) => {
this.model.setEditKey(null);
const pattern = patternInput.value.trim();
if (edited && pattern) {

View File

@@ -88,7 +88,7 @@ interface ISerializedPreferencesEditorInput {
// Register Preferences Editor Input Factory
class PreferencesEditorInputFactory implements IEditorInputFactory {
serialize(editorInput: EditorInput): string | null {
serialize(editorInput: EditorInput): string | undefined {
const input = <PreferencesEditorInput>editorInput;
if (input.details && input.master) {
@@ -113,10 +113,10 @@ class PreferencesEditorInputFactory implements IEditorInputFactory {
}
}
return null;
return undefined;
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | null {
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | undefined {
const deserialized: ISerializedPreferencesEditorInput = JSON.parse(serializedEditorInput);
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
@@ -132,7 +132,7 @@ class PreferencesEditorInputFactory implements IEditorInputFactory {
}
}
return null;
return undefined;
}
}

View File

@@ -287,7 +287,7 @@ class RemoteSearchProvider implements ISearchProvider {
const timestamp = Date.now();
const duration = timestamp - start;
const remoteSettings: IRemoteSetting[] = (result.value || [])
.map(r => {
.map((r: any) => {
const key = JSON.parse(r.setting || r.Setting);
const packageId = r['packageid'];
const id = getSettingKey(key, packageId);
@@ -447,7 +447,7 @@ class SettingMatches {
readonly matches: IRange[];
constructor(searchString: string, setting: ISetting, private requireFullQueryMatch: boolean, private searchDescription, private valuesMatcher: (filter: string, setting: ISetting) => IRange[]) {
constructor(searchString: string, setting: ISetting, private requireFullQueryMatch: boolean, private searchDescription: boolean, private valuesMatcher: (filter: string, setting: ISetting) => IRange[]) {
this.matches = distinct(this._findMatchesInSetting(searchString, setting), (match) => `${match.startLineNumber}_${match.startColumn}_${match.endLineNumber}_${match.endColumn}_`);
}

View File

@@ -11,7 +11,7 @@ import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cance
import * as collections from 'vs/base/common/collections';
import { getErrorMessage, isPromiseCanceledError } from 'vs/base/common/errors';
import { Iterator } from 'vs/base/common/iterator';
import { isArray } from 'vs/base/common/types';
import { isArray, withNullAsUndefined } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import 'vs/css!./media/settingsEditor2';
import { localize } from 'vs/nls';
@@ -573,7 +573,7 @@ export class SettingsEditor2 extends BaseEditor {
this.tocTree.setSelection(element ? [element] : []);
if (this.searchResultModel) {
if (this.viewState.filterToCategory !== element) {
this.viewState.filterToCategory = element || undefined;
this.viewState.filterToCategory = withNullAsUndefined(element);
this.renderTree();
this.settingsTree.scrollTop = 0;
}