add a bunch of strict field initializations

This commit is contained in:
Johannes Rieken
2019-07-31 12:30:30 +02:00
parent 28520b8210
commit 06701f533d
27 changed files with 67 additions and 69 deletions

View File

@@ -63,7 +63,7 @@ export class ExtHostEditorInsets implements ExtHostEditorInsetsShape {
private readonly _uuid = generateUuid();
private _html: string = '';
private _options: vscode.WebviewOptions;
private _options: vscode.WebviewOptions = Object.create(null);
toWebviewResource(resource: vscode.Uri): vscode.Uri {
return toWebviewResource(that._initData, this._uuid, resource);

View File

@@ -26,7 +26,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
private _proxy: MainThreadDocumentsShape;
private _languageId: string;
private _isDirty: boolean;
private _document: vscode.TextDocument;
private _document?: vscode.TextDocument;
private _textLines: vscode.TextLine[] = [];
private _isDisposed: boolean = false;

View File

@@ -17,7 +17,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
private _disposables: Disposable[] = [];
private _activeEditorId: string | null;
private _activeEditorId: string | null = null;
private readonly _editors = new Map<string, ExtHostTextEditor>();
private readonly _documents = new Map<string, ExtHostDocumentData>();

View File

@@ -155,7 +155,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
private readonly _usedSchemes = new Set<string>();
private readonly _watches = new Map<number, IDisposable>();
private _linkProviderRegistration: IDisposable;
private _linkProviderRegistration?: IDisposable;
private _handlePool: number = 0;
readonly fileSystem: vscode.FileSystem;

View File

@@ -14,7 +14,7 @@ export class ExtensionMemento implements IExtensionMemento {
private readonly _storage: ExtHostStorage;
private readonly _init: Promise<ExtensionMemento>;
private _value: { [n: string]: any; };
private _value?: { [n: string]: any; };
private readonly _storageListener: IDisposable;
constructor(id: string, global: boolean, storage: ExtHostStorage) {
@@ -41,7 +41,7 @@ export class ExtensionMemento implements IExtensionMemento {
get<T>(key: string): T | undefined;
get<T>(key: string, defaultValue: T): T;
get<T>(key: string, defaultValue?: T): T {
let value = this._value[key];
let value = this._value![key];
if (typeof value === 'undefined') {
value = defaultValue;
}
@@ -49,8 +49,8 @@ export class ExtensionMemento implements IExtensionMemento {
}
update(key: string, value: any): Promise<void> {
this._value[key] = value;
return this._storage.setValue(this._shared, this._id, this._value);
this._value![key] = value;
return this._storage.setValue(this._shared, this._id, this._value!);
}
dispose(): void {

View File

@@ -27,6 +27,7 @@ export abstract class AbstractExtHostOutputChannel extends Disposable implements
this._name = name;
this._proxy = proxy;
this._id = proxy.$register(this.name, log, file);
this._disposed = false;
this._offset = 0;
}
@@ -121,7 +122,7 @@ export class ExtHostOutputService implements ExtHostOutputServiceShape {
private readonly _logsLocation: URI;
private readonly _proxy: MainThreadOutputServiceShape;
private readonly _channels: Map<string, AbstractExtHostOutputChannel> = new Map<string, AbstractExtHostOutputChannel>();
private _visibleChannelDisposable: IDisposable;
private _visibleChannelDisposable?: IDisposable;
constructor(factory: IOutputChannelFactory, logsLocation: URI, mainContext: IMainContext) {
this._factory = factory;