mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)
* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 * fix pipelines * fix strict-null-checks * add missing files
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { isUndefinedOrNull, withNullAsUndefined, assertIsDefined } from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput, EditorActivation } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput, EditorActivation, EditorOpenContext } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -38,6 +38,7 @@ export const SingleEditorGroupsContext = MultipleEditorGroupsContext.toNegated()
|
||||
export const InEditorZenModeContext = new RawContextKey<boolean>('inZenMode', false);
|
||||
export const IsCenteredLayoutContext = new RawContextKey<boolean>('isCenteredLayout', false);
|
||||
export const SplitEditorsVertically = new RawContextKey<boolean>('splitEditorsVertically', false);
|
||||
export const EditorAreaVisibleContext = new RawContextKey<boolean>('editorAreaVisible', true);
|
||||
|
||||
/**
|
||||
* Text diff editor id.
|
||||
@@ -117,7 +118,7 @@ export interface ITextEditor extends IEditor {
|
||||
/**
|
||||
* Returns the underlying text editor widget of this editor.
|
||||
*/
|
||||
getControl(): ICodeEditor;
|
||||
getControl(): ICodeEditor | undefined;
|
||||
}
|
||||
|
||||
export interface ITextDiffEditor extends IEditor {
|
||||
@@ -125,7 +126,7 @@ export interface ITextDiffEditor extends IEditor {
|
||||
/**
|
||||
* Returns the underlying text editor widget of this editor.
|
||||
*/
|
||||
getControl(): IDiffEditor;
|
||||
getControl(): IDiffEditor | undefined;
|
||||
}
|
||||
|
||||
export interface ITextSideBySideEditor extends IEditor {
|
||||
@@ -510,7 +511,7 @@ export interface IEncodingSupport {
|
||||
/**
|
||||
* Gets the encoding of the input if known.
|
||||
*/
|
||||
getEncoding(): string;
|
||||
getEncoding(): string | undefined;
|
||||
|
||||
/**
|
||||
* Sets the encoding for the input for saving.
|
||||
@@ -786,6 +787,18 @@ export class EditorOptions implements IEditorOptions {
|
||||
*/
|
||||
ignoreOverrides: boolean | undefined;
|
||||
|
||||
/**
|
||||
* A optional hint to signal in which context the editor opens.
|
||||
*
|
||||
* If configured to be `EditorOpenContext.USER`, this hint can be
|
||||
* used in various places to control the experience. For example,
|
||||
* if the editor to open fails with an error, a notification could
|
||||
* inform about this in a modal dialog. If the editor opened through
|
||||
* some background task, the notification would show in the background,
|
||||
* not as a modal dialog.
|
||||
*/
|
||||
context: EditorOpenContext | undefined;
|
||||
|
||||
/**
|
||||
* Overwrites option values from the provided bag.
|
||||
*/
|
||||
@@ -830,6 +843,10 @@ export class EditorOptions implements IEditorOptions {
|
||||
this.ignoreOverrides = options.ignoreOverrides;
|
||||
}
|
||||
|
||||
if (typeof options.context === 'number') {
|
||||
this.context = options.context;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -838,13 +855,13 @@ export class EditorOptions implements IEditorOptions {
|
||||
* Base Text Editor Options.
|
||||
*/
|
||||
export class TextEditorOptions extends EditorOptions {
|
||||
private startLineNumber: number;
|
||||
private startColumn: number;
|
||||
private endLineNumber: number;
|
||||
private endColumn: number;
|
||||
private startLineNumber: number | undefined;
|
||||
private startColumn: number | undefined;
|
||||
private endLineNumber: number | undefined;
|
||||
private endColumn: number | undefined;
|
||||
|
||||
private revealInCenterIfOutsideViewport: boolean;
|
||||
private editorViewState: IEditorViewState | null;
|
||||
private revealInCenterIfOutsideViewport: boolean | undefined;
|
||||
private editorViewState: IEditorViewState | undefined;
|
||||
|
||||
static from(input?: IBaseResourceInput): TextEditorOptions | undefined {
|
||||
if (!input || !input.options) {
|
||||
@@ -912,7 +929,7 @@ export class TextEditorOptions extends EditorOptions {
|
||||
const options = TextEditorOptions.create(settings);
|
||||
|
||||
// View state
|
||||
options.editorViewState = editor.saveViewState();
|
||||
options.editorViewState = withNullAsUndefined(editor.saveViewState());
|
||||
|
||||
return options;
|
||||
}
|
||||
@@ -1036,6 +1053,7 @@ interface IEditorPartConfiguration {
|
||||
mouseBackForwardToNavigate?: boolean;
|
||||
labelFormat?: 'default' | 'short' | 'medium' | 'long';
|
||||
restoreViewState?: boolean;
|
||||
splitSizing?: 'split' | 'distribute';
|
||||
}
|
||||
|
||||
export interface IEditorPartOptions extends IEditorPartConfiguration {
|
||||
@@ -1057,7 +1075,7 @@ export function toResource(editor: IEditorInput | undefined, options?: IResource
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (options && options.supportSideBySide && editor instanceof SideBySideEditorInput) {
|
||||
if (options?.supportSideBySide && editor instanceof SideBySideEditorInput) {
|
||||
editor = options.supportSideBySide === SideBySideEditor.MASTER ? editor.master : editor.details;
|
||||
}
|
||||
|
||||
@@ -1095,23 +1113,23 @@ export interface IEditorMemento<T> {
|
||||
}
|
||||
|
||||
class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
|
||||
private instantiationService: IInstantiationService;
|
||||
private fileInputFactory: IFileInputFactory;
|
||||
private instantiationService: IInstantiationService | undefined;
|
||||
private fileInputFactory: IFileInputFactory | undefined;
|
||||
private readonly editorInputFactoryConstructors: Map<string, IConstructorSignature0<IEditorInputFactory>> = new Map();
|
||||
private readonly editorInputFactoryInstances: Map<string, IEditorInputFactory> = new Map();
|
||||
|
||||
start(accessor: ServicesAccessor): void {
|
||||
this.instantiationService = accessor.get(IInstantiationService);
|
||||
const instantiationService = this.instantiationService = accessor.get(IInstantiationService);
|
||||
|
||||
this.editorInputFactoryConstructors.forEach((ctor, key) => {
|
||||
this.createEditorInputFactory(key, ctor);
|
||||
this.createEditorInputFactory(key, ctor, instantiationService);
|
||||
});
|
||||
|
||||
this.editorInputFactoryConstructors.clear();
|
||||
}
|
||||
|
||||
private createEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
|
||||
const instance = this.instantiationService.createInstance(ctor);
|
||||
private createEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>, instantiationService: IInstantiationService): void {
|
||||
const instance = instantiationService.createInstance(ctor);
|
||||
this.editorInputFactoryInstances.set(editorInputId, instance);
|
||||
}
|
||||
|
||||
@@ -1120,14 +1138,14 @@ class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
|
||||
}
|
||||
|
||||
getFileInputFactory(): IFileInputFactory {
|
||||
return this.fileInputFactory;
|
||||
return assertIsDefined(this.fileInputFactory);
|
||||
}
|
||||
|
||||
registerEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
|
||||
if (!this.instantiationService) {
|
||||
this.editorInputFactoryConstructors.set(editorInputId, ctor);
|
||||
} else {
|
||||
this.createEditorInputFactory(editorInputId, ctor);
|
||||
this.createEditorInputFactory(editorInputId, ctor, this.instantiationService);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user