提交 2bf25467 编写于 作者: J Johannes Rieken

a bit more jsdoc, #47475

上级 d2c42866
......@@ -100,16 +100,44 @@ declare module 'vscode' {
//#region Joh: file system provider (new)
/**
* A type that filesystem providers should use to signal errors.
*
* This class has factory methods for common error-cases, like `EntryNotFound` when
* a file or folder doesn't exist. Use them like so `throw vscode.FileSystemError.EntryNotFound(uri);`
*/
export class FileSystemError extends Error {
static EntryExists(message?: string): FileSystemError;
static EntryNotFound(message?: string): FileSystemError;
static EntryNotADirectory(message?: string): FileSystemError;
static EntryIsADirectory(message?: string): FileSystemError;
/**
* Create an error to signal that a file or folder wasn't found.
* @param messageOrUri Message or uri.
*/
static EntryNotFound(messageOrUri?: string | Uri): FileSystemError;
/**
* Create an error to signal that a file or folder already exists, e.g. when
* creating but not overwriting a file.
* @param messageOrUri Message or uri.
*/
static EntryExists(messageOrUri?: string | Uri): FileSystemError;
constructor(message?: string);
/**
* Create an error to signal that a file is not a folder.
* @param messageOrUri Message or uri.
*/
static EntryNotADirectory(messageOrUri?: string | Uri): FileSystemError;
/**
* Create an error to signal that a file is a folder.
* @param messageOrUri Message or uri.
*/
static EntryIsADirectory(messageOrUri?: string | Uri): FileSystemError;
/**
* Creates a new filesystem error.
*
* @param messageOrUri Message or uri.
*/
constructor(messageOrUri?: string | Uri);
}
export enum FileChangeType2 {
......@@ -122,6 +150,10 @@ declare module 'vscode' {
* The event filesystem providers must use to signal a file change.
*/
export interface FileChangeEvent {
/**
*
*/
type: FileChangeType2;
/**
......@@ -131,7 +163,7 @@ declare module 'vscode' {
}
/**
* Metadata about a file.
* The `FileStat`-type represents metadata about a file.
*/
export interface FileStat2 {
/**
......@@ -161,7 +193,7 @@ declare module 'vscode' {
}
/**
*
* Commonly used options when reading, writing, or stat'ing files or folders.
*/
export interface FileOptions {
......
......@@ -1834,26 +1834,26 @@ export enum FileType {
export class FileSystemError extends Error {
static EntryExists(message?: string): FileSystemError {
return new FileSystemError(message, 'EntryExists', FileSystemError.EntryExists);
static EntryExists(messageOrUri?: string | URI): FileSystemError {
return new FileSystemError(messageOrUri, 'EntryExists', FileSystemError.EntryExists);
}
static EntryNotFound(message?: string): FileSystemError {
return new FileSystemError(message, 'EntryNotFound', FileSystemError.EntryNotFound);
static EntryNotFound(messageOrUri?: string | URI): FileSystemError {
return new FileSystemError(messageOrUri, 'EntryNotFound', FileSystemError.EntryNotFound);
}
static EntryNotADirectory(message?: string): FileSystemError {
return new FileSystemError(message, 'EntryNotADirectory', FileSystemError.EntryNotADirectory);
static EntryNotADirectory(messageOrUri?: string | URI): FileSystemError {
return new FileSystemError(messageOrUri, 'EntryNotADirectory', FileSystemError.EntryNotADirectory);
}
static EntryIsADirectory(message?: string): FileSystemError {
return new FileSystemError(message, 'EntryIsADirectory', FileSystemError.EntryIsADirectory);
static EntryIsADirectory(messageOrUri?: string | URI): FileSystemError {
return new FileSystemError(messageOrUri, 'EntryIsADirectory', FileSystemError.EntryIsADirectory);
}
constructor(message?: string, code?: string, hide?: Function) {
super(message);
constructor(uriOrMessage?: string | URI, code?: string, terminator?: Function) {
super(URI.isUri(uriOrMessage) ? uriOrMessage.toString(true) : uriOrMessage);
this.name = code ? `${code} (FileSystemError)` : `FileSystemError`;
if (typeof Error.captureStackTrace === 'function' && typeof hide === 'function') {
if (typeof Error.captureStackTrace === 'function' && typeof terminator === 'function') {
// nice stack traces
Error.captureStackTrace(this, hide);
Error.captureStackTrace(this, terminator);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册