Skip to content

Commit 6cbbb7e

Browse files
committed
add NoPermissions-error, more jsdoc, microsoft#48527
1 parent 5b38ec4 commit 6cbbb7e

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/vs/vscode.d.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4854,17 +4854,14 @@ declare module 'vscode' {
48544854
* to a file.
48554855
*/
48564856
type: FileType;
4857-
48584857
/**
4859-
* The creation timestamp in milliseconds.
4858+
* The creation timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
48604859
*/
48614860
ctime: number;
4862-
48634861
/**
4864-
* The modification timestamp in milliseconds.
4862+
* The modification timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
48654863
*/
48664864
mtime: number;
4867-
48684865
/**
48694866
* The size in bytes.
48704867
*/
@@ -4904,6 +4901,12 @@ declare module 'vscode' {
49044901
*/
49054902
static FileIsADirectory(messageOrUri?: string | Uri): FileSystemError;
49064903

4904+
/**
4905+
* Create an error to signal that an operation lacks required permissions.
4906+
* @param messageOrUri Message or uri.
4907+
*/
4908+
static NoPermissions(messageOrUri?: string | Uri): FileSystemError;
4909+
49074910
/**
49084911
* Creates a new filesystem error.
49094912
*
@@ -5043,6 +5046,7 @@ declare module 'vscode' {
50435046
* @param options Defines if existing files should be overwriten.
50445047
* @returns Metadata about the renamed file or a thenable that resolves to such.
50455048
* @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `oldUri` doesn't exist.
5049+
* @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `newUri` doesn't exist
50465050
* @throws [`FileExists`](#FileSystemError.FileExists) when `newUri` exists and when the `overwrite` option is not `true`.
50475051
*/
50485052
rename(oldUri: Uri, newUri: Uri, options: { overwrite: boolean }): FileStat | Thenable<FileStat>;
@@ -5055,8 +5059,9 @@ declare module 'vscode' {
50555059
* @param destination The destination location.
50565060
* @param options Defines if existing files should be overwriten.
50575061
* @returns Metadata about the copied file or a thenable that resolves to such.
5058-
* @throws [`FileNotFound`](FileSystemError.FileNotFound) when `source` doesn't exist
5059-
* @throws [`FileExists`](FileSystemError.FileExists) when `destination` exists and when the `overwrite` option is not `true`.
5062+
* @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `source` doesn't exist
5063+
* @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `destination` doesn't exist
5064+
* @throws [`FileExists`](#FileSystemError.FileExists) when `destination` exists and when the `overwrite` option is not `true`.
50605065
*/
50615066
copy?(source: Uri, destination: Uri, options: { overwrite: boolean }): FileStat | Thenable<FileStat>;
50625067
}

src/vs/workbench/api/node/extHostTypes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,9 @@ export class FileSystemError extends Error {
18781878
static FileIsADirectory(messageOrUri?: string | URI): FileSystemError {
18791879
return new FileSystemError(messageOrUri, 'EntryIsADirectory', FileSystemError.FileIsADirectory);
18801880
}
1881+
static NoPermissions(messageOrUri?: string | URI): FileSystemError {
1882+
return new FileSystemError(messageOrUri, 'NoPermissions', FileSystemError.NoPermissions);
1883+
}
18811884

18821885
constructor(uriOrMessage?: string | URI, code?: string, terminator?: Function) {
18831886
super(URI.isUri(uriOrMessage) ? uriOrMessage.toString(true) : uriOrMessage);

src/vs/workbench/services/files/electron-browser/remoteFileService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ export class RemoteFileService extends FileService {
240240
case 'EntryIsADirectory':
241241
res = FileOperationResult.FILE_IS_DIRECTORY;
242242
break;
243+
case 'NoPermissions':
244+
res = FileOperationResult.FILE_PERMISSION_DENIED;
245+
break;
243246
case 'EntryExists':
247+
res = FileOperationResult.FILE_MOVE_CONFLICT;
248+
break;
244249
case 'EntryNotADirectory':
245250
default:
246251
// todo

0 commit comments

Comments
 (0)