From 6aff2195c781c3432b45e352497a370e1d2d55f3 Mon Sep 17 00:00:00 2001 From: Sven Efftinge Date: Thu, 7 Feb 2019 13:42:46 +0000 Subject: [PATCH 1/4] [dialogs] fix bad vertical resizing behavior Signed-off-by: Sven Efftinge --- packages/core/src/browser/style/dialog.css | 7 ++++--- packages/filesystem/src/browser/style/file-dialog.css | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) 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 { From da26d1dd67ac9a77d3ffa494b2156ee4881df0c7 Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Tue, 5 Feb 2019 15:27:58 +0000 Subject: [PATCH 2/4] fix #4258: align preference default values by type with vscode Signed-off-by: Anton Kosyakov --- .../preferences/preference-contribution.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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); } From ed7f27d0b918e5fdf867c5f38906bd3462bf9b3c Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Tue, 5 Feb 2019 16:16:13 +0000 Subject: [PATCH 3/4] [plugin] fix #4259: support read-only configuration index access Signed-off-by: Anton Kosyakov --- packages/plugin-ext/src/plugin/preference-registry.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/plugin-ext/src/plugin/preference-registry.ts b/packages/plugin-ext/src/plugin/preference-registry.ts index 709d706fb846b..fa492d5efe616 100644 --- a/packages/plugin-ext/src/plugin/preference-registry.ts +++ b/packages/plugin-ext/src/plugin/preference-registry.ts @@ -25,7 +25,7 @@ import { PreferenceData } from '../api/plugin-api'; import { RPCProtocol } from '../api/rpc-protocol'; -import { isObject } from '../common/types'; +import { isObject, mixin } from '../common/types'; import { PreferenceChange } from '@theia/core/lib/browser'; import { Configuration, ConfigurationModel } from './preferences/configuration'; import { WorkspaceExtImpl } from './workspace'; @@ -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 { From ba4c62a63bd5a3c3d89e97ca6ee36a2c37da75fd Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Thu, 7 Feb 2019 15:50:36 +0000 Subject: [PATCH 4/4] [plugin] fix #4280: serialize preference change event properly Signed-off-by: Anton Kosyakov --- packages/plugin-ext/src/api/plugin-api.ts | 8 ++++++-- .../src/main/browser/preference-registry-main.ts | 5 ++++- packages/plugin-ext/src/plugin/preference-registry.ts | 8 ++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/plugin-ext/src/api/plugin-api.ts b/packages/plugin-ext/src/api/plugin-api.ts index 2fdd7e9299f51..236e5cad28706 100644 --- a/packages/plugin-ext/src/api/plugin-api.ts +++ b/packages/plugin-ext/src/api/plugin-api.ts @@ -23,7 +23,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, @@ -727,8 +726,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 fa492d5efe616..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, mixin } from '../common/types'; -import { PreferenceChange } from '@theia/core/lib/browser'; 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)); } @@ -242,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