fix more strict init errors

This commit is contained in:
Johannes Rieken
2019-08-12 15:46:03 +02:00
parent 91da8dc700
commit f6ef80200c
10 changed files with 63 additions and 55 deletions

View File

@@ -153,7 +153,7 @@ export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSavePartic
resourceEdit.edits.push({
range: range && Range.from(range),
text: newText,
eol: EndOfLine.from(newEol)
eol: newEol && EndOfLine.from(newEol)
});
}
}

View File

@@ -151,11 +151,11 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
private _proxy: MainThreadTextEditorsShape;
private _id: string;
private _tabSize: number;
private _indentSize: number;
private _insertSpaces: boolean;
private _cursorStyle: TextEditorCursorStyle;
private _lineNumbers: TextEditorLineNumbersStyle;
private _tabSize!: number;
private _indentSize!: number;
private _insertSpaces!: boolean;
private _cursorStyle!: TextEditorCursorStyle;
private _lineNumbers!: TextEditorLineNumbersStyle;
constructor(proxy: MainThreadTextEditorsShape, id: string, source: IResolvedTextEditorConfiguration) {
this._proxy = proxy;

View File

@@ -442,7 +442,7 @@ export namespace TextEdit {
export function from(edit: vscode.TextEdit): modes.TextEdit {
return <modes.TextEdit>{
text: edit.newText,
eol: EndOfLine.from(edit.newEol),
eol: edit.newEol && EndOfLine.from(edit.newEol),
range: Range.from(edit.range)
};
}

View File

@@ -514,7 +514,7 @@ export class TextEdit {
protected _range: Range;
protected _newText: string | null;
protected _newEol: EndOfLine;
protected _newEol?: EndOfLine;
get range(): Range {
return this._range;
@@ -538,11 +538,11 @@ export class TextEdit {
this._newText = value;
}
get newEol(): EndOfLine {
get newEol(): EndOfLine | undefined {
return this._newEol;
}
set newEol(value: EndOfLine) {
set newEol(value: EndOfLine | undefined) {
if (value && typeof value !== 'number') {
throw illegalArgument('newEol');
}
@@ -550,7 +550,7 @@ export class TextEdit {
}
constructor(range: Range, newText: string | null) {
this.range = range;
this._range = range;
this._newText = newText;
}
@@ -798,7 +798,7 @@ export class Location {
}
uri: URI;
range: Range;
range!: Range;
constructor(uri: URI, rangeOrPosition: Range | Position) {
this.uri = uri;
@@ -861,10 +861,10 @@ export class Diagnostic {
range: Range;
message: string;
source: string;
code: string | number;
severity: DiagnosticSeverity;
relatedInformation: DiagnosticRelatedInformation[];
source?: string;
code?: string | number;
relatedInformation?: DiagnosticRelatedInformation[];
tags?: DiagnosticTag[];
constructor(range: Range, message: string, severity: DiagnosticSeverity = DiagnosticSeverity.Error) {
@@ -989,7 +989,7 @@ export class SymbolInformation {
}
name: string;
location: Location;
location!: Location;
kind: SymbolKind;
containerName: string | undefined;
@@ -1253,8 +1253,8 @@ export class SignatureInformation {
export class SignatureHelp {
signatures: SignatureInformation[];
activeSignature: number;
activeParameter: number;
activeSignature: number = 0;
activeParameter: number = 0;
constructor() {
this.signatures = [];
@@ -1310,19 +1310,19 @@ export enum CompletionItemKind {
export class CompletionItem implements vscode.CompletionItem {
label: string;
kind: CompletionItemKind | undefined;
kind?: CompletionItemKind;
detail?: string;
documentation?: string | MarkdownString;
sortText?: string;
filterText?: string;
preselect?: boolean;
insertText: string | SnippetString;
insertText?: string | SnippetString;
keepWhitespace?: boolean;
range: Range;
range?: Range;
commitCharacters?: string[];
textEdit: TextEdit;
additionalTextEdits: TextEdit[];
command: vscode.Command;
textEdit?: TextEdit;
additionalTextEdits?: TextEdit[];
command?: vscode.Command;
constructor(label: string, kind?: CompletionItemKind) {
this.label = label;