Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e5246522
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5246522
编写于
4月 18, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
go a little slower on well-defined errors, #47475
上级
fbdc0496
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
39 deletion
+43
-39
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+6
-7
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+28
-27
src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts
...vs/workbench/api/electron-browser/mainThreadFileSystem.ts
+7
-3
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
...ench/services/files/electron-browser/remoteFileService.ts
+2
-2
未找到文件。
src/vs/platform/files/common/files.ts
浏览文件 @
e5246522
...
...
@@ -158,14 +158,13 @@ export enum FileType2 {
export
class
FileError
extends
Error
{
static
readonly
EntryExists
=
new
FileError
(
'
EEXIST
'
);
static
readonly
EntryNotFound
=
new
FileError
(
'
ENOENT
'
);
static
readonly
EntryNotADirectory
=
new
FileError
(
'
ENOTDIR
'
);
static
readonly
EntryIsADirectory
=
new
FileError
(
'
EISDIR
'
);
static
readonly
EEXIST
=
new
FileError
(
'
EEXIST
'
);
static
readonly
ENOENT
=
new
FileError
(
'
ENOENT
'
);
static
readonly
ENOTDIR
=
new
FileError
(
'
ENOTDIR
'
);
static
readonly
EISDIR
=
new
FileError
(
'
EISDIR
'
);
constructor
(
readonly
code
:
string
)
{
super
(
code
);
constructor
(
readonly
code
:
string
,
message
?:
string
)
{
super
(
message
||
code
);
}
is
(
err
:
any
):
err
is
FileError
{
if
(
!
err
||
typeof
err
!==
'
object
'
)
{
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
e5246522
...
...
@@ -172,32 +172,32 @@ declare module 'vscode' {
// create(resource: Uri): Thenable<FileStat>;
}
export
class
FileError
extends
Error
{
//
export class FileError extends Error {
/**
* Entry already exists
.
*/
static
readonly
EEXIST
:
FileError
;
//
/**
// * Entry already exists, e.g. when creating a file or folder
.
//
*/
// static readonly EntryExists
: FileError;
/**
* Entry does not exist.
*/
static
readonly
ENOENT
:
FileError
;
//
/**
//
* Entry does not exist.
//
*/
// static readonly EntryNotFound
: FileError;
/**
* Entry is not a directory.
*/
static
readonly
ENOTDIR
:
FileError
;
//
/**
//
* Entry is not a directory.
//
*/
// static readonly EntryNotADirectory
: FileError;
/**
* Entry is a directory.
*/
static
readonly
EISDIR
:
FileError
;
//
/**
//
* Entry is a directory.
//
*/
// static readonly EntryIsADirectory
: FileError;
readonly
code
:
string
;
//
readonly code: string;
constructor
(
code
:
string
,
message
?:
string
);
}
//
constructor(code: string, message?: string);
//
}
export
enum
FileChangeType2
{
Changed
=
1
,
...
...
@@ -229,7 +229,9 @@ declare module 'vscode' {
Exclusive
=
0b1000
}
// todo@joh add open/close calls?
/**
*
*/
export
interface
FileSystemProvider2
{
_version
:
7
;
...
...
@@ -242,15 +244,14 @@ declare module 'vscode' {
readonly
onDidChangeFile
:
Event
<
FileChange2
[]
>
;
/**
* Subscribe to events in the file or folder denoted by `uri`.
* @param uri
* @param options
* Subscribe to events in the file or folder denoted by `uri`.
* @param uri
* @param options
*/
watch
(
uri
:
Uri
,
options
:
{
recursive
?:
boolean
;
excludes
?:
string
[]
}):
Disposable
;
/**
* Retrieve metadata about a file. Must throw an [`ENOENT`](#FileError.ENOENT)-error
* when the file doesn't exist.
* Retrieve metadata about a file.
*
* @param uri The uri of the file to retrieve meta data about.
* @param token A cancellation token.
...
...
@@ -269,7 +270,7 @@ declare module 'vscode' {
/**
* Create a new directory. *Note* that new files are created via `write`-calls.
*
*
* @param uri The uri of the *new* folder.
* @param token A cancellation token.
*/
...
...
src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts
浏览文件 @
e5246522
...
...
@@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
FileOpenFlags
,
IFileChange
,
IFileService
,
IFileSystemProviderBase
,
ISimpleReadWriteProvider
,
IStat
,
IWatchOptions
}
from
'
vs/platform/files/common/files
'
;
import
{
FileOpenFlags
,
IFileChange
,
IFileService
,
IFileSystemProviderBase
,
ISimpleReadWriteProvider
,
IStat
,
IWatchOptions
,
FileError
}
from
'
vs/platform/files/common/files
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
ExtHostContext
,
ExtHostFileSystemShape
,
IExtHostContext
,
IFileChangeDto
,
MainContext
,
MainThreadFileSystemShape
}
from
'
../node/extHost.protocol
'
;
...
...
@@ -86,8 +86,10 @@ class RemoteFileSystemProvider implements ISimpleReadWriteProvider, IFileSystemP
// --- forwarding calls
stat
(
resource
:
URI
):
TPromise
<
IStat
,
any
>
{
return
this
.
_proxy
.
$stat
(
this
.
_handle
,
resource
);
stat
(
resource
:
URI
):
TPromise
<
IStat
,
FileError
>
{
return
this
.
_proxy
.
$stat
(
this
.
_handle
,
resource
).
then
(
undefined
,
err
=>
{
throw
err
;
});
}
readFile
(
resource
:
URI
,
opts
:
{
flags
:
FileOpenFlags
}):
TPromise
<
Uint8Array
,
any
>
{
return
this
.
_proxy
.
$readFile
(
this
.
_handle
,
resource
,
opts
.
flags
).
then
(
encoded
=>
{
...
...
@@ -112,4 +114,6 @@ class RemoteFileSystemProvider implements ISimpleReadWriteProvider, IFileSystemP
readdir
(
resource
:
URI
):
TPromise
<
[
string
,
IStat
][],
any
>
{
return
this
.
_proxy
.
$readdir
(
this
.
_handle
,
resource
);
}
}
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
e5246522
...
...
@@ -369,8 +369,8 @@ export class RemoteFileService extends FileService {
this
.
_onAfterOperation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
CREATE
,
fileStat
));
return
fileStat
;
},
err
=>
{
if
(
FileError
.
E
EXIST
.
is
(
err
))
{
return
TPromise
.
wrapError
(
new
FileOperationError
(
'
EEXIST
'
,
FileOperationResult
.
FILE_MODIFIED_SINCE
,
options
));
if
(
FileError
.
E
ntryExists
.
is
(
err
))
{
return
TPromise
.
wrapError
(
new
FileOperationError
(
err
.
code
,
FileOperationResult
.
FILE_MODIFIED_SINCE
,
options
));
}
throw
err
;
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录