mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 17:22:59 -05:00
VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)
* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9 * delete unused folders * distro * Bump build node version * update chokidar * FIx hygiene errors * distro * Fix extension lint issues * Remove strict-vscode * Add copyright header exemptions * Bump vscode-extension-telemetry to fix webpacking issue with zone.js * distro * Fix failing tests (revert marked.js back to current one until we decide to update) * Skip searchmodel test * Fix mac build * temp debug script loading * Try disabling coverage * log error too * Revert "log error too" This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f. * Revert "temp debug script loading" This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c. * Add comments explaining coverage disabling * Fix ansi_up loading issue * Merge latest from ads * Use newer option * Fix compile * add debug logging warn * Always log stack * log more * undo debug * Update to use correct base path (+cleanup) * distro * fix compile errors * Remove strict-vscode * Fix sql editors not showing * Show db dropdown input & fix styling * Fix more info in gallery * Fix gallery asset requests * Delete unused workflow * Fix tapable resolutions for smoke test compile error * Fix smoke compile * Disable crash reporting * Disable interactive Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IConfigurationRegistry, Extensions as ConfigExtensions, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
@@ -29,9 +29,9 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWo
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { TimeElapsedStatusBarContributions, RowCountStatusBarContributions, QueryStatusStatusBarContributions, QueryResultSelectionSummaryStatusBarContribution } from 'sql/workbench/contrib/query/browser/statusBarItems';
|
||||
import { SqlFlavorStatusbarItem, ChangeFlavorAction } from 'sql/workbench/contrib/query/browser/flavorStatus';
|
||||
import { EditorExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
|
||||
import { EditorExtensions, IEditorFactoryRegistry } from 'vs/workbench/common/editor';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
|
||||
import { FileQueryEditorInputSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorInputSerializer } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { FileQueryEditorSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorSerializer } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
|
||||
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
|
||||
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { NewQueryTask, OE_NEW_QUERY_ACTION_ID, DE_NEW_QUERY_COMMAND_ID } from 'sql/workbench/contrib/query/browser/queryActions';
|
||||
@@ -44,7 +44,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IEditorOverrideService, ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -52,20 +52,20 @@ export const QueryEditorVisibleCondition = ContextKeyExpr.has(queryContext.query
|
||||
export const ResultsGridFocusCondition = ContextKeyExpr.and(ContextKeyExpr.has(queryContext.resultsVisibleId), ContextKeyExpr.has(queryContext.resultsGridFocussedId));
|
||||
export const ResultsMessagesFocusCondition = ContextKeyExpr.and(ContextKeyExpr.has(queryContext.resultsVisibleId), ContextKeyExpr.has(queryContext.resultsMessagesFocussedId));
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(FileQueryEditorInput.ID, FileQueryEditorInputSerializer);
|
||||
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
|
||||
.registerEditorSerializer(FileQueryEditorInput.ID, FileQueryEditorSerializer);
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(UntitledQueryEditorInput.ID, UntitledQueryEditorInputSerializer);
|
||||
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
|
||||
.registerEditorSerializer(UntitledQueryEditorInput.ID, UntitledQueryEditorSerializer);
|
||||
|
||||
Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.LanguageAssociations)
|
||||
.registerLanguageAssociation(QueryEditorLanguageAssociation.languages, QueryEditorLanguageAssociation, QueryEditorLanguageAssociation.isDefault);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(EditorDescriptor.create(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(EditorPaneDescriptor.create(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(EditorDescriptor.create(QueryEditor, QueryEditor.ID, QueryEditor.LABEL), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(EditorPaneDescriptor.create(QueryEditor, QueryEditor.ID, QueryEditor.LABEL), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
|
||||
|
||||
const actionRegistry = <IWorkbenchActionRegistry>Registry.as(ActionExtensions.WorkbenchActions);
|
||||
|
||||
@@ -500,7 +500,7 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
constructor(
|
||||
@ILogService private _logService: ILogService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IEditorOverrideService private _editorOverrideService: IEditorOverrideService,
|
||||
@IEditorResolverService private _editorResolverService: IEditorResolverService,
|
||||
@IModeService private _modeService: IModeService
|
||||
) {
|
||||
super();
|
||||
@@ -523,26 +523,23 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
// Create the selector from the list of all the language extensions we want to associate with the
|
||||
// query editor (filtering out any languages which didn't have any extensions registered yet)
|
||||
const selector = `*{${langExtensions.join(',')}}`;
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
|
||||
this._registeredOverrides.add(this._editorResolverService.registerEditor(
|
||||
selector,
|
||||
{
|
||||
id: QueryEditor.ID,
|
||||
label: QueryEditor.LABEL,
|
||||
describes: (currentEditor) => currentEditor instanceof FileQueryEditorInput,
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(resource, options, group) => {
|
||||
const fileInput = this._editorService.createEditorInput({
|
||||
resource: resource
|
||||
}) as FileEditorInput;
|
||||
(editorInput, group) => {
|
||||
const fileInput = this._editorService.createEditorInput(editorInput) as FileEditorInput;
|
||||
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(lang);
|
||||
const queryEditorInput = langAssociation?.syncConvertInput?.(fileInput);
|
||||
if (!queryEditorInput) {
|
||||
this._logService.warn('Unable to create input for overriding editor ', resource);
|
||||
this._logService.warn('Unable to create input for resolving editor ', editorInput.resource);
|
||||
return undefined;
|
||||
}
|
||||
return { editor: queryEditorInput, options: options, group: group };
|
||||
return { editor: queryEditorInput, options: editorInput.options, group: group };
|
||||
}
|
||||
));
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'vs/css!./media/queryActions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Action, IActionRunner } from 'vs/base/common/actions';
|
||||
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -583,6 +583,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
// CONSTRUCTOR /////////////////////////////////////////////////////////
|
||||
constructor(
|
||||
private _editor: QueryEditor,
|
||||
public action: IAction,
|
||||
@IContextViewService contextViewProvider: IContextViewService,
|
||||
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
|
||||
@@ -42,6 +42,7 @@ import { IRange } from 'vs/editor/common/core/range';
|
||||
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ConnectionOptionSpecialType } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
@@ -109,11 +110,12 @@ export class QueryEditor extends EditorPane {
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IModeService private readonly modeService: IModeService,
|
||||
@ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService,
|
||||
@ICapabilitiesService private readonly capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
super(QueryEditor.ID, telemetryService, themeService, storageService);
|
||||
|
||||
this.editorMemento = this.getEditorMemento<IQueryEditorViewState>(editorGroupService, QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
|
||||
this.editorMemento = this.getEditorMemento<IQueryEditorViewState>(editorGroupService, textResourceConfigurationService, QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
|
||||
|
||||
this.queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
|
||||
|
||||
@@ -122,14 +124,21 @@ export class QueryEditor extends EditorPane {
|
||||
}
|
||||
|
||||
private onFilesChanged(e: FileChangesEvent): void {
|
||||
const deleted = e.getDeleted();
|
||||
if (deleted && deleted.length) {
|
||||
this.clearTextEditorViewState(deleted.map(d => d.resource));
|
||||
const deleted = e.rawDeleted;
|
||||
if (!deleted) {
|
||||
return;
|
||||
}
|
||||
const changes = [];
|
||||
for (const [, change] of deleted) {
|
||||
changes.push(change);
|
||||
}
|
||||
if (changes.length) {
|
||||
this.clearTextEditorViewState(changes.map(d => d.resource));
|
||||
}
|
||||
}
|
||||
|
||||
protected override getEditorMemento<T>(editorGroupService: IEditorGroupsService, key: string, limit: number = 10): IEditorMemento<T> {
|
||||
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService); // do not persist in storage as results are never persisted
|
||||
protected override getEditorMemento<T>(editorGroupService: IEditorGroupsService, configurationService: ITextResourceConfigurationService, key: string, limit: number = 10): IEditorMemento<T> {
|
||||
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService, configurationService); // do not persist in storage as results are never persisted
|
||||
}
|
||||
|
||||
// PUBLIC METHODS ////////////////////////////////////////////////////////////
|
||||
@@ -222,9 +231,9 @@ export class QueryEditor extends EditorPane {
|
||||
this._changeConnectionAction.enabled = this.input.state.connected;
|
||||
this.setTaskbarContent();
|
||||
if (this.input.state.connected) {
|
||||
this.listDatabasesActionItem.onConnected();
|
||||
this.listDatabasesActionItem?.onConnected();
|
||||
} else {
|
||||
this.listDatabasesActionItem.onDisconnect();
|
||||
this.listDatabasesActionItem?.onDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,17 +268,17 @@ export class QueryEditor extends EditorPane {
|
||||
*/
|
||||
private _getActionItemForAction(action: IAction): IActionViewItem {
|
||||
if (action.id === actions.ListDatabasesAction.ID) {
|
||||
return this.listDatabasesActionItem;
|
||||
if (!this._listDatabasesActionItem) {
|
||||
this._listDatabasesActionItem = this.instantiationService.createInstance(actions.ListDatabasesActionItem, this, action);
|
||||
this._register(this._listDatabasesActionItem.attachStyler(this.themeService));
|
||||
}
|
||||
return this._listDatabasesActionItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private get listDatabasesActionItem(): actions.ListDatabasesActionItem {
|
||||
if (!this._listDatabasesActionItem) {
|
||||
this._listDatabasesActionItem = this.instantiationService.createInstance(actions.ListDatabasesActionItem, this);
|
||||
this._register(this._listDatabasesActionItem.attachStyler(this.themeService));
|
||||
}
|
||||
private get listDatabasesActionItem(): actions.ListDatabasesActionItem | undefined {
|
||||
return this._listDatabasesActionItem;
|
||||
}
|
||||
|
||||
@@ -324,7 +333,7 @@ export class QueryEditor extends EditorPane {
|
||||
public override async setInput(newInput: QueryEditorInput, options: IEditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
const oldInput = this.input;
|
||||
|
||||
if (newInput.matches(oldInput)) {
|
||||
if (oldInput && newInput.matches(oldInput)) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEditorInputFactoryRegistry, IEditorInput, IEditorInputSerializer, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { IEditorFactoryRegistry, IEditorInput, IEditorSerializer, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
@@ -24,7 +24,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
|
||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
||||
|
||||
const editorInputFactoryRegistry = Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories);
|
||||
const editorFactoryRegistry = Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory);
|
||||
|
||||
export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
static readonly isDefault = true;
|
||||
@@ -99,13 +99,13 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
}
|
||||
}
|
||||
|
||||
export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
export class FileQueryEditorSerializer implements IEditorSerializer {
|
||||
|
||||
constructor(@IFileService private readonly fileService: IFileService) {
|
||||
|
||||
}
|
||||
serialize(editorInput: FileQueryEditorInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
|
||||
if (factory) {
|
||||
return factory.serialize(editorInput.text); // serialize based on the underlying input
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileQueryEditorInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
|
||||
// only successfully deserilize the file if the resource actually exists
|
||||
if (this.fileService.exists(fileEditorInput.resource)) {
|
||||
@@ -130,11 +130,11 @@ export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
export class UntitledQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
export class UntitledQueryEditorSerializer implements IEditorSerializer {
|
||||
|
||||
constructor(@IConfigurationService private readonly configurationService: IConfigurationService) { }
|
||||
serialize(editorInput: UntitledQueryEditorInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
|
||||
// only serialize non-dirty files if the user has that setting
|
||||
if (factory && (editorInput.isDirty() || this.configurationService.getValue<IQueryEditorConfiguration>('queryEditor').promptToSaveGeneratedFiles)) {
|
||||
return factory.serialize(editorInput.text); // serialize based on the underlying input
|
||||
@@ -143,7 +143,7 @@ export class UntitledQueryEditorInputSerializer implements IEditorInputSerialize
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledQueryEditorInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
|
||||
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
|
||||
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, untitledEditorInput.resource.toString());
|
||||
return instantiationService.createInstance(UntitledQueryEditorInput, '', untitledEditorInput, queryResultsInput);
|
||||
@@ -21,7 +21,7 @@ import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { TestFileService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestFileService, TestTextResourceConfigurationService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
@@ -51,7 +51,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
editor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
|
||||
editor.setup(x => x.getSelection()).returns(() => undefined);
|
||||
@@ -101,7 +101,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
editor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
|
||||
// If I create a QueryTaskbarAction and I pass a non-connected editor to _getConnectedQueryEditorUri
|
||||
@@ -193,7 +193,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => queryInput.object);
|
||||
queryEditor.setup(x => x.getSelection()).returns(() => undefined);
|
||||
queryEditor.setup(x => x.getSelection(false)).returns(() => undefined);
|
||||
@@ -248,7 +248,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => queryInput.object);
|
||||
queryEditor.setup(x => x.isSelectionEmpty()).returns(() => false);
|
||||
queryEditor.setup(x => x.getSelection()).returns(() => {
|
||||
@@ -472,7 +472,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
|
||||
|
||||
// If I query without having initialized anything, state should be clear
|
||||
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
|
||||
assert.strictEqual(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
|
||||
assert.strictEqual(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
|
||||
@@ -505,7 +505,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
|
||||
|
||||
// ... Create a database dropdown that has been connected
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
listItem.onConnected();
|
||||
|
||||
// If: I raise a connection changed event
|
||||
@@ -529,7 +529,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
|
||||
|
||||
// ... Create a database dropdown that has been connected
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
listItem.onConnected();
|
||||
|
||||
// If: I raise a connection changed event for the 'wrong' URI
|
||||
@@ -554,7 +554,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
|
||||
|
||||
// ... Create a database dropdown
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
|
||||
// If: I raise a connection changed event
|
||||
let eventParams = <IConnectionParams>{
|
||||
@@ -579,7 +579,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
// mocking query editor
|
||||
const contextkeyservice = new MockContextKeyService();
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
queryEditor.setup(x => x.getSelection(false)).returns(() => { return predefinedSelection; });
|
||||
|
||||
@@ -636,7 +636,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
// mocking query editor
|
||||
const contextkeyservice = new MockContextKeyService();
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
|
||||
// mocking isConnected in ConnectionManagementService
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { IEditorDescriptor } from 'vs/workbench/browser/editor';
|
||||
import { IEditorPaneDescriptor } from 'vs/workbench/browser/editor';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
@@ -64,7 +64,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => {
|
||||
if (classDef.ID) {
|
||||
if (classDef.ID === 'listDatabaseQueryActionItem') {
|
||||
return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, undefined);
|
||||
return new ListDatabasesActionItem(editor, action, undefined, connectionManagementService.object, undefined, undefined);
|
||||
}
|
||||
}
|
||||
// Default
|
||||
@@ -72,7 +72,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
});
|
||||
|
||||
// Mock EditorDescriptorService to give us a mock editor description
|
||||
let descriptor: IEditorDescriptor = {
|
||||
let descriptor: IEditorPaneDescriptor = {
|
||||
typeId: 'id',
|
||||
name: 'name',
|
||||
describes: function (obj: any): boolean { return true; },
|
||||
@@ -292,7 +292,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||
.returns((definition, editor, action, selectBox) => {
|
||||
if (definition.ID === 'listDatabaseQueryActionItem') {
|
||||
let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let item = new ListDatabasesActionItem(editor, action, undefined, connectionManagementService.object, undefined, undefined);
|
||||
return item;
|
||||
}
|
||||
// Default
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { workbenchInstantiationService } from 'sql/workbench/test/workbenchTestServices';
|
||||
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { TestObjectExplorerService } from 'sql/workbench/services/objectExplorer/test/browser/testObjectExplorerService';
|
||||
|
||||
Reference in New Issue
Block a user