Strict null check replaceService

pull/66115/head
Matt Bierner 2019-01-03 11:59:31 -08:00
parent 58d7b54a13
commit 824d1ce4bd
3 changed files with 6 additions and 4 deletions

View File

@ -615,6 +615,8 @@
"./vs/workbench/parts/scm/electron-browser/scmMenus.ts",
"./vs/workbench/parts/scm/electron-browser/scmUtil.ts",
"./vs/workbench/parts/search/browser/patternInputWidget.ts",
"./vs/workbench/parts/search/browser/replaceContributions.ts",
"./vs/workbench/parts/search/browser/replaceService.ts",
"./vs/workbench/parts/search/common/constants.ts",
"./vs/workbench/parts/search/common/queryBuilder.ts",
"./vs/workbench/parts/search/common/replace.ts",
@ -758,6 +760,7 @@
"./vs/workbench/services/keybinding/test/keybindingIO.test.ts",
"./vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts",
"./vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts",
"./vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts",
"./vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts",
"./vs/workbench/services/mode/common/workbenchModeService.ts",
"./vs/workbench/services/notification/common/notificationService.ts",
@ -809,7 +812,6 @@
"./vs/workbench/services/title/common/titleService.ts",
"./vs/workbench/services/workspace/common/workspaceEditing.ts",
"./vs/workbench/test/common/editor/editorOptions.test.ts",
"./vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts",
"./vs/workbench/test/common/notifications.test.ts",
"./vs/workbench/test/electron-browser/api/extHostTypes.test.ts",
"./vs/workbench/test/electron-browser/api/mock.ts"

View File

@ -36,7 +36,7 @@ export interface ITextModelContentProvider {
/**
* Given a resource, return the content of the resource as `ITextModel`.
*/
provideTextContent(resource: URI): Promise<ITextModel>;
provideTextContent(resource: URI): Promise<ITextModel> | null;
}
export interface ITextEditorModel extends IEditorModel {

View File

@ -46,7 +46,7 @@ export class ReplacePreviewContentProvider implements ITextModelContentProvider,
this.textModelResolverService.registerTextModelContentProvider(network.Schemas.internal, this);
}
provideTextContent(uri: URI): Promise<ITextModel> {
provideTextContent(uri: URI): Promise<ITextModel> | null {
if (uri.fragment === REPLACE_PREVIEW) {
return this.instantiationService.createInstance(ReplacePreviewModel).resolve(uri);
}
@ -103,7 +103,7 @@ export class ReplaceService implements IReplaceService {
replace(match: Match): Promise<any>;
replace(files: FileMatch[], progress?: IProgressRunner): Promise<any>;
replace(match: FileMatchOrMatch, progress?: IProgressRunner, resource?: URI): Promise<any>;
replace(arg: any, progress: IProgressRunner | null = null, resource: URI | null = null): Promise<any> {
replace(arg: any, progress: IProgressRunner | undefined = undefined, resource: URI | null = null): Promise<any> {
const edits: ResourceTextEdit[] = this.createEdits(arg, resource);
return this.bulkEditorService.apply({ edits }, { progress }).then(() => this.textFileService.saveAll(edits.map(e => e.resource)));