diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 8c69773e1f4..68d3bc42576 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -4854,17 +4854,14 @@ declare module 'vscode' { * to a file. */ type: FileType; - /** - * The creation timestamp in milliseconds. + * The creation timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC. */ ctime: number; - /** - * The modification timestamp in milliseconds. + * The modification timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC. */ mtime: number; - /** * The size in bytes. */ @@ -4904,6 +4901,12 @@ declare module 'vscode' { */ static FileIsADirectory(messageOrUri?: string | Uri): FileSystemError; + /** + * Create an error to signal that an operation lacks required permissions. + * @param messageOrUri Message or uri. + */ + static NoPermissions(messageOrUri?: string | Uri): FileSystemError; + /** * Creates a new filesystem error. * @@ -5043,6 +5046,7 @@ declare module 'vscode' { * @param options Defines if existing files should be overwriten. * @returns Metadata about the renamed file or a thenable that resolves to such. * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `oldUri` doesn't exist. + * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `newUri` doesn't exist * @throws [`FileExists`](#FileSystemError.FileExists) when `newUri` exists and when the `overwrite` option is not `true`. */ rename(oldUri: Uri, newUri: Uri, options: { overwrite: boolean }): FileStat | Thenable; @@ -5055,8 +5059,9 @@ declare module 'vscode' { * @param destination The destination location. * @param options Defines if existing files should be overwriten. * @returns Metadata about the copied file or a thenable that resolves to such. - * @throws [`FileNotFound`](FileSystemError.FileNotFound) when `source` doesn't exist - * @throws [`FileExists`](FileSystemError.FileExists) when `destination` exists and when the `overwrite` option is not `true`. + * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `source` doesn't exist + * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `destination` doesn't exist + * @throws [`FileExists`](#FileSystemError.FileExists) when `destination` exists and when the `overwrite` option is not `true`. */ copy?(source: Uri, destination: Uri, options: { overwrite: boolean }): FileStat | Thenable; } diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index b1cb67d05c0..1d84be94566 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -1878,6 +1878,9 @@ export class FileSystemError extends Error { static FileIsADirectory(messageOrUri?: string | URI): FileSystemError { return new FileSystemError(messageOrUri, 'EntryIsADirectory', FileSystemError.FileIsADirectory); } + static NoPermissions(messageOrUri?: string | URI): FileSystemError { + return new FileSystemError(messageOrUri, 'NoPermissions', FileSystemError.NoPermissions); + } constructor(uriOrMessage?: string | URI, code?: string, terminator?: Function) { super(URI.isUri(uriOrMessage) ? uriOrMessage.toString(true) : uriOrMessage); diff --git a/src/vs/workbench/services/files/electron-browser/remoteFileService.ts b/src/vs/workbench/services/files/electron-browser/remoteFileService.ts index 50accd1da5d..34a7b3d7609 100644 --- a/src/vs/workbench/services/files/electron-browser/remoteFileService.ts +++ b/src/vs/workbench/services/files/electron-browser/remoteFileService.ts @@ -240,7 +240,12 @@ export class RemoteFileService extends FileService { case 'EntryIsADirectory': res = FileOperationResult.FILE_IS_DIRECTORY; break; + case 'NoPermissions': + res = FileOperationResult.FILE_PERMISSION_DENIED; + break; case 'EntryExists': + res = FileOperationResult.FILE_MOVE_CONFLICT; + break; case 'EntryNotADirectory': default: // todo