From d6b5d3c6b1c717a02e791175417b5d31c5b017b3 Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Wed, 26 Feb 2020 21:11:48 -0800 Subject: [PATCH] implement editor move and fix disposal error in query editor (#9281) --- .../workbench/common/editor/query/queryEditorInput.ts | 11 ++++------- .../contrib/query/common/fileQueryEditorInput.ts | 7 ++++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/sql/workbench/common/editor/query/queryEditorInput.ts b/src/sql/workbench/common/editor/query/queryEditorInput.ts index 785b4050ce..2b87c51625 100644 --- a/src/sql/workbench/common/editor/query/queryEditorInput.ts +++ b/src/sql/workbench/common/editor/query/queryEditorInput.ts @@ -193,10 +193,6 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab public isDirty(): boolean { return this._text.isDirty(); } public get resource(): URI { return this._text.resource; } - public matchInputInstanceType(inputType: any): boolean { - return (this._text instanceof inputType); - } - public getName(longForm?: boolean): string { if (this.configurationService.getValue('sql.showConnectionInfoInTitle')) { let profile = this.connectionManagementService.getConnectionProfile(this.uri); @@ -289,7 +285,9 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab public onDisconnect(): void { this.state.connected = false; - this._onDidChangeLabel.fire(); + if (!this.isDisposed()) { + this._onDidChangeLabel.fire(); + } } public onRunQuery(): void { @@ -309,10 +307,9 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab } public dispose() { + super.dispose(); // we want to dispose first so that for future logic we know we are disposed this.queryModelService.disposeQuery(this.uri); this.connectionManagementService.disconnectEditor(this, true); - - super.dispose(); } public get isSharedSession(): boolean { diff --git a/src/sql/workbench/contrib/query/common/fileQueryEditorInput.ts b/src/sql/workbench/contrib/query/common/fileQueryEditorInput.ts index bb15190fb6..bc2fef89f7 100644 --- a/src/sql/workbench/contrib/query/common/fileQueryEditorInput.ts +++ b/src/sql/workbench/contrib/query/common/fileQueryEditorInput.ts @@ -10,9 +10,10 @@ import { IQueryModelService } from 'sql/workbench/services/query/common/queryMod import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { EncodingMode } from 'vs/workbench/common/editor'; +import { EncodingMode, IMoveResult, GroupIdentifier } from 'vs/workbench/common/editor'; import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel'; import { ITextFileEditorModel } from 'vs/workbench/services/textfile/common/textfiles'; +import { URI } from 'vs/base/common/uri'; type PublicPart = { [K in keyof T]: T[K] }; @@ -82,4 +83,8 @@ export class FileQueryEditorInput extends QueryEditorInput implements PublicPart public isResolved(): boolean { return this.text.isResolved(); } + + public move(group: GroupIdentifier, target: URI): IMoveResult { + return this.text.move(group, target); + } }