提交 e1e421f1 编写于 作者: P Pine Wu

Add in listItemType

上级 1aa47639
......@@ -79,7 +79,7 @@ export class SettingsEditor2 extends BaseEditor {
return false;
}
return type === SettingValueType.Enum ||
type === SettingValueType.Array ||
type === SettingValueType.ListOfString ||
type === SettingValueType.Complex ||
type === SettingValueType.Boolean ||
type === SettingValueType.Exclude;
......
......@@ -672,7 +672,7 @@ export class SettingArrayRenderer extends AbstractSettingRenderer implements ITr
renderTemplate(container: HTMLElement): ISettingExcludeItemTemplate {
const common = this.renderCommonTemplate(null, container, 'exclude');
const excludeWidget = this._instantiationService.createInstance(ExcludeSettingWidget, 'array-of-string', common.controlElement);
const excludeWidget = this._instantiationService.createInstance(ExcludeSettingWidget, 'list-of-string', common.controlElement);
excludeWidget.domNode.classList.add(AbstractSettingRenderer.CONTROL_CLASS);
common.toDispose.push(excludeWidget);
......@@ -1352,7 +1352,7 @@ class SettingsTreeDelegate implements IListVirtualDelegate<SettingsTreeGroupChil
return SETTINGS_ENUM_TEMPLATE_ID;
}
if (element.valueType === SettingValueType.Array) {
if (element.valueType === SettingValueType.ListOfString) {
return SETTINGS_ARRAY_TEMPLATE_ID;
}
......
......@@ -193,8 +193,8 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
this.valueType = SettingValueType.Number;
} else if (this.setting.type === 'boolean') {
this.valueType = SettingValueType.Boolean;
} else if (this.setting.type === 'array') {
this.valueType = SettingValueType.Array;
} else if (this.setting.type === 'array' && this.setting.listItemType === 'string') {
this.valueType = SettingValueType.ListOfString;
} else if (isArray(this.setting.type) && this.setting.type.indexOf(SettingValueType.Null) > -1 && this.setting.type.length === 2) {
if (this.setting.type.indexOf(SettingValueType.Integer) > -1) {
this.valueType = SettingValueType.NullableInteger;
......
......@@ -212,7 +212,7 @@ export class ExcludeSettingWidget extends Disposable {
}
constructor(
private type: 'exclude' | 'array-of-string',
private type: 'exclude' | 'list-of-string',
private container: HTMLElement,
@IThemeService private readonly themeService: IThemeService,
@IContextViewService private readonly contextViewService: IContextViewService,
......
......@@ -25,7 +25,7 @@ export enum SettingValueType {
Integer = 'integer',
Number = 'number',
Boolean = 'boolean',
Array = 'array',
ListOfString = 'list-of-string',
Exclude = 'exclude',
Complex = 'complex',
NullableInteger = 'nullable-integer',
......@@ -62,6 +62,7 @@ export interface ISetting {
scope?: ConfigurationScope;
type?: string | string[];
listItemType?: string;
enum?: string[];
enumDescriptions?: string[];
enumDescriptionsAreMarkdown?: boolean;
......
......@@ -22,7 +22,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { Registry } from 'vs/platform/registry/common/platform';
import { EditorModel } from 'vs/workbench/common/editor';
import { IFilterMetadata, IFilterResult, IGroupFilter, IKeybindingsEditorModel, ISearchResultGroup, ISetting, ISettingMatch, ISettingMatcher, ISettingsEditorModel, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { withNullAsUndefined } from 'vs/base/common/types';
import { withNullAsUndefined, isArray } from 'vs/base/common/types';
export const nullRange: IRange = { startLineNumber: -1, startColumn: -1, endLineNumber: -1, endColumn: -1 };
export function isNullRange(range: IRange): boolean { return range.startLineNumber === -1 && range.startColumn === -1 && range.endLineNumber === -1 && range.endColumn === -1; }
......@@ -613,6 +613,10 @@ export class DefaultSettings extends Disposable {
const value = prop.default;
const description = (prop.description || prop.markdownDescription || '').split('\n');
const overrides = OVERRIDE_PROPERTY_PATTERN.test(key) ? this.parseOverrideSettings(prop.default) : [];
const listItemType = prop.type === 'array' && prop.items && !isArray(prop.items) && prop.items.type && !isArray(prop.items.type)
? prop.items.type
: undefined;
result.push({
key,
value,
......@@ -625,6 +629,7 @@ export class DefaultSettings extends Disposable {
overrides,
scope: prop.scope,
type: prop.type,
listItemType,
enum: prop.enum,
enumDescriptions: prop.enumDescriptions || prop.markdownEnumDescriptions,
enumDescriptionsAreMarkdown: !prop.enumDescriptions,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册