Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b360e056
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,发现更多精彩内容 >>
提交
b360e056
编写于
11月 28, 2016
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Return URIs from new get file functions
上级
7847c19b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
18 deletion
+18
-18
src/vs/test/utils/servicesTestUtils.ts
src/vs/test/utils/servicesTestUtils.ts
+2
-2
src/vs/workbench/services/backup/common/backup.ts
src/vs/workbench/services/backup/common/backup.ts
+2
-2
src/vs/workbench/services/backup/node/backupFileService.ts
src/vs/workbench/services/backup/node/backupFileService.ts
+9
-9
src/vs/workbench/services/backup/test/backupFileService.test.ts
.../workbench/services/backup/test/backupFileService.test.ts
+5
-5
未找到文件。
src/vs/test/utils/servicesTestUtils.ts
浏览文件 @
b360e056
...
...
@@ -677,11 +677,11 @@ export class TestBackupFileService implements IBackupFileService {
return
TPromise
.
as
(
void
0
);
}
public
getWorkspaceTextFileBackups
():
TPromise
<
string
[]
>
{
public
getWorkspaceTextFileBackups
():
TPromise
<
URI
[]
>
{
return
TPromise
.
as
([]);
}
public
getWorkspaceUntitledFileBackups
():
TPromise
<
string
[]
>
{
public
getWorkspaceUntitledFileBackups
():
TPromise
<
URI
[]
>
{
return
TPromise
.
as
([]);
}
...
...
src/vs/workbench/services/backup/common/backup.ts
浏览文件 @
b360e056
...
...
@@ -61,14 +61,14 @@ export interface IBackupFileService {
*
* @return The list of backups.
*/
getWorkspaceTextFileBackups
():
TPromise
<
string
[]
>
;
getWorkspaceTextFileBackups
():
TPromise
<
Uri
[]
>
;
/**
* Gets a list of untitled backups for the current workspace.
*
* @return The list of backups.
*/
getWorkspaceUntitledFileBackups
():
TPromise
<
string
[]
>
;
getWorkspaceUntitledFileBackups
():
TPromise
<
Uri
[]
>
;
/**
* Discards the backup associated with a resource if it exists..
...
...
src/vs/workbench/services/backup/node/backupFileService.ts
浏览文件 @
b360e056
...
...
@@ -22,7 +22,7 @@ export interface IBackupFilesModel {
has
(
resource
:
Uri
,
versionId
?:
number
):
boolean
;
remove
(
resource
:
Uri
):
void
;
clear
():
void
;
getFilesByScheme
(
scheme
:
string
):
string
[];
getFilesByScheme
(
scheme
:
string
):
Uri
[];
}
// TODO@daniel this should resolve the backups with their file names once we have the metadata in place
...
...
@@ -66,8 +66,8 @@ export class BackupFilesModel implements IBackupFilesModel {
return
true
;
}
public
getFilesByScheme
(
scheme
:
string
):
string
[]
{
return
Object
.
keys
(
this
.
cache
).
filter
(
k
=>
path
.
basename
(
path
.
dirname
(
k
))
===
scheme
).
map
(
k
=>
Uri
.
parse
(
k
)
.
fsPath
);
public
getFilesByScheme
(
scheme
:
string
):
Uri
[]
{
return
Object
.
keys
(
this
.
cache
).
filter
(
k
=>
path
.
basename
(
path
.
dirname
(
k
))
===
scheme
).
map
(
k
=>
Uri
.
parse
(
k
));
}
public
remove
(
resource
:
Uri
):
void
{
...
...
@@ -182,16 +182,16 @@ export class BackupFileService implements IBackupFileService {
});
}
public
getWorkspaceTextFileBackups
():
TPromise
<
string
[]
>
{
public
getWorkspaceTextFileBackups
():
TPromise
<
Uri
[]
>
{
return
this
.
ready
.
then
(
model
=>
{
let
readPromises
:
TPromise
<
string
>
[]
=
[];
let
readPromises
:
TPromise
<
Uri
>
[]
=
[];
model
.
getFilesByScheme
(
'
file
'
).
forEach
(
textFile
=>
{
readPromises
.
push
(
new
TPromise
<
string
>
((
c
,
e
)
=>
{
readToMatchingString
(
textFile
,
'
\n
'
,
2000
,
10000
,
(
error
,
result
)
=>
{
readPromises
.
push
(
new
TPromise
<
Uri
>
((
c
,
e
)
=>
{
readToMatchingString
(
textFile
.
fsPath
,
'
\n
'
,
2000
,
10000
,
(
error
,
result
)
=>
{
if
(
result
===
null
)
{
e
(
error
);
}
c
(
result
);
c
(
Uri
.
parse
(
result
)
);
});
}));
});
...
...
@@ -199,7 +199,7 @@ export class BackupFileService implements IBackupFileService {
});
}
public
getWorkspaceUntitledFileBackups
():
TPromise
<
string
[]
>
{
public
getWorkspaceUntitledFileBackups
():
TPromise
<
Uri
[]
>
{
return
this
.
ready
.
then
(
model
=>
{
return
model
.
getFilesByScheme
(
'
untitled
'
);
});
...
...
src/vs/workbench/services/backup/test/backupFileService.test.ts
浏览文件 @
b360e056
...
...
@@ -173,10 +173,10 @@ suite('BackupFileService', () => {
test
(
'
getWorkspaceTextFileBackups - text file
'
,
done
=>
{
service
.
backupResource
(
fooFile
,
`test`
).
then
(()
=>
{
service
.
getWorkspaceTextFileBackups
().
then
(
textFiles
=>
{
assert
.
deepEqual
(
textFiles
,
[
fooFile
.
fsPath
]);
assert
.
deepEqual
(
textFiles
.
map
(
f
=>
f
.
fsPath
)
,
[
fooFile
.
fsPath
]);
service
.
backupResource
(
barFile
,
`test`
).
then
(()
=>
{
service
.
getWorkspaceTextFileBackups
().
then
(
textFiles
=>
{
assert
.
deepEqual
(
textFiles
,
[
fooFile
.
fsPath
,
barFile
.
fsPath
]);
assert
.
deepEqual
(
textFiles
.
map
(
f
=>
f
.
fsPath
)
,
[
fooFile
.
fsPath
,
barFile
.
fsPath
]);
done
();
});
});
...
...
@@ -207,7 +207,7 @@ suite('BackupFileService', () => {
test
(
'
getWorkspaceUntitledFileBackups - untitled file
'
,
done
=>
{
service
.
backupResource
(
untitledFile
,
`test`
).
then
(()
=>
{
service
.
getWorkspaceUntitledFileBackups
().
then
(
textFiles
=>
{
assert
.
deepEqual
(
textFiles
,
[
untitledBackupPath
]);
assert
.
deepEqual
(
textFiles
.
map
(
f
=>
f
.
fsPath
)
,
[
untitledBackupPath
]);
done
();
});
});
...
...
@@ -284,7 +284,7 @@ suite('BackupFileService', () => {
model
.
add
(
Uri
.
file
(
'
/root/file/bar.html
'
));
model
.
add
(
Uri
.
file
(
'
/root/untitled/bar.html
'
));
assert
.
deepEqual
(
model
.
getFilesByScheme
(
'
file
'
),
[
'
/root/file/foo.html
'
,
'
/root/file/bar.html
'
]);
assert
.
deepEqual
(
model
.
getFilesByScheme
(
'
untitled
'
),
[
'
/root/untitled/bar.html
'
]);
assert
.
deepEqual
(
model
.
getFilesByScheme
(
'
file
'
)
.
map
(
f
=>
f
.
fsPath
)
,
[
'
/root/file/foo.html
'
,
'
/root/file/bar.html
'
]);
assert
.
deepEqual
(
model
.
getFilesByScheme
(
'
untitled
'
)
.
map
(
f
=>
f
.
fsPath
)
,
[
'
/root/untitled/bar.html
'
]);
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录