Query editor input titles (#9512)

* address untitled editor file name differences; remove feature for updating title for untitled to content

* add tests for new methods

* fix tests

* fix up tests

* remove unncessary await

* revert changes to title for content
This commit is contained in:
Anthony Dresser
2020-03-11 12:42:13 -07:00
committed by GitHub
parent edd396f0fe
commit dbc20c1f67
9 changed files with 156 additions and 24 deletions

View File

@@ -0,0 +1,31 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
import { IConnectableInput } from 'sql/platform/connection/common/connectionManagement';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
export class TestQueryEditorService implements IQueryEditorService {
_serviceBrand: undefined;
constructor(
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IEditorService private readonly editorService: IEditorService) {
}
newSqlEditor(sqlContent?: string, connectionProviderName?: string, isDirty?: boolean, objectName?: string): Promise<IConnectableInput> {
const base = this.editorService.createInput({ forceUntitled: true }) as UntitledTextEditorInput;
return Promise.resolve(this.instantiationService.createInstance(UntitledQueryEditorInput, '', base, new QueryResultsInput(base.resource.toString(true))));
}
newEditDataEditor(schemaName: string, tableName: string, queryString: string): Promise<IConnectableInput> {
throw new Error('Method not implemented.');
}
}