returnTPromise.wrapError<void>('Unable to open file as binary');
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
returnTPromise.wrapError<void>('Unable to open file as text');
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
@@ -86,7 +86,7 @@ export class ResourceEditorInput extends EditorInput {
if(!(modelinstanceofResourceEditorModel)){
ref.dispose();
this.modelReference=null;
returnTPromise.wrapError<ITextEditorModel>(`Unexpected model for ResourceInput: ${this.resource}`);// TODO@Ben eventually also files should be supported, but we guard due to the dangerous dispose of the model in dispose()
returnTPromise.wrapError<ITextEditorModel>(newError(`Unexpected model for ResourceInput: ${this.resource}`));// TODO@Ben eventually also files should be supported, but we guard due to the dangerous dispose of the model in dispose()
@@ -200,7 +200,7 @@ export class ExtensionHostMain {
this.gracefulExit(1/* ERROR */);
}
returnTPromise.wrapError<void>(requireError?requireError.toString():nls.localize('extensionTestError',"Path {0} does not point to a valid extension test runner.",this._environment.extensionTestsPath));
returnTPromise.wrapError<void>(newError(requireError?requireError.toString():nls.localize('extensionTestError',"Path {0} does not point to a valid extension test runner.",this._environment.extensionTestsPath)));
returnTPromise.wrapError<boolean>(newError(nls.localize('fail.createSettings',"Unable to create '{0}' ({1}).",labels.getPathLabel(resource,this.contextService,this.environmentService),error)));
this.choiceService.choose(Severity.Error,error.message,[nls.localize('saveAndRetry',"Save Settings and Retry"),nls.localize('open',"Open Settings"),nls.localize('close',"Close")],2)
.then(option=>{
switch(option){
...
...
@@ -150,14 +152,10 @@ export class ConfigurationEditingService implements IConfigurationEditingService
returnTPromise.wrapError<IStreamContent>(newFileOperationError(nls.localize('fileNotModifiedError',"File not modified since"),FileOperationResult.FILE_NOT_MODIFIED_SINCE));
returnTPromise.wrapError<IStreamContent>(newFileOperationError(nls.localize('fileTooLargeError',"File too large to open"),FileOperationResult.FILE_TOO_LARGE));
}
// 2.) detect mimes
...
...
@@ -257,10 +251,10 @@ export class FileService implements IFileService {
// Return error early if client only accepts text and this is not text
returnTPromise.wrapError<boolean>(newFileOperationError(nls.localize('fileMoveConflict',"Unable to move/copy. File already exists at destination."),FileOperationResult.FILE_MOVE_CONFLICT));
}
// 2.) make sure target is deleted before we move/copy unless this is a case rename of the same file
returnTPromise.wrapError<boolean>(nls.localize('unableToMoveCopyError',"Unable to move/copy. File would replace folder it is contained in."));// catch this corner case!
returnTPromise.wrapError<boolean>(newError(nls.localize('unableToMoveCopyError',"Unable to move/copy. File would replace folder it is contained in.")));// catch this corner case!
@@ -514,7 +505,7 @@ export class FileService implements IFileService {
// 1.) resolve
returnpfs.stat(sourcePath).then(stat=>{
if(stat.isDirectory()){
returnTPromise.wrapError<IImportResult>(nls.localize('foldersCopyError',"Folders cannot be copied into the workspace. Please select individual files to copy them."));// for now we do not allow to import a folder into a workspace
returnTPromise.wrapError<IImportResult>(newError(nls.localize('foldersCopyError',"Folders cannot be copied into the workspace. Please select individual files to copy them.")));// for now we do not allow to import a folder into a workspace
}
// 2.) copy
...
...
@@ -574,10 +565,7 @@ export class FileService implements IFileService {
returnTPromise.wrapError<IStreamContent>(newFileOperationError(nls.localize('fileTooLargeError',"File too large to open"),FileOperationResult.FILE_TOO_LARGE));
}
constabsolutePath=this.toAbsolutePath(model);
...
...
@@ -682,10 +670,7 @@ export class FileService implements IFileService {
// Target cannot be dirty if not writing into buffer
if(this.textFileService.isDirty(this.resource)){
returnTPromise.wrapError<IReference<ITextEditorModel>>(localize('errorKeybindingsFileDirty',"Unable to write because the file is dirty. Please save the **Keybindings** file and try again."));
returnTPromise.wrapError<IReference<ITextEditorModel>>(newError(localize('errorKeybindingsFileDirty',"Unable to write because the file is dirty. Please save the **Keybindings** file and try again.")));
returnTPromise.wrapError<IReference<ITextEditorModel>>(localize('parseErrors',"Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again."));
returnTPromise.wrapError<IReference<ITextEditorModel>>(newError(localize('parseErrors',"Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again.")));
}
if(parsed.result){
if(!isArray(parsed.result)){
returnTPromise.wrapError<IReference<ITextEditorModel>>(localize('errorInvalidConfiguration',"Unable to write keybindings. **Keybindings file** has an object which is not of type Array. Please open the file to clean up and try again."));
returnTPromise.wrapError<IReference<ITextEditorModel>>(newError(localize('errorInvalidConfiguration',"Unable to write keybindings. **Keybindings file** has an object which is not of type Array. Please open the file to clean up and try again.")));
.then(()=>assert.fail('Should fail with parse errors'),
error=>assert.equal(error,'Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again.'));
error=>assert.equal(error.message,'Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again.'));
.then(()=>assert.fail('Should fail with parse errors'),
error=>assert.equal(error,'Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again.'));
error=>assert.equal(error.message,'Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again.'));
.then(()=>assert.fail('Should fail with dirty error'),
error=>assert.equal(error,'Unable to write keybindings. **Keybindings file** has an object which is not of type Array. Please open the file to clean up and try again.'));
error=>assert.equal(error.message,'Unable to write keybindings. **Keybindings file** has an object which is not of type Array. Please open the file to clean up and try again.'));
});
test('edit a default keybinding to an empty file',()=>{