// Target cannot be dirty if not writing into buffer
if(this.textFileService.isDirty(this.resource)){
returnPromise.reject(newError(localize('errorKeybindingsFileDirty',"Unable to write because the keybindings configuration file is dirty. Please save it first and then try again.")));
}
returnthis.resolveModelReference()
.then(reference=>{
constmodel=reference.object.textEditorModel;
constEOL=model.getEOL();
if(model.getValue()){
constparsed=this.parse(model);
if(parsed.parseErrors.length){
returnPromise.reject<any>(newError(localize('parseErrors',"Unable to write to the keybindings configuration file. Please open it to correct errors/warnings in the file and try again.")));
}
if(parsed.result){
if(!isArray(parsed.result)){
returnPromise.reject<any>(newError(localize('errorInvalidConfiguration',"Unable to write to the keybindings configuration file. It has an object which is not of type Array. Please open the file to clean up and try again.")));
returnPromise.reject<any>(newError(localize('parseErrors',"Unable to write to the keybindings configuration file. Please open it to correct errors/warnings in the file and try again.")));
}
if(parsed.result){
if(!isArray(parsed.result)){
returnPromise.reject<any>(newError(localize('errorInvalidConfiguration',"Unable to write to the keybindings configuration file. It has an object which is not of type Array. Please open the file to clean up and try again.")));