mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 18:46:34 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -11,7 +11,6 @@ import { IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IQuickOpenService, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import errors = require('vs/base/common/errors');
|
||||
@@ -23,6 +22,8 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
|
||||
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
|
||||
|
||||
import { DidChangeLanguageFlavorParams } from 'sqlops';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export interface ISqlProviderEntry extends IPickOpenEntry {
|
||||
providerId: string;
|
||||
@@ -173,7 +174,7 @@ export class ChangeFlavorAction extends Action {
|
||||
actionLabel: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
) {
|
||||
super(actionId, actionLabel);
|
||||
@@ -213,7 +214,11 @@ export class ChangeFlavorAction extends Action {
|
||||
}
|
||||
|
||||
private _showMessage(sev: Severity, message: string): TPromise<any> {
|
||||
this._messageService.show(sev, message);
|
||||
this._notificationService.notify({
|
||||
severity: sev,
|
||||
message: message
|
||||
});
|
||||
|
||||
return TPromise.as(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> { return this._sql.resolve(); }
|
||||
public save(): TPromise<boolean> { return this._sql.save(); }
|
||||
public isDirty(): boolean { return this._sql.isDirty(); }
|
||||
public confirmSave(): ConfirmResult { return this._sql.confirmSave(); }
|
||||
public confirmSave(): TPromise<ConfirmResult> { return this._sql.confirmSave(); }
|
||||
public getResource(): URI { return this._sql.getResource(); }
|
||||
public getEncoding(): string { return this._sql.getEncoding(); }
|
||||
public suggestFileName(): string { return this._sql.suggestFileName(); }
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ISaveRequest, SaveFormat } from 'sql/parts/grid/common/interfaces';
|
||||
import * as PathUtilities from 'sql/common/pathUtilities';
|
||||
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IOutputService, IOutputChannel, IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/parts/output/common/output';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -21,13 +20,16 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as pretty from 'pretty-data';
|
||||
|
||||
import { ISlickRange } from 'angular2-slickgrid';
|
||||
import * as path from 'path';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
let prevSavePath: string;
|
||||
|
||||
@@ -43,7 +45,6 @@ export class ResultSerializer {
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@IOutputService private _outputService: IOutputService,
|
||||
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
|
||||
@@ -51,7 +52,8 @@ export class ResultSerializer {
|
||||
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
|
||||
@IWindowsService private _windowsService: IWindowsService,
|
||||
@IWindowService private _windowService: IWindowService,
|
||||
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService
|
||||
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
|
||||
@INotificationService private _notificationService: INotificationService
|
||||
) { }
|
||||
|
||||
/**
|
||||
@@ -62,11 +64,12 @@ export class ResultSerializer {
|
||||
this._uri = uri;
|
||||
|
||||
// prompt for filepath
|
||||
let filePath = self.promptForFilepath(saveRequest);
|
||||
if (filePath) {
|
||||
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
return self.promptForFilepath(saveRequest).then(filePath => {
|
||||
if (filePath) {
|
||||
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +106,7 @@ export class ResultSerializer {
|
||||
private getUntitledFileUri(columnName: string): URI {
|
||||
let fileName = columnName;
|
||||
|
||||
let uri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
|
||||
let uri: URI = URI.from({ scheme: Schemas.untitled, path: fileName });
|
||||
|
||||
// If the current filename is taken, try another up to a max number
|
||||
if (this._untitledEditorService.exists(uri)) {
|
||||
@@ -111,7 +114,7 @@ export class ResultSerializer {
|
||||
while (i < ResultSerializer.MAX_FILENAMES
|
||||
&& this._untitledEditorService.exists(uri)) {
|
||||
fileName = [columnName, i.toString()].join('-');
|
||||
uri = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
|
||||
uri = URI.from({ scheme: Schemas.untitled, path: fileName });
|
||||
i++;
|
||||
}
|
||||
if (this._untitledEditorService.exists(uri)) {
|
||||
@@ -140,16 +143,16 @@ export class ResultSerializer {
|
||||
this.outputChannel.append(message);
|
||||
}
|
||||
|
||||
private promptForFilepath(saveRequest: ISaveRequest): string {
|
||||
private promptForFilepath(saveRequest: ISaveRequest): Thenable<string> {
|
||||
let filepathPlaceHolder = (prevSavePath) ? prevSavePath : PathUtilities.resolveCurrentDirectory(this._uri, this.rootPath);
|
||||
filepathPlaceHolder = path.join(filepathPlaceHolder, this.getResultsDefaultFilename(saveRequest));
|
||||
|
||||
let filePath: string = this._windowService.showSaveDialog({
|
||||
return this._windowService.showSaveDialog({
|
||||
title: nls.localize('resultsSerializer.saveAsFileTitle', 'Choose Results File'),
|
||||
defaultPath: paths.normalize(filepathPlaceHolder, true)
|
||||
}).then(filePath => {
|
||||
prevSavePath = filePath;
|
||||
return Promise.resolve(filePath);
|
||||
});
|
||||
prevSavePath = filePath;
|
||||
return filePath;
|
||||
}
|
||||
|
||||
private getResultsDefaultFilename(saveRequest: ISaveRequest): string {
|
||||
@@ -249,10 +252,16 @@ export class ResultSerializer {
|
||||
// send message to the sqlserverclient for converting results to the requested format and saving to filepath
|
||||
return this._queryManagementService.saveResults(saveResultsParams).then(result => {
|
||||
if (result.messages) {
|
||||
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + result.messages);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: LocalizedConstants.msgSaveFailed + result.messages
|
||||
});
|
||||
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + result.messages);
|
||||
} else {
|
||||
this._messageService.show(Severity.Info, LocalizedConstants.msgSaveSucceeded + this._filePath);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
message: LocalizedConstants.msgSaveSucceeded + this._filePath
|
||||
});
|
||||
this.logToOutputChannel(LocalizedConstants.msgSaveSucceeded + filePath);
|
||||
this.openSavedFile(this._filePath, format);
|
||||
}
|
||||
@@ -260,7 +269,10 @@ export class ResultSerializer {
|
||||
// Telemetry.sendTelemetryEvent('SavedResults', { 'type': format });
|
||||
|
||||
}, error => {
|
||||
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: LocalizedConstants.msgSaveFailed + error
|
||||
});
|
||||
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + error);
|
||||
});
|
||||
}
|
||||
@@ -280,7 +292,10 @@ export class ResultSerializer {
|
||||
this._editorService.openEditor({ resource: uri }).then((result) => {
|
||||
|
||||
}, (error: any) => {
|
||||
this._messageService.show(Severity.Error, error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: error
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -296,7 +311,10 @@ export class ResultSerializer {
|
||||
(success) => {
|
||||
},
|
||||
(error: any) => {
|
||||
this._messageService.show(Severity.Error, error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: error
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
import { ISelectionData } from 'sqlops';
|
||||
@@ -24,6 +23,8 @@ import {
|
||||
} from 'sql/parts/connection/common/connectionManagement';
|
||||
import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
/**
|
||||
* Action class that query-based Actions will extend. This base class automatically handles activating and
|
||||
@@ -436,7 +437,7 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
|
||||
private _editor: QueryEditor,
|
||||
private _action: ListDatabasesAction,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IContextViewService contextViewProvider: IContextViewService,
|
||||
@IThemeService themeService: IThemeService
|
||||
) {
|
||||
@@ -514,14 +515,19 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
|
||||
result => {
|
||||
if (!result) {
|
||||
this.resetDatabaseName();
|
||||
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failed', "Failed to change database"));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('changeDatabase.failed', "Failed to change database")
|
||||
});
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.resetDatabaseName();
|
||||
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error));
|
||||
}
|
||||
);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private getCurrentDatabaseName() {
|
||||
|
||||
@@ -21,11 +21,12 @@ import * as nls from 'vs/nls';
|
||||
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import * as platform from 'vs/platform/registry/common/platform';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
const selectionSnippetMaxLen = 100;
|
||||
|
||||
@@ -76,7 +77,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
// CONSTRUCTOR /////////////////////////////////////////////////////////
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IMessageService private _messageService: IMessageService
|
||||
@INotificationService private _notificationService: INotificationService
|
||||
) {
|
||||
this._queryInfoMap = new Map<string, QueryInfo>();
|
||||
this._onRunQueryStart = new Emitter<string>();
|
||||
@@ -179,7 +180,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
}
|
||||
|
||||
public showCommitError(error: string): void {
|
||||
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error
|
||||
});
|
||||
}
|
||||
|
||||
public isRunningQuery(uri: string): boolean {
|
||||
@@ -330,7 +334,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
queryRunner.cancelQuery().then(success => undefined, error => {
|
||||
// On error, show error message and notify that the query is complete so that buttons and other status indicators
|
||||
// can be correct
|
||||
this._messageService.show(Severity.Error, strings.format(LocalizedConstants.msgCancelQueryFailed, error));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: strings.format(LocalizedConstants.msgCancelQueryFailed, error)
|
||||
});
|
||||
this._fireQueryEvent(queryRunner.uri, 'complete', 0);
|
||||
});
|
||||
|
||||
@@ -427,7 +434,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.updateCell(ownerUri, rowId, columnId, newValue).then((result) => result, error => {
|
||||
this._messageService.show(Severity.Error, nls.localize('updateCellFailed', 'Update cell failed: ') + error.message);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('updateCellFailed', 'Update cell failed: ') + error.message
|
||||
});
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
@@ -439,7 +449,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.commitEdit(ownerUri).then(() => { }, error => {
|
||||
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error.message);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error.message
|
||||
});
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { IQueryManagementService } from 'sql/parts/query/common/queryManagement'
|
||||
import { ISlickRange } from 'angular2-slickgrid';
|
||||
import * as Utils from 'sql/parts/connection/common/utils';
|
||||
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import * as nls from 'vs/nls';
|
||||
@@ -21,6 +20,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export interface IEditSessionReadyEvent {
|
||||
ownerUri: string;
|
||||
@@ -66,7 +66,7 @@ export default class QueryRunner {
|
||||
public uri: string,
|
||||
public title: string,
|
||||
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
|
||||
@IClipboardService private _clipboardService: IClipboardService
|
||||
) { }
|
||||
@@ -288,7 +288,10 @@ export default class QueryRunner {
|
||||
self._queryManagementService.getQueryRows(rowData).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
self._messageService.show(Severity.Error, nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error));
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error)
|
||||
});
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@@ -312,8 +315,10 @@ export default class QueryRunner {
|
||||
|
||||
// TODO issue #228 add statusview callbacks here
|
||||
this._isExecuting = false;
|
||||
|
||||
this._messageService.show(Severity.Error, nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -334,13 +339,19 @@ export default class QueryRunner {
|
||||
self._queryManagementService.getEditRows(rowData).then(result => {
|
||||
if (!result.hasOwnProperty('rowCount')) {
|
||||
let error = `Nothing returned from subset query`;
|
||||
self._messageService.show(Severity.Error, error);
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: error
|
||||
});
|
||||
reject(error);
|
||||
}
|
||||
resolve(result);
|
||||
}, error => {
|
||||
let errorMessage = nls.localize('query.moreRowsFailedError', 'Something went wrong getting more rows:');
|
||||
self._messageService.show(Severity.Error, `${errorMessage} ${error}`);
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: `${errorMessage} ${error}`
|
||||
});
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,20 +14,21 @@ import { sqlModeId, untitledFilePrefix, getSupportedInputResource } from 'sql/pa
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
|
||||
import { IMode } from 'vs/editor/common/modes';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IEditor, IEditorInput, Position } from 'vs/platform/editor/common/editor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IEditorGroup } from 'vs/workbench/common/editor';
|
||||
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import nls = require('vs/nls');
|
||||
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';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -52,20 +53,20 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
private static editorService: IWorkbenchEditorService;
|
||||
private static instantiationService: IInstantiationService;
|
||||
private static editorGroupService: IEditorGroupService;
|
||||
private static messageService: IMessageService;
|
||||
private static notificationService: INotificationService;
|
||||
|
||||
constructor(
|
||||
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
) {
|
||||
QueryEditorService.editorService = _editorService;
|
||||
QueryEditorService.instantiationService = _instantiationService;
|
||||
QueryEditorService.editorGroupService = _editorGroupService;
|
||||
QueryEditorService.messageService = _messageService;
|
||||
QueryEditorService.notificationService = _notificationService;
|
||||
}
|
||||
|
||||
////// Public functions
|
||||
@@ -78,7 +79,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
try {
|
||||
// Create file path and file URI
|
||||
let filePath = this.createUntitledSqlFilePath();
|
||||
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
|
||||
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
||||
|
||||
// Create a sql document pane with accoutrements
|
||||
const fileInput = this._untitledEditorService.createOrGet(docUri, 'sql');
|
||||
@@ -126,7 +127,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
// Create file path and file URI
|
||||
let objectName = schemaName ? schemaName + '.' + tableName : tableName;
|
||||
let filePath = this.createEditDataFileName(objectName);
|
||||
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
|
||||
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
||||
|
||||
// Create an EditDataInput for editing
|
||||
let editDataInput: EditDataInput = this._instantiationService.createInstance(EditDataInput, docUri, schemaName, tableName);
|
||||
@@ -192,7 +193,7 @@ 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: IModel, mode: IMode, editor: IEditor): Promise<IModel> {
|
||||
public static sqlLanguageModeCheck(model: ITextModel, mode: IMode, editor: IEditor): Promise<ITextModel> {
|
||||
if (!model || !mode || !editor) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -211,16 +212,22 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
}
|
||||
|
||||
let uri: URI = QueryEditorService._getEditorChangeUri(editor.input, changingToSql);
|
||||
if(uri.scheme === UNTITLED_SCHEMA && editor.input instanceof QueryInput)
|
||||
if(uri.scheme === Schemas.untitled && editor.input instanceof QueryInput)
|
||||
{
|
||||
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE);
|
||||
QueryEditorService.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE
|
||||
});
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
// Return undefined to notify the calling funciton to not perform the language change
|
||||
// TODO change this - tracked by issue #727
|
||||
if (editor.input.isDirty()) {
|
||||
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_ERROR_MESSAGE);
|
||||
QueryEditorService.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: QueryEditorService.CHANGE_ERROR_MESSAGE
|
||||
});
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -232,7 +239,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
options.pinned = group.isPinned(index);
|
||||
|
||||
// Return a promise that will resovle when the old editor has been replaced by a new editor
|
||||
return new Promise<IModel>((resolve, reject) => {
|
||||
return new Promise<ITextModel>((resolve, reject) => {
|
||||
let newEditorInput = QueryEditorService._getNewEditorInput(changingToSql, editor.input, uri);
|
||||
|
||||
// Override queryEditorCheck to not open this file in a QueryEditor
|
||||
@@ -344,7 +351,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
/**
|
||||
* Handle all cleanup actions that need to wait until the editor is fully open.
|
||||
*/
|
||||
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): IModel {
|
||||
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): ITextModel {
|
||||
|
||||
// Reset the editor pin state
|
||||
// TODO: change this so it happens automatically in openEditor in sqlLanguageModeCheck. Performing this here
|
||||
|
||||
Reference in New Issue
Block a user