// Return early for same input unless we force to open
constforceOpen=options&&options.forceOpen;
if(!forceOpen&&input.matches(this.input)){
returnTPromise.wrap<void>(null);
// Check for cancellation
if(token.isCancellationRequested){
returnvoid0;
}
// Otherwise set input and resolve
returnsuper.setInput(input,options).then(()=>{
returninput.resolve(true).then(model=>{
// Assert Model instance
if(!(modelinstanceofBinaryEditorModel)){
returnTPromise.wrapError<void>(newError('Unable to open file as binary'));
}
// Assert that the current input is still the one we expect. This prevents a race condition when loading takes long and another input was set meanwhile
// Assert that the current input is still the one we expect. This prevents a race condition when loading a diff takes long and another input was set meanwhile
returnTPromise.wrapError<void>(newError('Unable to open file as text'));
}
// Assert that the current input is still the one we expect. This prevents a race condition when loading takes long and another input was set meanwhile