Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
85bf25fd
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
85bf25fd
编写于
12月 01, 2016
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove workspace and IWindowService dep on BackupFileService
上级
3903920e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
22 deletion
+26
-22
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+1
-1
src/vs/workbench/services/backup/node/backupFileService.ts
src/vs/workbench/services/backup/node/backupFileService.ts
+6
-8
src/vs/workbench/services/backup/test/backupFileService.test.ts
.../workbench/services/backup/test/backupFileService.test.ts
+19
-13
未找到文件。
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
85bf25fd
...
...
@@ -458,7 +458,7 @@ export class Workbench implements IPartService {
// Backup File Service
const
workspace
=
this
.
contextService
.
getWorkspace
();
serviceCollection
.
set
(
IBackupFileService
,
this
.
instantiationService
.
createInstance
(
BackupFileService
,
workspace
?
workspace
.
resource
:
null
));
serviceCollection
.
set
(
IBackupFileService
,
this
.
instantiationService
.
createInstance
(
BackupFileService
,
this
.
windowService
.
getCurrentWindowId
()
));
// Backup Service
serviceCollection
.
set
(
IBackupModelService
,
this
.
instantiationService
.
createInstance
(
BackupModelService
));
...
...
src/vs/workbench/services/backup/node/backupFileService.ts
浏览文件 @
85bf25fd
...
...
@@ -14,7 +14,6 @@ import { IBackupFileService, BACKUP_FILE_UPDATE_OPTIONS } from 'vs/workbench/ser
import
{
IBackupService
}
from
'
vs/platform/backup/common/backup
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
readToMatchingString
}
from
'
vs/base/node/stream
'
;
import
{
IRawTextContent
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
...
...
@@ -92,13 +91,12 @@ export class BackupFileService implements IBackupFileService {
private
ready
:
TPromise
<
IBackupFilesModel
>
;
constructor
(
private
currentWorkspace
:
Uri
,
windowId
:
number
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IFileService
private
fileService
:
IFileService
,
@
IBackupService
private
backupService
:
IBackupService
,
@
IWindowService
private
windowService
:
IWindowService
@
IBackupService
private
backupService
:
IBackupService
)
{
this
.
ready
=
this
.
init
();
this
.
ready
=
this
.
init
(
windowId
);
}
private
get
backupEnabled
():
boolean
{
...
...
@@ -106,15 +104,15 @@ export class BackupFileService implements IBackupFileService {
return
!
this
.
environmentService
.
isExtensionDevelopment
;
}
private
init
():
TPromise
<
IBackupFilesModel
>
{
private
init
(
windowId
:
number
):
TPromise
<
IBackupFilesModel
>
{
const
model
=
new
BackupFilesModel
();
if
(
!
this
.
backupEnabled
)
{
return
TPromise
.
as
(
model
);
}
console
.
log
(
'
requesting backup workspace for window
'
+
this
.
windowService
.
getCurrentWindowId
()
);
return
this
.
backupService
.
getBackupPath
(
this
.
windowService
.
getCurrentWindowId
()
).
then
(
backupPath
=>
{
console
.
log
(
'
requesting backup workspace for window
'
+
windowId
);
return
this
.
backupService
.
getBackupPath
(
windowId
).
then
(
backupPath
=>
{
console
.
log
(
'
backup workspace from main:
'
+
backupPath
);
this
.
backupWorkspacePath
=
backupPath
;
return
model
.
resolve
(
this
.
backupWorkspacePath
);
...
...
src/vs/workbench/services/backup/test/backupFileService.test.ts
浏览文件 @
85bf25fd
...
...
@@ -17,9 +17,11 @@ import Uri from 'vs/base/common/uri';
import
{
BackupFileService
,
BackupFilesModel
}
from
'
vs/workbench/services/backup/node/backupFileService
'
;
import
{
FileService
}
from
'
vs/workbench/services/files/node/fileService
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
IBackupService
}
from
'
vs/platform/backup/common/backup
'
;
import
{
parseArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
{
TextModel
}
from
'
vs/editor/common/model/textModel
'
;
import
{
IRawTextContent
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
class
TestEnvironmentService
extends
EnvironmentService
{
...
...
@@ -32,19 +34,6 @@ class TestEnvironmentService extends EnvironmentService {
get
backupWorkspacesPath
():
string
{
return
this
.
_backupWorkspacesPath
;
}
}
class
TestBackupFileService
extends
BackupFileService
{
constructor
(
workspace
:
Uri
,
backupHome
:
string
,
workspacesJsonPath
:
string
)
{
const
fileService
=
new
FileService
(
workspace
.
fsPath
,
{
disableWatcher
:
true
},
null
);
const
testEnvironmentService
=
new
TestEnvironmentService
(
backupHome
,
workspacesJsonPath
);
super
(
workspace
,
testEnvironmentService
,
fileService
);
}
public
getBackupResource
(
resource
:
Uri
):
Uri
{
return
super
.
getBackupResource
(
resource
);
}
}
const
parentDir
=
path
.
join
(
os
.
tmpdir
(),
'
vsctests
'
,
'
service
'
);
const
backupHome
=
path
.
join
(
parentDir
,
'
Backups
'
);
const
workspacesJsonPath
=
path
.
join
(
backupHome
,
'
workspaces.json
'
);
...
...
@@ -58,6 +47,23 @@ const fooBackupPath = path.join(workspaceBackupPath, 'file', crypto.createHash('
const
barBackupPath
=
path
.
join
(
workspaceBackupPath
,
'
file
'
,
crypto
.
createHash
(
'
md5
'
).
update
(
barFile
.
fsPath
).
digest
(
'
hex
'
));
const
untitledBackupPath
=
path
.
join
(
workspaceBackupPath
,
'
untitled
'
,
crypto
.
createHash
(
'
md5
'
).
update
(
untitledFile
.
fsPath
.
toLowerCase
()).
digest
(
'
hex
'
));
class
TestBackupFileService
extends
BackupFileService
{
constructor
(
workspace
:
Uri
,
backupHome
:
string
,
workspacesJsonPath
:
string
)
{
const
fileService
=
new
FileService
(
workspace
.
fsPath
,
{
disableWatcher
:
true
},
null
);
const
environmentService
=
new
TestEnvironmentService
(
backupHome
,
workspacesJsonPath
);
const
backupService
:
IBackupService
=
{
_serviceBrand
:
null
,
getBackupPath
:
()
=>
TPromise
.
as
(
workspaceBackupPath
)
};
super
(
1
,
environmentService
,
fileService
,
backupService
);
}
public
getBackupResource
(
resource
:
Uri
):
Uri
{
return
super
.
getBackupResource
(
resource
);
}
}
suite
(
'
BackupFileService
'
,
()
=>
{
let
service
:
TestBackupFileService
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录