mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
toward strict null in extHostTypes #61543
This commit is contained in:
@@ -48,9 +48,13 @@ export class Disposable {
|
||||
export class Position {
|
||||
|
||||
static Min(...positions: Position[]): Position {
|
||||
let result = positions.pop();
|
||||
for (let p of positions) {
|
||||
if (p.isBefore(result)) {
|
||||
if (positions.length === 0) {
|
||||
throw new TypeError();
|
||||
}
|
||||
let result = positions[0];
|
||||
for (let i = 1; i < positions.length; i++) {
|
||||
let p = positions[i];
|
||||
if (p.isBefore(result!)) {
|
||||
result = p;
|
||||
}
|
||||
}
|
||||
@@ -58,9 +62,13 @@ export class Position {
|
||||
}
|
||||
|
||||
static Max(...positions: Position[]): Position {
|
||||
let result = positions.pop();
|
||||
for (let p of positions) {
|
||||
if (p.isAfter(result)) {
|
||||
if (positions.length === 0) {
|
||||
throw new TypeError();
|
||||
}
|
||||
let result = positions[0];
|
||||
for (let i = 1; i < positions.length; i++) {
|
||||
let p = positions[i];
|
||||
if (p.isAfter(result!)) {
|
||||
result = p;
|
||||
}
|
||||
}
|
||||
@@ -579,9 +587,6 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
|
||||
res.push(candidate.edit);
|
||||
}
|
||||
}
|
||||
if (res.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -811,7 +816,7 @@ export class Diagnostic {
|
||||
};
|
||||
}
|
||||
|
||||
static isEqual(a: Diagnostic, b: Diagnostic): boolean {
|
||||
static isEqual(a: Diagnostic | undefined, b: Diagnostic | undefined): boolean {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
@@ -832,7 +837,7 @@ export class Diagnostic {
|
||||
export class Hover {
|
||||
|
||||
public contents: vscode.MarkdownString[] | vscode.MarkedString[];
|
||||
public range: Range;
|
||||
public range: Range | undefined;
|
||||
|
||||
constructor(
|
||||
contents: vscode.MarkdownString | vscode.MarkedString | vscode.MarkdownString[] | vscode.MarkedString[],
|
||||
@@ -916,7 +921,7 @@ export class SymbolInformation {
|
||||
name: string;
|
||||
location: Location;
|
||||
kind: SymbolKind;
|
||||
containerName: string;
|
||||
containerName: string | undefined;
|
||||
|
||||
constructor(name: string, kind: SymbolKind, containerName: string, location: Location);
|
||||
constructor(name: string, kind: SymbolKind, range: Range, uri?: URI, containerName?: string);
|
||||
@@ -1035,7 +1040,7 @@ export class CodeLens {
|
||||
|
||||
range: Range;
|
||||
|
||||
command: vscode.Command;
|
||||
command: vscode.Command | undefined;
|
||||
|
||||
constructor(range: Range, command?: vscode.Command) {
|
||||
this.range = range;
|
||||
@@ -1164,7 +1169,7 @@ export enum CompletionItemInsertTextRule {
|
||||
export class CompletionItem implements vscode.CompletionItem {
|
||||
|
||||
label: string;
|
||||
kind: CompletionItemKind;
|
||||
kind: CompletionItemKind | undefined;
|
||||
detail: string;
|
||||
documentation: string | MarkdownString;
|
||||
sortText: string;
|
||||
@@ -1186,7 +1191,7 @@ export class CompletionItem implements vscode.CompletionItem {
|
||||
toJSON(): any {
|
||||
return {
|
||||
label: this.label,
|
||||
kind: CompletionItemKind[this.kind],
|
||||
kind: this.kind && CompletionItemKind[this.kind],
|
||||
detail: this.detail,
|
||||
documentation: this.documentation,
|
||||
sortText: this.sortText,
|
||||
|
||||
Reference in New Issue
Block a user