mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)
* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c * remove files we don't want * fix hygiene * update distro * update distro * fix hygiene * fix strict nulls * distro * distro * fix tests * fix tests * add another edit * fix viewlet icon * fix azure dialog * fix some padding * fix more padding issues
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { EditorInput, EditorModel, ConfirmResult } from 'vs/workbench/common/editor';
|
||||
import { EditorInput, EditorModel, ISaveOptions } from 'vs/workbench/common/editor';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
@@ -16,12 +15,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { INotebookModel, IContentManager, NotebookContentChange } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ITextFileService, ISaveOptions, StateChange } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { ITextFileService, StateChange } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { LocalContentManager } from 'sql/workbench/services/notebook/common/localContentManager';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { NotebookChangeType } from 'sql/workbench/contrib/notebook/common/models/contracts';
|
||||
@@ -29,6 +26,8 @@ import { Deferred } from 'sql/base/common/promise';
|
||||
import { NotebookTextFileModel } from 'sql/workbench/contrib/notebook/browser/models/notebookTextFileModel';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { UntitledTextEditorModel } from 'vs/workbench/common/editor/untitledTextEditorModel';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
|
||||
@@ -42,7 +41,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
private readonly _onDidChangeDirty: Emitter<void> = this._register(new Emitter<void>());
|
||||
private _lastEditFullReplacement: boolean;
|
||||
constructor(public readonly notebookUri: URI,
|
||||
private textEditorModel: TextFileEditorModel | UntitledEditorModel | ResourceEditorModel,
|
||||
private textEditorModel: TextFileEditorModel | UntitledTextEditorModel | ResourceEditorModel,
|
||||
@INotebookService private notebookService: INotebookService,
|
||||
@ITextFileService private textFileService: ITextFileService,
|
||||
@ITextResourcePropertiesService private textResourcePropertiesService: ITextResourcePropertiesService
|
||||
@@ -67,7 +66,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
}, err => undefined);
|
||||
}
|
||||
}));
|
||||
if (this.textEditorModel instanceof UntitledEditorModel) {
|
||||
if (this.textEditorModel instanceof UntitledTextEditorModel) {
|
||||
this._register(this.textEditorModel.onDidChangeDirty(e => {
|
||||
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
this.setDirty(dirty);
|
||||
@@ -198,7 +197,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
}
|
||||
}
|
||||
|
||||
type TextInput = ResourceEditorInput | UntitledEditorInput | FileEditorInput;
|
||||
type TextInput = ResourceEditorInput | UntitledTextEditorInput | FileEditorInput;
|
||||
|
||||
export abstract class NotebookInput extends EditorInput {
|
||||
private _providerId: string;
|
||||
@@ -211,7 +210,7 @@ export abstract class NotebookInput extends EditorInput {
|
||||
private _parentContainer: HTMLElement;
|
||||
private readonly _layoutChanged: Emitter<void> = this._register(new Emitter<void>());
|
||||
private _model: NotebookEditorModel;
|
||||
private _untitledEditorModel: UntitledEditorModel;
|
||||
private _untitledEditorModel: UntitledTextEditorModel;
|
||||
private _contentManager: IContentManager;
|
||||
private _providersLoaded: Promise<void>;
|
||||
private _dirtyListener: IDisposable;
|
||||
@@ -241,10 +240,6 @@ export abstract class NotebookInput extends EditorInput {
|
||||
return this._textInput;
|
||||
}
|
||||
|
||||
public confirmSave(): Promise<ConfirmResult> {
|
||||
return this._textInput.confirmSave();
|
||||
}
|
||||
|
||||
public revert(): Promise<boolean> {
|
||||
return this._textInput.revert();
|
||||
}
|
||||
@@ -329,11 +324,11 @@ export abstract class NotebookInput extends EditorInput {
|
||||
return this.resource;
|
||||
}
|
||||
|
||||
public get untitledEditorModel(): UntitledEditorModel {
|
||||
public get untitledEditorModel(): UntitledTextEditorModel {
|
||||
return this._untitledEditorModel;
|
||||
}
|
||||
|
||||
public set untitledEditorModel(value: UntitledEditorModel) {
|
||||
public set untitledEditorModel(value: UntitledTextEditorModel) {
|
||||
this._untitledEditorModel = value;
|
||||
}
|
||||
|
||||
@@ -347,7 +342,7 @@ export abstract class NotebookInput extends EditorInput {
|
||||
if (this._model) {
|
||||
return Promise.resolve(this._model);
|
||||
} else {
|
||||
let textOrUntitledEditorModel: UntitledEditorModel | IEditorModel;
|
||||
let textOrUntitledEditorModel: TextFileEditorModel | UntitledTextEditorModel | ResourceEditorModel;
|
||||
if (this.resource.scheme === Schemas.untitled) {
|
||||
if (this._untitledEditorModel) {
|
||||
this._untitledEditorModel.textEditorModel.onBeforeAttached();
|
||||
@@ -357,12 +352,12 @@ export abstract class NotebookInput extends EditorInput {
|
||||
if (!(resolvedInput instanceof BinaryEditorModel)) {
|
||||
resolvedInput.textEditorModel.onBeforeAttached();
|
||||
}
|
||||
textOrUntitledEditorModel = resolvedInput;
|
||||
textOrUntitledEditorModel = resolvedInput as TextFileEditorModel | UntitledTextEditorModel | ResourceEditorModel;
|
||||
}
|
||||
} else {
|
||||
const textEditorModelReference = await this.textModelService.createModelReference(this.resource);
|
||||
textEditorModelReference.object.textEditorModel.onBeforeAttached();
|
||||
textOrUntitledEditorModel = await textEditorModelReference.object.load();
|
||||
textOrUntitledEditorModel = await textEditorModelReference.object.load() as TextFileEditorModel | ResourceEditorModel;
|
||||
}
|
||||
this._model = this._register(this.instantiationService.createInstance(NotebookEditorModel, this.resource, textOrUntitledEditorModel));
|
||||
this.hookDirtyListener(this._model.onDidChangeDirty, () => this._onDidChangeDirty.fire());
|
||||
|
||||
Reference in New Issue
Block a user