diff --git a/packages/core/src/browser/preferences/preference-contribution.ts b/packages/core/src/browser/preferences/preference-contribution.ts index d20bf3a64a814..093980bc38825 100644 --- a/packages/core/src/browser/preferences/preference-contribution.ts +++ b/packages/core/src/browser/preferences/preference-contribution.ts @@ -125,10 +125,32 @@ export class PreferenceSchemaProvider extends PreferenceProvider { } } for (const property of props) { - this.preferences[property] = this.combinedSchema.properties[property].default; + this.preferences[property] = this.getDefaultValue(this.combinedSchema.properties[property]); } } + protected getDefaultValue(property: PreferenceDataProperty): any { + if (property.default) { + return property.default; + } + const type = Array.isArray(property.type) ? property.type[0] : property.type; + switch (type) { + case 'boolean': + return false; + case 'integer': + case 'number': + return 0; + case 'string': + return ''; + case 'array': + return []; + case 'object': + return {}; + } + // tslint:disable-next-line:no-null-keyword + return null; + } + protected updateValidate(): void { this.validateFunction = new Ajv().compile(this.combinedSchema); } diff --git a/packages/core/src/browser/style/dialog.css b/packages/core/src/browser/style/dialog.css index 11bb905522ea1..21cc1bb1e1681 100644 --- a/packages/core/src/browser/style/dialog.css +++ b/packages/core/src/browser/style/dialog.css @@ -49,12 +49,12 @@ background-color: var(--theia-ui-dialog-header-color); color: var(--theia-ui-dialog-header-font-color); padding: 0 calc(var(--theia-ui-padding)*2); - height: 28px; + min-height: 24px; } .p-Widget.dialogOverlay .dialogTitle i.closeButton { cursor: pointer; -} +} .p-Widget.dialogOverlay .dialogContent { display: flex; @@ -74,6 +74,7 @@ align-content: right; flex-wrap: nowrap; justify-content: flex-end; + min-height: 21px; } input { @@ -98,7 +99,7 @@ input { font-size: var(--theia-ui-font-size1); border-radius: 0; background: transparent; - outline: none; + outline: none; } .p-Widget.dialogOverlay.hidden { diff --git a/packages/filesystem/src/browser/style/file-dialog.css b/packages/filesystem/src/browser/style/file-dialog.css index b920a11bd2f14..1b6e3c3c2b80e 100644 --- a/packages/filesystem/src/browser/style/file-dialog.css +++ b/packages/filesystem/src/browser/style/file-dialog.css @@ -41,7 +41,7 @@ .dialogContent .theia-NavigationPanel, .dialogContent .theia-FiltersPanel { - height: 27px; + min-height: 27px; } .dialogContent .theia-FileNamePanel { diff --git a/packages/plugin-ext/src/api/plugin-api.ts b/packages/plugin-ext/src/api/plugin-api.ts index 92b07142883e9..16a05ad6a4014 100644 --- a/packages/plugin-ext/src/api/plugin-api.ts +++ b/packages/plugin-ext/src/api/plugin-api.ts @@ -24,7 +24,6 @@ import { QueryParameters } from '../common/env'; import { TextEditorCursorStyle } from '../common/editor-options'; import { TextEditorLineNumbersStyle, EndOfLine, OverviewRulerLane, IndentAction, FileOperationOptions } from '../plugin/types-impl'; import { UriComponents } from '../common/uri-components'; -import { PreferenceChange } from '@theia/core/lib/browser'; import { ConfigurationTarget } from '../plugin/types-impl'; import { SerializedDocumentFilter, @@ -810,8 +809,13 @@ export interface PreferenceRegistryMain { resource: any | undefined ): PromiseLike; } + +export interface PreferenceChangeExt { + preferenceName: string, + newValue: any +} export interface PreferenceRegistryExt { - $acceptConfigurationChanged(data: { [key: string]: any }, eventData: PreferenceChange): void; + $acceptConfigurationChanged(data: { [key: string]: any }, eventData: PreferenceChangeExt): void; } export interface OutputChannelRegistryMain { diff --git a/packages/plugin-ext/src/main/browser/preference-registry-main.ts b/packages/plugin-ext/src/main/browser/preference-registry-main.ts index 3b9d93f9617fd..d2d8b3f5d0d21 100644 --- a/packages/plugin-ext/src/main/browser/preference-registry-main.ts +++ b/packages/plugin-ext/src/main/browser/preference-registry-main.ts @@ -51,7 +51,10 @@ export class PreferenceRegistryMainImpl implements PreferenceRegistryMain { preferenceServiceImpl.onPreferenceChanged(e => { const data = getPreferences(this.preferenceProviderProvider); - this.proxy.$acceptConfigurationChanged(data, Object.assign({}, e)); + this.proxy.$acceptConfigurationChanged(data, { + preferenceName: e.preferenceName, + newValue: e.newValue + }); }); } diff --git a/packages/plugin-ext/src/plugin/preference-registry.ts b/packages/plugin-ext/src/plugin/preference-registry.ts index 709d706fb846b..fa74a71b15418 100644 --- a/packages/plugin-ext/src/plugin/preference-registry.ts +++ b/packages/plugin-ext/src/plugin/preference-registry.ts @@ -22,11 +22,11 @@ import { PLUGIN_RPC_CONTEXT, PreferenceRegistryExt, PreferenceRegistryMain, - PreferenceData + PreferenceData, + PreferenceChangeExt } from '../api/plugin-api'; import { RPCProtocol } from '../api/rpc-protocol'; -import { isObject } from '../common/types'; -import { PreferenceChange } from '@theia/core/lib/browser'; +import { isObject, mixin } from '../common/types'; import { Configuration, ConfigurationModel } from './preferences/configuration'; import { WorkspaceExtImpl } from './workspace'; import cloneDeep = require('lodash.clonedeep'); @@ -83,7 +83,7 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt { this._preferences = this.parse(data); } - $acceptConfigurationChanged(data: PreferenceData, eventData: PreferenceChange): void { + $acceptConfigurationChanged(data: PreferenceData, eventData: PreferenceChangeExt): void { this.init(data); this._onDidChangeConfiguration.fire(this.toConfigurationChangeEvent(eventData)); } @@ -179,7 +179,12 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt { return configInspect; } }; - return configuration; + + if (typeof preferences === 'object') { + mixin(configuration, preferences, false); + } + + return Object.freeze(configuration); } private toReadonlyValue(data: any): any { @@ -237,7 +242,7 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt { }, {}); } - private toConfigurationChangeEvent(eventData: PreferenceChange): theia.ConfigurationChangeEvent { + private toConfigurationChangeEvent(eventData: PreferenceChangeExt): theia.ConfigurationChangeEvent { return Object.freeze({ affectsConfiguration: (section: string, uri?: theia.Uri): boolean => { const tree = eventData.preferenceName