Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -8,12 +8,13 @@
import * as sqlops from 'sqlops';
import * as platform from 'vs/platform/registry/common/platform';
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
import { StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { Event, Emitter } from 'vs/base/common/event';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { Memento, Scope as MementoScope } from 'vs/workbench/common/memento';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { Memento } from 'vs/workbench/common/memento';
import AccountStore from 'sql/platform/accountManagement/common/accountStore';
import { AccountDialogController } from 'sql/parts/accountManagement/accountDialog/accountDialogController';
@@ -54,8 +55,8 @@ export class AccountManagementService implements IAccountManagementService {
) {
// Create the account store
if (!this._mementoObj) {
this._mementoContext = new Memento(AccountManagementService.ACCOUNT_MEMENTO);
this._mementoObj = this._mementoContext.getMemento(this._storageService, MementoScope.GLOBAL);
this._mementoContext = new Memento(AccountManagementService.ACCOUNT_MEMENTO, this._storageService);
this._mementoObj = this._mementoContext.getMemento(StorageScope.GLOBAL);
}
this._accountStore = this._instantiationService.createInstance(AccountStore, this._mementoObj);
@@ -67,7 +68,7 @@ export class AccountManagementService implements IAccountManagementService {
// Register status bar item
let statusbarDescriptor = new statusbar.StatusbarItemDescriptor(
AccountListStatusbarItem,
statusbar.StatusbarAlignment.LEFT,
StatusbarAlignment.LEFT,
15000 /* Highest Priority */
);
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(statusbarDescriptor);

View File

@@ -76,6 +76,10 @@ export class ConnectionDialogService implements IConnectionDialogService {
private _connectionErrorTitle = localize('connectionError', 'Connection error');
private _dialogDeferredPromise: Deferred<IConnectionProfile>;
/**
* This is used to work around the interconnectedness of this code
*/
private ignoreNextConnect = false;
private _connectionManagementService: IConnectionManagementService;
constructor(
@@ -87,6 +91,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
@IClipboardService private _clipboardService: IClipboardService,
@ICommandService private _commandService: ICommandService
) { }
/**
* Gets the default provider with the following actions
* 1. Checks if master provider(map) has data
@@ -161,6 +166,13 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
private handleOnCancel(params: INewConnectionParams): void {
if (this.ignoreNextConnect) {
this._connectionDialog.resetConnection();
this._connectionDialog.close();
this.ignoreNextConnect = false;
this._dialogDeferredPromise.resolve(undefined);
return;
}
if (this.uiController.databaseDropdownExpanded) {
this.uiController.closeDatabaseDropdown();
} else {
@@ -182,6 +194,14 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
private handleDefaultOnConnect(params: INewConnectionParams, connection: IConnectionProfile): Thenable<void> {
if (this.ignoreNextConnect) {
this._connectionDialog.resetConnection();
this._connectionDialog.close();
this.ignoreNextConnect = false;
this._connecting = false;
this._dialogDeferredPromise.resolve(connection);
return Promise.resolve();
}
let fromEditor = params && params.connectionType === ConnectionType.editor;
let uri: string = undefined;
if (fromEditor && params && params.input) {
@@ -303,7 +323,12 @@ export class ConnectionDialogService implements IConnectionDialogService {
connectionManagementService: IConnectionManagementService,
params?: INewConnectionParams,
model?: IConnectionProfile,
connectionResult?: IConnectionResult): Thenable<IConnectionProfile> {
connectionResult?: IConnectionResult,
doConnect: boolean = true): Thenable<IConnectionProfile> {
if (!doConnect) {
this.ignoreNextConnect = true;
}
this._dialogDeferredPromise = new Deferred<IConnectionProfile>();
this.showDialog(connectionManagementService, params,
@@ -350,7 +375,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
private doShowDialog(params: INewConnectionParams): TPromise<void> {
if (!this._connectionDialog) {
let container = document.getElementById(this._partService.getWorkbenchElementId()).parentElement;
let container = this._partService.getWorkbenchElement().parentElement;
this._container = container;
this._connectionDialog = this._instantiationService.createInstance(ConnectionDialogWidget, this._providerTypes, this._providerNameToDisplayNameMap[this._model.providerName], this._providerNameToDisplayNameMap);
this._connectionDialog.onCancel(() => {

View File

@@ -25,7 +25,7 @@ import { IWorkbenchThemeService, IColorTheme } from 'vs/workbench/services/theme
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { Event, Emitter } from 'vs/base/common/event';
import { Builder, $ } from 'vs/base/browser/builder';
import { Builder, $ } from 'sql/base/browser/builder';
import { ICancelableEvent } from 'vs/base/parts/tree/browser/treeDefaults';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';

View File

@@ -32,7 +32,7 @@ import { localize } from 'vs/nls';
import * as DOM from 'vs/base/browser/dom';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { OS, OperatingSystem } from 'vs/base/common/platform';
import { Builder, $ } from 'vs/base/browser/builder';
import { Builder, $ } from 'sql/base/browser/builder';
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { endsWith, startsWith } from 'vs/base/common/strings';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@@ -264,7 +264,7 @@ export class ConnectionWidget {
rowContainer.element('td');
rowContainer.element('td', { align: 'right' }, (cellContainer) => {
cellContainer.div({ class: 'advanced-button' }, (divContainer) => {
button = new Button(divContainer);
button = new Button(divContainer.getHTMLElement());
button.label = title;
button.onDidClick(() => {
//open advanced page

View File

@@ -28,6 +28,6 @@ export interface IConnectionDialogService {
* @param model
* @param connectionResult
*/
openDialogAndWait(connectionManagementService: IConnectionManagementService, params?: INewConnectionParams, model?: IConnectionProfile, connectionResult?: IConnectionResult): Thenable<IConnectionProfile>;
openDialogAndWait(connectionManagementService: IConnectionManagementService, params?: INewConnectionParams, model?: IConnectionProfile, connectionResult?: IConnectionResult, doConnect?: boolean): Thenable<IConnectionProfile>;
}

View File

@@ -17,7 +17,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { attachListStyler } from 'vs/platform/theme/common/styler';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IVirtualDelegate, IRenderer } from 'vs/base/browser/ui/list/list';
import { IListVirtualDelegate, IListRenderer } from 'vs/base/browser/ui/list/list';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
@@ -28,8 +28,9 @@ import * as TelemetryKeys from 'sql/common/telemetryKeys';
import { NewDashboardTabViewModel, IDashboardUITab } from 'sql/workbench/services/dashboard/common/newDashboardTabViewModel';
import { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService';
import { Orientation } from 'vs/base/browser/ui/sash/sash';
class ExtensionListDelegate implements IVirtualDelegate<IDashboardUITab> {
class ExtensionListDelegate implements IListVirtualDelegate<IDashboardUITab> {
constructor(
private _height: number
@@ -53,7 +54,7 @@ interface ExtensionListTemplate {
publisher: HTMLElement;
}
class ExtensionListRenderer implements IRenderer<IDashboardUITab, ExtensionListTemplate> {
class ExtensionListRenderer implements IListRenderer<IDashboardUITab, ExtensionListTemplate> {
public static TEMPLATE_ID = 'extensionListRenderer';
private static readonly OPENED_TAB_CLASS = 'success';
private static readonly ICON_CLASS = 'extension-status-icon icon';

View File

@@ -11,7 +11,7 @@ import { Modal } from 'sql/workbench/browser/modal/modal';
import * as TelemetryKeys from 'sql/common/telemetryKeys';
import { attachButtonStyler, attachModalDialogStyler } from 'sql/platform/theme/common/styler';
import { Builder } from 'vs/base/browser/builder';
import { Builder } from 'sql/base/browser/builder';
import Severity from 'vs/base/common/severity';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND } from 'vs/workbench/common/theme';

View File

@@ -19,11 +19,9 @@ import { FileBrowserTreeView } from 'sql/workbench/services/fileBrowser/browser/
import { FileBrowserViewModel } from 'sql/workbench/services/fileBrowser/common/fileBrowserViewModel';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { Builder } from 'vs/base/browser/builder';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Builder } from 'sql/base/browser/builder';
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { Event, Emitter } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { localize } from 'vs/nls';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';

View File

@@ -7,7 +7,7 @@
import { FileNode } from 'sql/workbench/services/fileBrowser/common/fileNode';
import { ITree, IRenderer } from 'vs/base/parts/tree/browser/tree';
import { FileKind } from 'vs/platform/files/common/files';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { FileLabel } from 'vs/workbench/browser/labels';
import { IFileTemplateData } from 'vs/workbench/parts/files/electron-browser/views/explorerViewer';

View File

@@ -252,7 +252,7 @@ export class InsightsDialogView extends Modal {
this._register(this._bottomTable.onContextMenu(e => {
this._contextMenuService.showContextMenu({
getAnchor: () => e.anchor,
getActions: () => TPromise.as([this._instantiationService.createInstance(CopyInsightDialogSelectionAction, CopyInsightDialogSelectionAction.ID, CopyInsightDialogSelectionAction.LABEL)]),
getActions: () => [this._instantiationService.createInstance(CopyInsightDialogSelectionAction, CopyInsightDialogSelectionAction.ID, CopyInsightDialogSelectionAction.LABEL)],
getActionsContext: () => this.bottomInsightContext(this._bottomTableData.getItem(e.cell.row), e.cell)
});
}));
@@ -388,7 +388,7 @@ export class InsightsDialogView extends Modal {
&& this._insight.actions.types.length > 0);
}
private get insightActions(): TPromise<IAction[]> {
private get insightActions(): IAction[] {
let tasks = TaskRegistry.getTasks();
let actions = this._insight.actions.types;
let returnActions: IAction[] = [];
@@ -399,7 +399,7 @@ export class InsightsDialogView extends Modal {
returnActions.push(this._instantiationService.createInstance(ExecuteCommandAction, commandAction.id, commandAction.title));
}
}
return TPromise.as(returnActions);
return returnActions;
}
/**

View File

@@ -73,7 +73,7 @@ export class InsightsDialogController {
filePathArray = filePathArray.filter(i => !!i);
let folder = this._workspaceContextService.getWorkspace().folders.find(i => i.name === filePathArray[0]);
if (!folder) {
return Promise.reject<void>(new Error(`Could not find workspace folder ${filePathArray[0]}`));
return Promise.reject(new Error(`Could not find workspace folder ${filePathArray[0]}`));
}
// remove the folder name from the filepath
filePathArray.shift();

View File

@@ -9,7 +9,7 @@ import * as sqlops from 'sqlops';
import { Event } from 'vs/base/common/event';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { IBootstrapParams } from 'sql/services/bootstrap/bootstrapService';
import { RenderMimeRegistry } from 'sql/parts/notebook/outputs/registry';
import { ModelFactory } from 'sql/parts/notebook/models/modelFactory';

View File

@@ -7,7 +7,7 @@
import { nb } from 'sqlops';
import { localize } from 'vs/nls';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { Registry } from 'vs/platform/registry/common/platform';
import {
@@ -21,7 +21,7 @@ import { SessionManager, noKernel } from 'sql/workbench/services/notebook/common
import { Extensions, INotebookProviderRegistry, NotebookProviderRegistration } from 'sql/workbench/services/notebook/common/notebookRegistry';
import { Emitter, Event } from 'vs/base/common/event';
import { Memento } from 'vs/workbench/common/memento';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IExtensionManagementService, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
@@ -79,7 +79,7 @@ class ProviderDescriptor {
export class NotebookService extends Disposable implements INotebookService {
_serviceBrand: any;
private _memento = new Memento('notebookProviders');
private _memento: Memento;
private _mimeRegistry: RenderMimeRegistry;
private _providers: Map<string, ProviderDescriptor> = new Map();
private _managersMap: Map<string, INotebookManager[]> = new Map();
@@ -109,6 +109,7 @@ export class NotebookService extends Disposable implements INotebookService {
@IQueryManagementService private readonly _queryManagementService
) {
super();
this._memento = new Memento('notebookProviders', this._storageService);
this._register(notebookRegistry.onNewRegistration(this.updateRegisteredProviders, this));
this.registerBuiltInProvider();
@@ -432,7 +433,7 @@ export class NotebookService extends Disposable implements INotebookService {
}
private get providersMemento(): NotebookProvidersMemento {
return this._memento.getMemento(this._storageService) as NotebookProvidersMemento;
return this._memento.getMemento(StorageScope.GLOBAL) as NotebookProvidersMemento;
}
private cleanupProviders(): void {

View File

@@ -11,7 +11,7 @@ import { nb } from 'sqlops';
import * as json from 'vs/base/common/json';
import * as pfs from 'vs/base/node/pfs';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { JSONObject } from 'sql/parts/notebook/models/jsonext';
@@ -40,7 +40,7 @@ export class LocalContentManager implements nb.ContentManager {
return v3.readNotebook(<any>contents);
}
if (contents.nbformat) {
throw new TypeError(localize('nbformatNotRecognized', 'nbformat v{0}.{1} not recognized', contents.nbformat, contents.nbformat_minor));
throw new TypeError(localize('nbformatNotRecognized', 'nbformat v{0}.{1} not recognized', contents.nbformat as any, contents.nbformat_minor as any));
}
} else if (stringContents === '' || stringContents === undefined) {
// Empty?

View File

@@ -90,6 +90,10 @@ export interface IObjectExplorerService {
getNodeActions(connectionId: string, nodePath: string): Thenable<string[]>;
getSessionConnectionProfile(sessionId: string): sqlops.IConnectionProfile;
getSession(sessionId: string): sqlops.ObjectExplorerSession;
providerRegistered(providerId: string): boolean;
}
interface SessionStatus {
@@ -152,6 +156,19 @@ export class ObjectExplorerService implements IObjectExplorerService {
this._onSelectionOrFocusChange = new Emitter<void>();
}
public getSession(sessionId: string): sqlops.ObjectExplorerSession {
let session = this._sessions[sessionId];
if (!session) {
return undefined;
}
let node = this._activeObjectExplorerNodes[session.connection.id];
return node ? node.getSession() : undefined;
}
public providerRegistered(providerId: string): boolean {
return !!this._providers[providerId];
}
public get onUpdateObjectExplorerNodes(): Event<ObjectExplorerNodeEventArgs> {
return this._onUpdateObjectExplorerNodes.event;
}
@@ -576,13 +593,16 @@ export class ObjectExplorerService implements IObjectExplorerService {
}
}
return new TreeNode(nodeInfo.nodeType, nodeInfo.label, isLeaf, nodeInfo.nodePath,
let node = new TreeNode(nodeInfo.nodeType, nodeInfo.label, isLeaf, nodeInfo.nodePath,
nodeInfo.nodeSubType, nodeInfo.nodeStatus, parent, nodeInfo.metadata, nodeInfo.iconType, {
getChildren: treeNode => this.getChildren(treeNode),
isExpanded: treeNode => this.isExpanded(treeNode),
setNodeExpandedState: (treeNode, expandedState) => this.setNodeExpandedState(treeNode, expandedState),
setNodeSelected: (treeNode, selected, clearOtherSelections: boolean = undefined) => this.setNodeSelected(treeNode, selected, clearOtherSelections)
});
node.childProvider = nodeInfo.childProvider;
node.payload = nodeInfo.payload;
return node;
}
public registerServerTreeView(view: ServerTreeView): void {
@@ -657,9 +677,8 @@ export class ObjectExplorerService implements IObjectExplorerService {
*/
public getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
return this.getTreeNode(connectionId, nodePath).then(node => {
return this._serverTreeView.treeActionProvider.getActions(this._serverTreeView.tree, this.getTreeItem(node)).then((actions) => {
return actions.filter(action => action.label).map(action => action.label);
});
let actions = this._serverTreeView.treeActionProvider.getActions(this._serverTreeView.tree, this.getTreeItem(node));
return actions.filter(action => action.label).map(action => action.label);
});
}
@@ -683,6 +702,9 @@ export class ObjectExplorerService implements IObjectExplorerService {
private async setNodeExpandedState(treeNode: TreeNode, expandedState: TreeItemCollapsibleState): Promise<void> {
treeNode = await this.getUpdatedTreeNode(treeNode);
if (!treeNode) {
return Promise.resolve();
}
let expandNode = this.getTreeItem(treeNode);
if (expandedState === TreeItemCollapsibleState.Expanded) {
await this._serverTreeView.reveal(expandNode);
@@ -692,6 +714,9 @@ export class ObjectExplorerService implements IObjectExplorerService {
private async setNodeSelected(treeNode: TreeNode, selected: boolean, clearOtherSelections: boolean = undefined): Promise<void> {
treeNode = await this.getUpdatedTreeNode(treeNode);
if (!treeNode) {
return Promise.resolve();
}
let selectNode = this.getTreeItem(treeNode);
if (selected) {
await this._serverTreeView.reveal(selectNode);
@@ -701,6 +726,9 @@ export class ObjectExplorerService implements IObjectExplorerService {
private async getChildren(treeNode: TreeNode): Promise<TreeNode[]> {
treeNode = await this.getUpdatedTreeNode(treeNode);
if (!treeNode) {
return Promise.resolve([]);
}
if (treeNode.isAlwaysLeaf) {
return [];
}
@@ -712,6 +740,9 @@ export class ObjectExplorerService implements IObjectExplorerService {
private async isExpanded(treeNode: TreeNode): Promise<boolean> {
treeNode = await this.getUpdatedTreeNode(treeNode);
if (!treeNode) {
return false;
}
do {
let expandNode = this.getTreeItem(treeNode);
if (!this._serverTreeView.isExpanded(expandNode)) {
@@ -734,7 +765,8 @@ export class ObjectExplorerService implements IObjectExplorerService {
private getUpdatedTreeNode(treeNode: TreeNode): Promise<TreeNode> {
return this.getTreeNode(treeNode.getConnectionProfile().id, treeNode.nodePath).then(treeNode => {
if (!treeNode) {
throw new Error(nls.localize('treeNodeNoLongerExists', 'The given tree node no longer exists'));
// throw new Error(nls.localize('treeNodeNoLongerExists', 'The given tree node no longer exists'));
return undefined;
}
return treeNode;
});

View File

@@ -19,8 +19,8 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { Scope as MementoScope, Memento } from 'vs/workbench/common/memento';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { Memento } from 'vs/workbench/common/memento';
import { ProfilerFilterDialog } from 'sql/parts/profiler/dialog/profilerFilterDialog';
class TwoWayMap<T, K> {
@@ -66,8 +66,8 @@ export class ProfilerService implements IProfilerService {
@ICommandService private _commandService: ICommandService,
@IStorageService private _storageService: IStorageService
) {
this._context = new Memento('ProfilerEditor');
this._memento = this._context.getMemento(this._storageService, MementoScope.GLOBAL);
this._context = new Memento('ProfilerEditor', this._storageService);
this._memento = this._context.getMemento(StorageScope.GLOBAL);
}
public registerProvider(providerId: string, provider: sqlops.ProfilerProvider): void {

View File

@@ -21,7 +21,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
import Severity from 'vs/base/common/severity';
import nls = require('vs/nls');
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import paths = require('vs/base/common/paths');
import { isLinux } from 'vs/base/common/platform';
import { Schemas } from 'vs/base/common/network';
@@ -29,6 +29,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { EditDataResultsInput } from 'sql/parts/editData/common/editDataResultsInput';
import { IEditorInput, IEditor } from 'vs/workbench/common/editor';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ILanguageSelection } from 'vs/editor/common/services/modeService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const fs = require('fs');
@@ -74,7 +75,7 @@ export class QueryEditorService implements IQueryEditorService {
* Creates new untitled document for SQL query and opens in new editor tab
*/
public newSqlEditor(sqlContent?: string, connectionProviderName?: string, isDirty?: boolean): Promise<IConnectableInput> {
return new Promise<IConnectableInput>((resolve, reject) => {
return new Promise<IConnectableInput>(async (resolve, reject) => {
try {
// Create file path and file URI
let filePath = this.createUntitledSqlFilePath();
@@ -82,14 +83,13 @@ export class QueryEditorService implements IQueryEditorService {
// Create a sql document pane with accoutrements
const fileInput = this._untitledEditorService.createOrGet(docUri, 'sql');
fileInput.resolve().then(m => {
if (sqlContent) {
m.textEditorModel.setValue(sqlContent);
if (isDirty === false || (isDirty === undefined && !this._configurationService.getValue<boolean>('sql.promptToSaveGeneratedFiles'))) {
m.setDirty(false);
}
let untitledEditorModel = await fileInput.resolve();
if (sqlContent) {
untitledEditorModel.textEditorModel.setValue(sqlContent);
if (isDirty === false || (isDirty === undefined && !this._configurationService.getValue<boolean>('sql.promptToSaveGeneratedFiles'))) {
untitledEditorModel.setDirty(false);
}
});
}
const queryResultsInput: QueryResultsInput = this._instantiationService.createInstance(QueryResultsInput, docUri.toString());
let queryInput: QueryInput = this._instantiationService.createInstance(QueryInput, '', fileInput, queryResultsInput, connectionProviderName);
@@ -195,12 +195,12 @@ export class QueryEditorService implements IQueryEditorService {
* In all other cases (when SQL is involved in the language change and the editor is not dirty),
* returns a promise that will resolve when the old editor has been replaced by a new editor.
*/
public static sqlLanguageModeCheck(model: ITextModel, mode: IMode, editor: IEditor): Promise<ITextModel> {
if (!model || !mode || !editor) {
public static sqlLanguageModeCheck(model: ITextModel, languageSelection: ILanguageSelection, editor: IEditor): Promise<ITextModel> {
if (!model || !languageSelection || !editor) {
return Promise.resolve(undefined);
}
let newLanguage: string = mode.getLanguageIdentifier().language;
let newLanguage: string = languageSelection.languageIdentifier.language;
let oldLanguage: string = model.getLanguageIdentifier().language;
let changingToSql = sqlModeId === newLanguage;
let changingFromSql = sqlModeId === oldLanguage;

View File

@@ -7,7 +7,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import { IConnectableInput } from 'sql/platform/connection/common/connectionManagement';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
export interface IQueryEditorOptions extends IEditorOptions {