From 4ae0daa17fb998d1dcd80fe024f54e9ad669ec85 Mon Sep 17 00:00:00 2001 From: Kevin Cunnane Date: Thu, 30 Aug 2018 09:52:58 -0700 Subject: [PATCH] Fix editor URI when properties are set in extension (#2360) * Actually fix editorUri property - Fix by always setting on property update, otherwise it can be lost. * Add comment --- src/sql/parts/modelComponents/editor.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sql/parts/modelComponents/editor.component.ts b/src/sql/parts/modelComponents/editor.component.ts index dbc0a9d102..6b61eb0035 100644 --- a/src/sql/parts/modelComponents/editor.component.ts +++ b/src/sql/parts/modelComponents/editor.component.ts @@ -80,7 +80,7 @@ export default class EditorComponent extends ComponentBase implements IComponent let uri = URI.from({ scheme: Schemas.untitled, path: `${this.descriptor.type}-${this.descriptor.id}` }); // Use this to set the internal (immutable) and public (shared with extension) uri properties this._uri = uri.toString(); - this.uri = this._uri; + this.editorUri = this._uri; return uri; } @@ -133,7 +133,8 @@ export default class EditorComponent extends ComponentBase implements IComponent if (this.languageMode !== this._languageMode) { this.updateLanguageMode(); } - // Intentionally not setting URI for now as it is readonly. + // Intentionally always updating editorUri as it's wiped out by parent setProperties call. + this.editorUri = this._uri; } // CSS-bound properties @@ -161,11 +162,11 @@ export default class EditorComponent extends ComponentBase implements IComponent this.setPropertyFromUI((properties, position) => { properties.position = position; }, newValue); } - public get uri(): string { + public get editorUri(): string { return this.getPropertyOrDefault((props) => props.editorUri, ''); } - public set uri(newValue: string) { + public set editorUri(newValue: string) { this.setPropertyFromUI((properties, editorUri) => { properties.editorUri = editorUri; }, newValue); } }