Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1b33eb37
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,发现更多精彩内容 >>
提交
1b33eb37
编写于
4月 11, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make readDirectory return string/stat-tuples, #47475
上级
1d143981
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
20 deletion
+25
-20
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+1
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+4
-4
src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts
...vs/workbench/api/electron-browser/mainThreadFileSystem.ts
+2
-4
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostFileSystem.ts
src/vs/workbench/api/node/extHostFileSystem.ts
+12
-9
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
...ench/services/files/electron-browser/remoteFileService.ts
+5
-1
未找到文件。
src/vs/platform/files/common/files.ts
浏览文件 @
1b33eb37
...
...
@@ -174,7 +174,7 @@ export interface IFileSystemProvider {
writeFile
(
resource
:
URI
,
content
:
Uint8Array
):
TPromise
<
void
>
;
move
(
from
:
URI
,
to
:
URI
):
TPromise
<
IStat
>
;
mkdir
(
resource
:
URI
):
TPromise
<
IStat
>
;
readdir
(
resource
:
URI
):
TPromise
<
[
URI
,
IStat
][]
>
;
readdir
(
resource
:
URI
):
TPromise
<
[
string
,
IStat
][]
>
;
delete
(
resource
:
URI
):
TPromise
<
void
>
;
}
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
1b33eb37
...
...
@@ -251,7 +251,7 @@ declare module 'vscode' {
// todo@joh add open/close calls?
export
interface
FileSystemProvider2
{
_version
:
3
;
_version
:
4
;
/**
* An event to signal that a resource has been created, changed, or deleted.
...
...
@@ -273,9 +273,9 @@ declare module 'vscode' {
*
* @param uri The uri of the folder.
* @param token A cancellation token.
* @return A thenable that resolves to an array of tuples of
resourc
es and files stats.
* @return A thenable that resolves to an array of tuples of
file nam
es and files stats.
*/
readDirectory
(
uri
:
Uri
,
token
:
CancellationToken
):
Thenable
<
[
Uri
,
FileStat2
][]
>
;
readDirectory
(
uri
:
Uri
,
token
:
CancellationToken
):
Thenable
<
[
string
,
FileStat2
][]
>
;
/**
* Read the entire contents of a file.
...
...
@@ -313,7 +313,7 @@ declare module 'vscode' {
delete
(
uri
:
Uri
,
token
:
CancellationToken
):
Thenable
<
void
>
;
// todo@remote
create
(
uri
:
Uri
,
options
:
{
type
:
FileType
},
token
:
CancellationToken
):
Thenable
<
FileStat2
>
;
create
(
uri
:
Uri
,
options
:
{
type
:
FileType
2
},
token
:
CancellationToken
):
Thenable
<
FileStat2
>
;
}
export
namespace
workspace
{
...
...
src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts
浏览文件 @
1b33eb37
...
...
@@ -116,10 +116,8 @@ class RemoteFileSystemProvider implements IFileSystemProvider {
mkdir
(
resource
:
URI
):
TPromise
<
IStat
,
any
>
{
return
this
.
_proxy
.
$mkdir
(
this
.
_handle
,
resource
);
}
readdir
(
resource
:
URI
):
TPromise
<
[
URI
,
IStat
][],
any
>
{
return
this
.
_proxy
.
$readdir
(
this
.
_handle
,
resource
).
then
(
data
=>
{
return
data
.
map
(
tuple
=>
<
[
URI
,
IStat
]
>
[
URI
.
revive
(
tuple
[
0
]),
tuple
[
1
]]);
});
readdir
(
resource
:
URI
):
TPromise
<
[
string
,
IStat
][],
any
>
{
return
this
.
_proxy
.
$readdir
(
this
.
_handle
,
resource
);
}
}
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
1b33eb37
...
...
@@ -572,7 +572,7 @@ export interface ExtHostFileSystemShape {
$move
(
handle
:
number
,
resource
:
UriComponents
,
target
:
UriComponents
):
TPromise
<
IStat
>
;
$mkdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
IStat
>
;
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
[
UriComponents
,
IStat
][]
>
;
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
[
string
,
IStat
][]
>
;
$delete
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
void
>
;
...
...
src/vs/workbench/api/node/extHostFileSystem.ts
浏览文件 @
1b33eb37
...
...
@@ -10,6 +10,7 @@ import { Event, mapEvent } from 'vs/base/common/event';
import
{
MainContext
,
IMainContext
,
ExtHostFileSystemShape
,
MainThreadFileSystemShape
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
files
from
'
vs/platform/files/common/files
'
;
import
*
as
path
from
'
path
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
IPatternInfo
}
from
'
vs/platform/search/common/search
'
;
...
...
@@ -59,7 +60,7 @@ class FsLinkProvider implements vscode.DocumentLinkProvider {
class
FileSystemProviderShim
implements
vscode
.
FileSystemProvider2
{
_version
:
3
;
_version
:
4
;
onDidChange
:
vscode
.
Event
<
vscode
.
FileChange2
[]
>
;
...
...
@@ -77,9 +78,9 @@ class FileSystemProviderShim implements vscode.FileSystemProvider2 {
rename
(
oldUri
:
vscode
.
Uri
,
newUri
:
vscode
.
Uri
):
Thenable
<
vscode
.
FileStat2
>
{
return
this
.
_delegate
.
move
(
oldUri
,
newUri
).
then
(
stat
=>
FileSystemProviderShim
.
_modernizeFileStat
(
stat
));
}
readDirectory
(
resource
:
vscode
.
Uri
):
Thenable
<
[
vscode
.
Uri
,
vscode
.
FileStat2
][]
>
{
readDirectory
(
resource
:
vscode
.
Uri
):
Thenable
<
[
string
,
vscode
.
FileStat2
][]
>
{
return
this
.
_delegate
.
readdir
(
resource
).
then
(
tuples
=>
{
return
tuples
.
map
(
tuple
=>
<
[
vscode
.
Uri
,
vscode
.
FileStat2
]
>
[
tuple
[
0
]
,
FileSystemProviderShim
.
_modernizeFileStat
(
tuple
[
1
])]);
return
tuples
.
map
(
tuple
=>
<
[
string
,
vscode
.
FileStat2
]
>
[
path
.
posix
.
basename
(
tuple
[
0
].
path
)
,
FileSystemProviderShim
.
_modernizeFileStat
(
tuple
[
1
])]);
});
}
...
...
@@ -131,8 +132,8 @@ class FileSystemProviderShim implements vscode.FileSystemProvider2 {
}
});
}
create
(
resource
:
vscode
.
Uri
,
options
:
{
type
:
vscode
.
FileType
;
}):
Thenable
<
vscode
.
FileStat2
>
{
if
(
options
.
type
===
FileType
.
Dir
)
{
create
(
resource
:
vscode
.
Uri
,
options
:
{
type
:
vscode
.
FileType
2
;
}):
Thenable
<
vscode
.
FileStat2
>
{
if
(
options
.
type
===
FileType
2
.
Directory
)
{
return
this
.
_delegate
.
mkdir
(
resource
).
then
(
stat
=>
FileSystemProviderShim
.
_modernizeFileStat
(
stat
));
}
else
{
return
this
.
_delegate
.
write
(
resource
,
Buffer
.
from
([]))
...
...
@@ -173,10 +174,12 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
registerFileSystemProvider
(
scheme
:
string
,
provider
:
vscode
.
FileSystemProvider
,
newProvider
:
vscode
.
FileSystemProvider2
)
{
if
(
newProvider
&&
newProvider
.
_version
===
3
)
{
if
(
newProvider
&&
newProvider
.
_version
===
4
)
{
return
this
.
_doRegisterFileSystemProvider
(
scheme
,
newProvider
);
}
else
{
}
else
if
(
provider
)
{
return
this
.
_doRegisterFileSystemProvider
(
scheme
,
new
FileSystemProviderShim
(
provider
));
}
else
{
throw
new
Error
(
'
IGNORED both provider
'
);
}
}
...
...
@@ -234,7 +237,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
$stat
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
files
.
IStat
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
stat
(
URI
.
revive
(
resource
),
token
));
}
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
[
UriComponents
,
files
.
IStat
][],
any
>
{
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
[
string
,
files
.
IStat
][],
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
readDirectory
(
URI
.
revive
(
resource
),
token
));
}
$readFile
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
string
>
{
...
...
@@ -254,7 +257,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
rename
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
token
));
}
$mkdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
files
.
IStat
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
create
(
URI
.
revive
(
resource
),
{
type
:
FileType
.
Dir
},
token
));
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
create
(
URI
.
revive
(
resource
),
{
type
:
FileType
2
.
Directory
},
token
));
}
$provideFileSearchResults
(
handle
:
number
,
session
:
number
,
query
:
string
):
TPromise
<
void
>
{
...
...
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
1b33eb37
...
...
@@ -42,7 +42,11 @@ function toIFileStat(provider: IFileSystemProvider, tuple: [URI, IStat], recurse
// dir -> resolve
return
provider
.
readdir
(
resource
).
then
(
entries
=>
{
// resolve children if requested
return
TPromise
.
join
(
entries
.
map
(
stat
=>
toIFileStat
(
provider
,
stat
,
recurse
))).
then
(
children
=>
{
return
TPromise
.
join
(
entries
.
map
(
tuple
=>
{
const
[
name
,
stat
]
=
tuple
;
const
childResource
=
resource
.
with
({
path
:
posix
.
join
(
resource
.
path
,
name
)
});
return
toIFileStat
(
provider
,
[
childResource
,
stat
],
recurse
);
})).
then
(
children
=>
{
fileStat
.
children
=
children
;
return
fileStat
;
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录