mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 1fbacccbc900bb59ba8a8f26a4128d48a1c97842
This commit is contained in:
@@ -230,22 +230,22 @@ export interface IUntitledTextResourceInput extends IBaseResourceInput {
|
||||
* force use the provided resource as associated path. As such, the resource will be used when saving
|
||||
* the untitled editor.
|
||||
*/
|
||||
resource?: URI;
|
||||
readonly resource?: URI;
|
||||
|
||||
/**
|
||||
* Optional language of the untitled resource.
|
||||
*/
|
||||
mode?: string;
|
||||
readonly mode?: string;
|
||||
|
||||
/**
|
||||
* Optional contents of the untitled resource.
|
||||
*/
|
||||
contents?: string;
|
||||
readonly contents?: string;
|
||||
|
||||
/**
|
||||
* Optional encoding of the untitled resource.
|
||||
*/
|
||||
encoding?: string;
|
||||
readonly encoding?: string;
|
||||
}
|
||||
|
||||
export interface IResourceDiffInput extends IBaseResourceInput {
|
||||
@@ -253,12 +253,12 @@ export interface IResourceDiffInput extends IBaseResourceInput {
|
||||
/**
|
||||
* The left hand side URI to open inside a diff editor.
|
||||
*/
|
||||
leftResource: URI;
|
||||
readonly leftResource: URI;
|
||||
|
||||
/**
|
||||
* The right hand side URI to open inside a diff editor.
|
||||
*/
|
||||
rightResource: URI;
|
||||
readonly rightResource: URI;
|
||||
}
|
||||
|
||||
export interface IResourceSideBySideInput extends IBaseResourceInput {
|
||||
@@ -266,12 +266,12 @@ export interface IResourceSideBySideInput extends IBaseResourceInput {
|
||||
/**
|
||||
* The right hand side URI to open inside a side by side editor.
|
||||
*/
|
||||
masterResource: URI;
|
||||
readonly masterResource: URI;
|
||||
|
||||
/**
|
||||
* The left hand side URI to open inside a side by side editor.
|
||||
*/
|
||||
detailResource: URI;
|
||||
readonly detailResource: URI;
|
||||
}
|
||||
|
||||
export const enum Verbosity {
|
||||
@@ -314,17 +314,17 @@ export interface ISaveOptions {
|
||||
* Forces to save the contents of the working copy
|
||||
* again even if the working copy is not dirty.
|
||||
*/
|
||||
force?: boolean;
|
||||
readonly force?: boolean;
|
||||
|
||||
/**
|
||||
* Instructs the save operation to skip any save participants.
|
||||
*/
|
||||
skipSaveParticipants?: boolean;
|
||||
readonly skipSaveParticipants?: boolean;
|
||||
|
||||
/**
|
||||
* A hint as to which file systems should be available for saving.
|
||||
*/
|
||||
availableFileSystems?: string[];
|
||||
readonly availableFileSystems?: string[];
|
||||
}
|
||||
|
||||
export interface IRevertOptions {
|
||||
@@ -333,7 +333,7 @@ export interface IRevertOptions {
|
||||
* Forces to load the contents of the working copy
|
||||
* again even if the working copy is not dirty.
|
||||
*/
|
||||
force?: boolean;
|
||||
readonly force?: boolean;
|
||||
|
||||
/**
|
||||
* A soft revert will clear dirty state of a working copy
|
||||
@@ -342,7 +342,7 @@ export interface IRevertOptions {
|
||||
* This option may be used in scenarios where an editor is
|
||||
* closed and where we do not require to load the contents.
|
||||
*/
|
||||
soft?: boolean;
|
||||
readonly soft?: boolean;
|
||||
}
|
||||
|
||||
export interface IEditorInput extends IDisposable {
|
||||
|
||||
@@ -141,13 +141,15 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
|
||||
/**
|
||||
* Updates the text editor model with the provided value. If the value is the same as the model has, this is a no-op.
|
||||
*/
|
||||
protected updateTextEditorModel(newValue: ITextBufferFactory, preferredMode?: string): void {
|
||||
protected updateTextEditorModel(newValue?: ITextBufferFactory, preferredMode?: string): void {
|
||||
if (!this.isResolved()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// contents
|
||||
this.modelService.updateModel(this.textEditorModel, newValue);
|
||||
if (newValue) {
|
||||
this.modelService.updateModel(this.textEditorModel, newValue);
|
||||
}
|
||||
|
||||
// mode (only if specific and changed)
|
||||
if (preferredMode && preferredMode !== PLAINTEXT_MODE_ID && this.textEditorModel.getModeId() !== preferredMode) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/con
|
||||
import { localize } from 'vs/nls';
|
||||
import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { values, keys, getOrSet } from 'vs/base/common/map';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -19,6 +19,7 @@ import { IAction, IActionViewItem } from 'vs/base/common/actions';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { flatten } from 'vs/base/common/arrays';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { SetMap } from 'vs/base/common/collections';
|
||||
|
||||
export const TEST_VIEW_CONTAINER_ID = 'workbench.view.extension.test';
|
||||
|
||||
@@ -210,6 +211,10 @@ export interface IViewDescriptorCollection extends IDisposable {
|
||||
readonly allViewDescriptors: IViewDescriptor[];
|
||||
}
|
||||
|
||||
export interface IViewContentDescriptor {
|
||||
readonly content: string;
|
||||
}
|
||||
|
||||
export interface IViewsRegistry {
|
||||
|
||||
readonly onViewsRegistered: Event<{ views: IViewDescriptor[], viewContainer: ViewContainer }>;
|
||||
@@ -229,6 +234,10 @@ export interface IViewsRegistry {
|
||||
getView(id: string): IViewDescriptor | null;
|
||||
|
||||
getViewContainer(id: string): ViewContainer | null;
|
||||
|
||||
readonly onDidChangeEmptyViewContent: Event<string>;
|
||||
registerEmptyViewContent(id: string, viewContent: IViewContentDescriptor): IDisposable;
|
||||
getEmptyViewContent(id: string): IViewContentDescriptor[];
|
||||
}
|
||||
|
||||
class ViewsRegistry extends Disposable implements IViewsRegistry {
|
||||
@@ -242,8 +251,12 @@ class ViewsRegistry extends Disposable implements IViewsRegistry {
|
||||
private readonly _onDidChangeContainer: Emitter<{ views: IViewDescriptor[], from: ViewContainer, to: ViewContainer }> = this._register(new Emitter<{ views: IViewDescriptor[], from: ViewContainer, to: ViewContainer }>());
|
||||
readonly onDidChangeContainer: Event<{ views: IViewDescriptor[], from: ViewContainer, to: ViewContainer }> = this._onDidChangeContainer.event;
|
||||
|
||||
private readonly _onDidChangeEmptyViewContent: Emitter<string> = this._register(new Emitter<string>());
|
||||
readonly onDidChangeEmptyViewContent: Event<string> = this._onDidChangeEmptyViewContent.event;
|
||||
|
||||
private _viewContainers: ViewContainer[] = [];
|
||||
private _views: Map<ViewContainer, IViewDescriptor[]> = new Map<ViewContainer, IViewDescriptor[]>();
|
||||
private _emptyViewContents = new SetMap<string, IViewContentDescriptor>();
|
||||
|
||||
registerViews(views: IViewDescriptor[], viewContainer: ViewContainer): void {
|
||||
this.addViews(views, viewContainer);
|
||||
@@ -293,6 +306,22 @@ class ViewsRegistry extends Disposable implements IViewsRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
registerEmptyViewContent(id: string, viewContent: IViewContentDescriptor): IDisposable {
|
||||
this._emptyViewContents.add(id, viewContent);
|
||||
this._onDidChangeEmptyViewContent.fire(id);
|
||||
|
||||
return toDisposable(() => {
|
||||
this._emptyViewContents.delete(id, viewContent);
|
||||
this._onDidChangeEmptyViewContent.fire(id);
|
||||
});
|
||||
}
|
||||
|
||||
getEmptyViewContent(id: string): IViewContentDescriptor[] {
|
||||
const result: IViewContentDescriptor[] = [];
|
||||
this._emptyViewContents.forEach(id, descriptor => result.push(descriptor));
|
||||
return result;
|
||||
}
|
||||
|
||||
private addViews(viewDescriptors: IViewDescriptor[], viewContainer: ViewContainer): void {
|
||||
let views = this._views.get(viewContainer);
|
||||
if (!views) {
|
||||
|
||||
Reference in New Issue
Block a user