Skip to content

Commit

Permalink
add NoPermissions-error, more jsdoc, #48527
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Apr 26, 2018
1 parent 5b38ec4 commit 6cbbb7e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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<FileStat>;
Expand All @@ -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<FileStat>;
}
Expand Down
3 changes: 3 additions & 0 deletions src/vs/workbench/api/node/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6cbbb7e

Please sign in to comment.