Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9be61bb1
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9be61bb1
编写于
9月 04, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - use Thenable in ExtHostFileSystemShape and in FileSystemProvider
上级
efd8f4a4
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
64 addition
and
71 deletion
+64
-71
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+12
-12
src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts
...vs/workbench/api/electron-browser/mainThreadFileSystem.ts
+12
-13
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+12
-12
src/vs/workbench/api/node/extHostFileSystem.ts
src/vs/workbench/api/node/extHostFileSystem.ts
+26
-32
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
浏览文件 @
9be61bb1
...
@@ -198,21 +198,21 @@ export interface IFileSystemProvider {
...
@@ -198,21 +198,21 @@ export interface IFileSystemProvider {
onDidChangeFile
:
Event
<
IFileChange
[]
>
;
onDidChangeFile
:
Event
<
IFileChange
[]
>
;
watch
(
resource
:
URI
,
opts
:
IWatchOptions
):
IDisposable
;
watch
(
resource
:
URI
,
opts
:
IWatchOptions
):
IDisposable
;
stat
(
resource
:
URI
):
T
Promis
e
<
IStat
>
;
stat
(
resource
:
URI
):
T
henabl
e
<
IStat
>
;
mkdir
(
resource
:
URI
):
T
Promis
e
<
void
>
;
mkdir
(
resource
:
URI
):
T
henabl
e
<
void
>
;
readdir
(
resource
:
URI
):
T
Promis
e
<
[
string
,
FileType
][]
>
;
readdir
(
resource
:
URI
):
T
henabl
e
<
[
string
,
FileType
][]
>
;
delete
(
resource
:
URI
,
opts
:
FileDeleteOptions
):
T
Promis
e
<
void
>
;
delete
(
resource
:
URI
,
opts
:
FileDeleteOptions
):
T
henabl
e
<
void
>
;
rename
(
from
:
URI
,
to
:
URI
,
opts
:
FileOverwriteOptions
):
T
Promis
e
<
void
>
;
rename
(
from
:
URI
,
to
:
URI
,
opts
:
FileOverwriteOptions
):
T
henabl
e
<
void
>
;
copy
?(
from
:
URI
,
to
:
URI
,
opts
:
FileOverwriteOptions
):
T
Promis
e
<
void
>
;
copy
?(
from
:
URI
,
to
:
URI
,
opts
:
FileOverwriteOptions
):
T
henabl
e
<
void
>
;
readFile
?(
resource
:
URI
):
T
Promis
e
<
Uint8Array
>
;
readFile
?(
resource
:
URI
):
T
henabl
e
<
Uint8Array
>
;
writeFile
?(
resource
:
URI
,
content
:
Uint8Array
,
opts
:
FileWriteOptions
):
T
Promis
e
<
void
>
;
writeFile
?(
resource
:
URI
,
content
:
Uint8Array
,
opts
:
FileWriteOptions
):
T
henabl
e
<
void
>
;
open
?(
resource
:
URI
):
T
Promis
e
<
number
>
;
open
?(
resource
:
URI
):
T
henabl
e
<
number
>
;
close
?(
fd
:
number
):
T
Promis
e
<
void
>
;
close
?(
fd
:
number
):
T
henabl
e
<
void
>
;
read
?(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
Promis
e
<
number
>
;
read
?(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
henabl
e
<
number
>
;
write
?(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
Promis
e
<
number
>
;
write
?(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
henabl
e
<
number
>
;
}
}
export
interface
IFileSystemProviderRegistrationEvent
{
export
interface
IFileSystemProviderRegistrationEvent
{
...
...
src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts
浏览文件 @
9be61bb1
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
FileWriteOptions
,
FileSystemProviderCapabilities
,
IFileChange
,
IFileService
,
IFileSystemProvider
,
IStat
,
IWatchOptions
,
FileType
,
FileOverwriteOptions
,
FileDeleteOptions
}
from
'
vs/platform/files/common/files
'
;
import
{
FileWriteOptions
,
FileSystemProviderCapabilities
,
IFileChange
,
IFileService
,
IFileSystemProvider
,
IStat
,
IWatchOptions
,
FileType
,
FileOverwriteOptions
,
FileDeleteOptions
}
from
'
vs/platform/files/common/files
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
ExtHostContext
,
ExtHostFileSystemShape
,
IExtHostContext
,
IFileChangeDto
,
MainContext
,
MainThreadFileSystemShape
}
from
'
../node/extHost.protocol
'
;
import
{
ExtHostContext
,
ExtHostFileSystemShape
,
IExtHostContext
,
IFileChangeDto
,
MainContext
,
MainThreadFileSystemShape
}
from
'
../node/extHost.protocol
'
;
...
@@ -96,53 +95,53 @@ class RemoteFileSystemProvider implements IFileSystemProvider {
...
@@ -96,53 +95,53 @@ class RemoteFileSystemProvider implements IFileSystemProvider {
return
Buffer
.
isBuffer
(
data
)
?
data
:
Buffer
.
from
(
data
.
buffer
,
data
.
byteOffset
,
data
.
byteLength
);
return
Buffer
.
isBuffer
(
data
)
?
data
:
Buffer
.
from
(
data
.
buffer
,
data
.
byteOffset
,
data
.
byteLength
);
}
}
stat
(
resource
:
URI
):
T
Promis
e
<
IStat
>
{
stat
(
resource
:
URI
):
T
henabl
e
<
IStat
>
{
return
this
.
_proxy
.
$stat
(
this
.
_handle
,
resource
).
then
(
undefined
,
err
=>
{
return
this
.
_proxy
.
$stat
(
this
.
_handle
,
resource
).
then
(
undefined
,
err
=>
{
throw
err
;
throw
err
;
});
});
}
}
readFile
(
resource
:
URI
):
T
Promis
e
<
Uint8Array
>
{
readFile
(
resource
:
URI
):
T
henabl
e
<
Uint8Array
>
{
return
this
.
_proxy
.
$readFile
(
this
.
_handle
,
resource
);
return
this
.
_proxy
.
$readFile
(
this
.
_handle
,
resource
);
}
}
writeFile
(
resource
:
URI
,
content
:
Uint8Array
,
opts
:
FileWriteOptions
):
T
Promis
e
<
void
>
{
writeFile
(
resource
:
URI
,
content
:
Uint8Array
,
opts
:
FileWriteOptions
):
T
henabl
e
<
void
>
{
return
this
.
_proxy
.
$writeFile
(
this
.
_handle
,
resource
,
RemoteFileSystemProvider
.
_asBuffer
(
content
),
opts
);
return
this
.
_proxy
.
$writeFile
(
this
.
_handle
,
resource
,
RemoteFileSystemProvider
.
_asBuffer
(
content
),
opts
);
}
}
delete
(
resource
:
URI
,
opts
:
FileDeleteOptions
):
T
Promis
e
<
void
>
{
delete
(
resource
:
URI
,
opts
:
FileDeleteOptions
):
T
henabl
e
<
void
>
{
return
this
.
_proxy
.
$delete
(
this
.
_handle
,
resource
,
opts
);
return
this
.
_proxy
.
$delete
(
this
.
_handle
,
resource
,
opts
);
}
}
mkdir
(
resource
:
URI
):
T
Promis
e
<
void
>
{
mkdir
(
resource
:
URI
):
T
henabl
e
<
void
>
{
return
this
.
_proxy
.
$mkdir
(
this
.
_handle
,
resource
);
return
this
.
_proxy
.
$mkdir
(
this
.
_handle
,
resource
);
}
}
readdir
(
resource
:
URI
):
T
Promis
e
<
[
string
,
FileType
][]
>
{
readdir
(
resource
:
URI
):
T
henabl
e
<
[
string
,
FileType
][]
>
{
return
this
.
_proxy
.
$readdir
(
this
.
_handle
,
resource
);
return
this
.
_proxy
.
$readdir
(
this
.
_handle
,
resource
);
}
}
rename
(
resource
:
URI
,
target
:
URI
,
opts
:
FileOverwriteOptions
):
T
Promis
e
<
void
>
{
rename
(
resource
:
URI
,
target
:
URI
,
opts
:
FileOverwriteOptions
):
T
henabl
e
<
void
>
{
return
this
.
_proxy
.
$rename
(
this
.
_handle
,
resource
,
target
,
opts
);
return
this
.
_proxy
.
$rename
(
this
.
_handle
,
resource
,
target
,
opts
);
}
}
copy
(
resource
:
URI
,
target
:
URI
,
opts
:
FileOverwriteOptions
):
T
Promis
e
<
void
>
{
copy
(
resource
:
URI
,
target
:
URI
,
opts
:
FileOverwriteOptions
):
T
henabl
e
<
void
>
{
return
this
.
_proxy
.
$copy
(
this
.
_handle
,
resource
,
target
,
opts
);
return
this
.
_proxy
.
$copy
(
this
.
_handle
,
resource
,
target
,
opts
);
}
}
open
(
resource
:
URI
):
T
Promis
e
<
number
>
{
open
(
resource
:
URI
):
T
henabl
e
<
number
>
{
return
this
.
_proxy
.
$open
(
this
.
_handle
,
resource
);
return
this
.
_proxy
.
$open
(
this
.
_handle
,
resource
);
}
}
close
(
fd
:
number
):
T
Promis
e
<
void
>
{
close
(
fd
:
number
):
T
henabl
e
<
void
>
{
return
this
.
_proxy
.
$close
(
this
.
_handle
,
fd
);
return
this
.
_proxy
.
$close
(
this
.
_handle
,
fd
);
}
}
read
(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
Promis
e
<
number
>
{
read
(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
henabl
e
<
number
>
{
return
this
.
_proxy
.
$read
(
this
.
_handle
,
fd
,
pos
,
RemoteFileSystemProvider
.
_asBuffer
(
data
),
offset
,
length
);
return
this
.
_proxy
.
$read
(
this
.
_handle
,
fd
,
pos
,
RemoteFileSystemProvider
.
_asBuffer
(
data
),
offset
,
length
);
}
}
write
(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
Promis
e
<
number
>
{
write
(
fd
:
number
,
pos
:
number
,
data
:
Uint8Array
,
offset
:
number
,
length
:
number
):
T
henabl
e
<
number
>
{
return
this
.
_proxy
.
$write
(
this
.
_handle
,
fd
,
pos
,
RemoteFileSystemProvider
.
_asBuffer
(
data
),
offset
,
length
);
return
this
.
_proxy
.
$write
(
this
.
_handle
,
fd
,
pos
,
RemoteFileSystemProvider
.
_asBuffer
(
data
),
offset
,
length
);
}
}
}
}
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
9be61bb1
...
@@ -681,20 +681,20 @@ export interface ExtHostWorkspaceShape {
...
@@ -681,20 +681,20 @@ export interface ExtHostWorkspaceShape {
}
}
export
interface
ExtHostFileSystemShape
{
export
interface
ExtHostFileSystemShape
{
$stat
(
handle
:
number
,
resource
:
UriComponents
):
T
Promis
e
<
IStat
>
;
$stat
(
handle
:
number
,
resource
:
UriComponents
):
T
henabl
e
<
IStat
>
;
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
T
Promis
e
<
[
string
,
FileType
][]
>
;
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
T
henabl
e
<
[
string
,
FileType
][]
>
;
$readFile
(
handle
:
number
,
resource
:
UriComponents
):
T
Promis
e
<
Buffer
>
;
$readFile
(
handle
:
number
,
resource
:
UriComponents
):
T
henabl
e
<
Buffer
>
;
$writeFile
(
handle
:
number
,
resource
:
UriComponents
,
content
:
Buffer
,
opts
:
FileWriteOptions
):
T
Promis
e
<
void
>
;
$writeFile
(
handle
:
number
,
resource
:
UriComponents
,
content
:
Buffer
,
opts
:
FileWriteOptions
):
T
henabl
e
<
void
>
;
$rename
(
handle
:
number
,
resource
:
UriComponents
,
target
:
UriComponents
,
opts
:
FileOverwriteOptions
):
T
Promis
e
<
void
>
;
$rename
(
handle
:
number
,
resource
:
UriComponents
,
target
:
UriComponents
,
opts
:
FileOverwriteOptions
):
T
henabl
e
<
void
>
;
$copy
(
handle
:
number
,
resource
:
UriComponents
,
target
:
UriComponents
,
opts
:
FileOverwriteOptions
):
T
Promis
e
<
void
>
;
$copy
(
handle
:
number
,
resource
:
UriComponents
,
target
:
UriComponents
,
opts
:
FileOverwriteOptions
):
T
henabl
e
<
void
>
;
$mkdir
(
handle
:
number
,
resource
:
UriComponents
):
T
Promis
e
<
void
>
;
$mkdir
(
handle
:
number
,
resource
:
UriComponents
):
T
henabl
e
<
void
>
;
$delete
(
handle
:
number
,
resource
:
UriComponents
,
opts
:
FileDeleteOptions
):
T
Promis
e
<
void
>
;
$delete
(
handle
:
number
,
resource
:
UriComponents
,
opts
:
FileDeleteOptions
):
T
henabl
e
<
void
>
;
$watch
(
handle
:
number
,
session
:
number
,
resource
:
UriComponents
,
opts
:
IWatchOptions
):
void
;
$watch
(
handle
:
number
,
session
:
number
,
resource
:
UriComponents
,
opts
:
IWatchOptions
):
void
;
$unwatch
(
handle
:
number
,
session
:
number
):
void
;
$unwatch
(
handle
:
number
,
session
:
number
):
void
;
$open
(
handle
:
number
,
resource
:
UriComponents
):
T
Promis
e
<
number
>
;
$open
(
handle
:
number
,
resource
:
UriComponents
):
T
henabl
e
<
number
>
;
$close
(
handle
:
number
,
fd
:
number
):
T
Promis
e
<
void
>
;
$close
(
handle
:
number
,
fd
:
number
):
T
henabl
e
<
void
>
;
$read
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
T
Promis
e
<
number
>
;
$read
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
T
henabl
e
<
number
>
;
$write
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
T
Promis
e
<
number
>
;
$write
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
T
henabl
e
<
number
>
;
}
}
export
interface
ExtHostSearchShape
{
export
interface
ExtHostSearchShape
{
...
...
src/vs/workbench/api/node/extHostFileSystem.ts
浏览文件 @
9be61bb1
...
@@ -5,12 +5,10 @@
...
@@ -5,12 +5,10 @@
'
use strict
'
;
'
use strict
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
MainContext
,
IMainContext
,
ExtHostFileSystemShape
,
MainThreadFileSystemShape
,
IFileChangeDto
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
IMainContext
,
ExtHostFileSystemShape
,
MainThreadFileSystemShape
,
IFileChangeDto
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
files
from
'
vs/platform/files/common/files
'
;
import
*
as
files
from
'
vs/platform/files/common/files
'
;
import
{
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
Range
,
FileChangeType
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
Range
,
FileChangeType
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
ExtHostLanguageFeatures
}
from
'
vs/workbench/api/node/extHostLanguageFeatures
'
;
import
{
ExtHostLanguageFeatures
}
from
'
vs/workbench/api/node/extHostLanguageFeatures
'
;
...
@@ -156,47 +154,43 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
...
@@ -156,47 +154,43 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
return
{
type
,
ctime
,
mtime
,
size
};
return
{
type
,
ctime
,
mtime
,
size
};
}
}
$stat
(
handle
:
number
,
resource
:
UriComponents
):
T
Promise
<
files
.
IStat
>
{
$stat
(
handle
:
number
,
resource
:
UriComponents
):
Promise
<
files
.
IStat
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
stat
(
URI
.
revive
(
resource
))).
then
(
ExtHostFileSystem
.
_asIStat
);
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
stat
(
URI
.
revive
(
resource
))).
then
(
ExtHostFileSystem
.
_asIStat
);
}
}
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
T
Promise
<
[
string
,
files
.
FileType
][]
>
{
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
Promise
<
[
string
,
files
.
FileType
][]
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
readDirectory
(
URI
.
revive
(
resource
)));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
readDirectory
(
URI
.
revive
(
resource
)));
}
}
$readFile
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
Buffer
>
{
$readFile
(
handle
:
number
,
resource
:
UriComponents
):
Promise
<
Buffer
>
{
return
asWinJsPromise
(()
=>
{
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
readFile
(
URI
.
revive
(
resource
))).
then
(
data
=>
{
return
this
.
_fsProvider
.
get
(
handle
).
readFile
(
URI
.
revive
(
resource
));
}).
then
(
data
=>
{
return
Buffer
.
isBuffer
(
data
)
?
data
:
Buffer
.
from
(
data
.
buffer
,
data
.
byteOffset
,
data
.
byteLength
);
return
Buffer
.
isBuffer
(
data
)
?
data
:
Buffer
.
from
(
data
.
buffer
,
data
.
byteOffset
,
data
.
byteLength
);
});
});
}
}
$writeFile
(
handle
:
number
,
resource
:
UriComponents
,
content
:
Buffer
,
opts
:
files
.
FileWriteOptions
):
T
Promise
<
void
>
{
$writeFile
(
handle
:
number
,
resource
:
UriComponents
,
content
:
Buffer
,
opts
:
files
.
FileWriteOptions
):
Promise
<
void
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
writeFile
(
URI
.
revive
(
resource
),
content
,
opts
));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
writeFile
(
URI
.
revive
(
resource
),
content
,
opts
));
}
}
$delete
(
handle
:
number
,
resource
:
UriComponents
,
opts
:
files
.
FileDeleteOptions
):
T
Promise
<
void
>
{
$delete
(
handle
:
number
,
resource
:
UriComponents
,
opts
:
files
.
FileDeleteOptions
):
Promise
<
void
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
delete
(
URI
.
revive
(
resource
),
opts
));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
delete
(
URI
.
revive
(
resource
),
opts
));
}
}
$rename
(
handle
:
number
,
oldUri
:
UriComponents
,
newUri
:
UriComponents
,
opts
:
files
.
FileOverwriteOptions
):
T
Promise
<
void
>
{
$rename
(
handle
:
number
,
oldUri
:
UriComponents
,
newUri
:
UriComponents
,
opts
:
files
.
FileOverwriteOptions
):
Promise
<
void
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
rename
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
rename
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
}
}
$copy
(
handle
:
number
,
oldUri
:
UriComponents
,
newUri
:
UriComponents
,
opts
:
files
.
FileOverwriteOptions
):
T
Promise
<
void
>
{
$copy
(
handle
:
number
,
oldUri
:
UriComponents
,
newUri
:
UriComponents
,
opts
:
files
.
FileOverwriteOptions
):
Promise
<
void
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
copy
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
copy
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
}
}
$mkdir
(
handle
:
number
,
resource
:
UriComponents
):
T
Promise
<
void
>
{
$mkdir
(
handle
:
number
,
resource
:
UriComponents
):
Promise
<
void
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
createDirectory
(
URI
.
revive
(
resource
)));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
createDirectory
(
URI
.
revive
(
resource
)));
}
}
$watch
(
handle
:
number
,
session
:
number
,
resource
:
UriComponents
,
opts
:
files
.
IWatchOptions
):
void
{
$watch
(
handle
:
number
,
session
:
number
,
resource
:
UriComponents
,
opts
:
files
.
IWatchOptions
):
void
{
asWinJsPromise
(()
=>
{
let
subscription
=
this
.
_fsProvider
.
get
(
handle
).
watch
(
URI
.
revive
(
resource
),
opts
);
let
subscription
=
this
.
_fsProvider
.
get
(
handle
).
watch
(
URI
.
revive
(
resource
),
opts
);
this
.
_watches
.
set
(
session
,
subscription
);
this
.
_watches
.
set
(
session
,
subscription
);
});
}
}
$unwatch
(
session
:
number
):
void
{
$unwatch
(
session
:
number
):
void
{
...
@@ -207,20 +201,20 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
...
@@ -207,20 +201,20 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
}
}
}
$open
(
handle
:
number
,
resource
:
UriComponents
):
T
Promise
<
number
>
{
$open
(
handle
:
number
,
resource
:
UriComponents
):
Promise
<
number
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
open
(
URI
.
revive
(
resource
)));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
open
(
URI
.
revive
(
resource
)));
}
}
$close
(
handle
:
number
,
fd
:
number
):
T
Promise
<
void
>
{
$close
(
handle
:
number
,
fd
:
number
):
Promise
<
void
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
close
(
fd
));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
close
(
fd
));
}
}
$read
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
T
Promise
<
number
>
{
$read
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
Promise
<
number
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
read
(
fd
,
pos
,
data
,
offset
,
length
));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
read
(
fd
,
pos
,
data
,
offset
,
length
));
}
}
$write
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
T
Promise
<
number
>
{
$write
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
Buffer
,
offset
:
number
,
length
:
number
):
Promise
<
number
>
{
return
asWinJsPromise
(()
=>
this
.
_fsProvider
.
get
(
handle
).
write
(
fd
,
pos
,
data
,
offset
,
length
));
return
Promise
.
resolve
(
this
.
_fsProvider
.
get
(
handle
).
write
(
fd
,
pos
,
data
,
offset
,
length
));
}
}
}
}
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
9be61bb1
...
@@ -38,7 +38,7 @@ class TypeOnlyStat implements IStat {
...
@@ -38,7 +38,7 @@ class TypeOnlyStat implements IStat {
size
:
number
=
0
;
size
:
number
=
0
;
}
}
function
toIFileStat
(
provider
:
IFileSystemProvider
,
tuple
:
[
URI
,
IStat
],
recurse
?:
(
tuple
:
[
URI
,
IStat
])
=>
boolean
):
T
Promis
e
<
IFileStat
>
{
function
toIFileStat
(
provider
:
IFileSystemProvider
,
tuple
:
[
URI
,
IStat
],
recurse
?:
(
tuple
:
[
URI
,
IStat
])
=>
boolean
):
T
henabl
e
<
IFileStat
>
{
const
[
resource
,
stat
]
=
tuple
;
const
[
resource
,
stat
]
=
tuple
;
const
fileStat
:
IFileStat
=
{
const
fileStat
:
IFileStat
=
{
resource
,
resource
,
...
@@ -72,7 +72,7 @@ function toIFileStat(provider: IFileSystemProvider, tuple: [URI, IStat], recurse
...
@@ -72,7 +72,7 @@ function toIFileStat(provider: IFileSystemProvider, tuple: [URI, IStat], recurse
return
TPromise
.
as
(
fileStat
);
return
TPromise
.
as
(
fileStat
);
}
}
export
function
toDeepIFileStat
(
provider
:
IFileSystemProvider
,
tuple
:
[
URI
,
IStat
],
to
:
URI
[]):
T
Promis
e
<
IFileStat
>
{
export
function
toDeepIFileStat
(
provider
:
IFileSystemProvider
,
tuple
:
[
URI
,
IStat
],
to
:
URI
[]):
T
henabl
e
<
IFileStat
>
{
const
trie
=
TernarySearchTree
.
forPaths
<
true
>
();
const
trie
=
TernarySearchTree
.
forPaths
<
true
>
();
trie
.
set
(
tuple
[
0
].
toString
(),
true
);
trie
.
set
(
tuple
[
0
].
toString
(),
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录