diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 5b2f189247f..7410f4dcc36 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -545,6 +545,7 @@ "./vs/vscode.d.ts", "./vs/vscode.proposed.d.ts", "./vs/workbench/api/node/extHostExtensionActivator.ts", + // "./vs/workbench/api/node/extHostTypes.ts", "./vs/workbench/api/shared/tasks.ts", "./vs/workbench/browser/actions/toggleActivityBarVisibility.ts", "./vs/workbench/browser/actions/toggleCenteredLayout.ts", @@ -729,4 +730,4 @@ "exclude": [ "./typings/require-monaco.d.ts" ] -} \ No newline at end of file +} diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 2b5eeb7623a..bb1af92f90d 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -876,7 +876,7 @@ export interface DocumentSymbolProvider { provideDocumentSymbols(model: model.ITextModel, token: CancellationToken): ProviderResult; } -export type TextEdit = { range: IRange; text: string; eol?: model.EndOfLineSequence; } | { range: undefined; text: undefined; eol: model.EndOfLineSequence; }; +export type TextEdit = { range: IRange; text: string; eol?: model.EndOfLineSequence; }; /** * Interface used to format a model diff --git a/src/vs/editor/common/services/editorSimpleWorker.ts b/src/vs/editor/common/services/editorSimpleWorker.ts index 84590d69ace..ed3a564f52e 100644 --- a/src/vs/editor/common/services/editorSimpleWorker.ts +++ b/src/vs/editor/common/services/editorSimpleWorker.ts @@ -425,8 +425,8 @@ export abstract class BaseEditorSimpleWorker { lastEol = eol; } - if (!range) { - // eol-change only + if (Range.isEmpty(range) && !text) { + // empty change continue; } @@ -463,7 +463,7 @@ export abstract class BaseEditorSimpleWorker { } if (typeof lastEol === 'number') { - result.push({ eol: lastEol, text: undefined, range: undefined }); + result.push({ eol: lastEol, text: '', range: { startLineNumber: 0, startColumn: 0, endLineNumber: 0, endColumn: 0 } }); } return Promise.resolve(result); diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 54a6804c68d..d6ea545dd85 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -5148,10 +5148,6 @@ declare namespace monaco.languages { range: IRange; text: string; eol?: editor.EndOfLineSequence; - } | { - range: undefined; - text: undefined; - eol: editor.EndOfLineSequence; }; /** diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index f2a25b2a554..b7a22905277 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -447,7 +447,7 @@ export class TextEdit { } static setEndOfLine(eol: EndOfLine): TextEdit { - let ret = new TextEdit(undefined, undefined); + let ret = new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), ''); ret.newEol = eol; return ret; } @@ -513,8 +513,8 @@ export interface IFileOperationOptions { export interface IFileOperation { _type: 1; - from: URI; - to: URI; + from?: URI; + to?: URI; options?: IFileOperationOptions; } @@ -567,7 +567,7 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit { for (let i = 0; i < this._edits.length; i++) { const element = this._edits[i]; if (element._type === 2 && element.uri.toString() === uri.toString()) { - this._edits[i] = undefined; + this._edits[i] = undefined!; // will be coalesced down below } } this._edits = coalesce(this._edits); @@ -606,8 +606,8 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit { return values(textEdits); } - _allEntries(): ([URI, TextEdit[]] | [URI, URI, IFileOperationOptions])[] { - let res: ([URI, TextEdit[]] | [URI, URI, IFileOperationOptions])[] = []; + _allEntries(): ([URI, TextEdit[]] | [URI?, URI?, IFileOperationOptions?])[] { + let res: ([URI, TextEdit[]] | [URI?, URI?, IFileOperationOptions?])[] = []; for (let edit of this._edits) { if (edit._type === 1) { res.push([edit.from, edit.to, edit.options]); @@ -938,7 +938,7 @@ export class SymbolInformation { if (locationOrUri instanceof Location) { this.location = locationOrUri; } else if (rangeOrContainer instanceof Range) { - this.location = new Location(locationOrUri, rangeOrContainer); + this.location = new Location(locationOrUri!, rangeOrContainer); } SymbolInformation.validate(this); @@ -1934,12 +1934,14 @@ export class FunctionBreakpoint extends Breakpoint { export class DebugAdapterExecutable implements vscode.DebugAdapterExecutable { readonly command: string; readonly args: string[]; - readonly options?: vscode.DebugAdapterExecutableOptions; + readonly env?: { [key: string]: string }; + readonly cwd?: string; - constructor(command: string, args: string[], options?: vscode.DebugAdapterExecutableOptions) { + constructor(command: string, args?: string[], env?: { [key: string]: string }, cwd?: string) { this.command = command; - this.args = args || []; - this.options = options; + this.args = args; + this.env = env; + this.cwd = cwd; } }