Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c7837ea7
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,发现更多精彩内容 >>
提交
c7837ea7
编写于
9月 11, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove legacy workspace migration code
上级
e191f750
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
10 addition
and
72 deletion
+10
-72
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+0
-6
src/vs/platform/backup/electron-main/backupMainService.ts
src/vs/platform/backup/electron-main/backupMainService.ts
+0
-16
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+0
-14
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+10
-36
未找到文件。
src/vs/code/electron-main/windows.ts
浏览文件 @
c7837ea7
...
...
@@ -176,11 +176,6 @@ export class WindowsManager implements IWindowsMainService {
state
.
folderPath
=
state
.
workspacePath
;
state
.
workspacePath
=
void
0
;
}
// TODO@Ben migration to new workspace ID
if
(
state
.
workspace
)
{
state
.
workspace
.
id
=
this
.
workspacesService
.
getWorkspaceId
(
state
.
workspace
.
configPath
);
}
});
}
...
...
@@ -277,7 +272,6 @@ export class WindowsManager implements IWindowsMainService {
private
onBeforeQuit
():
void
{
const
currentWindowsState
:
ILegacyWindowsState
=
{
openedWindows
:
[],
openedFolders
:
[],
// TODO@Ben migration so that old clients do not fail over data (prevents NPEs)
lastPluginDevelopmentHostWindow
:
this
.
windowsState
.
lastPluginDevelopmentHostWindow
,
lastActiveWindow
:
this
.
lastClosedWindowState
};
...
...
src/vs/platform/backup/electron-main/backupMainService.ts
浏览文件 @
c7837ea7
...
...
@@ -225,22 +225,6 @@ export class BackupMainService implements IBackupMainService {
const
hasBackups
=
this
.
hasBackupsSync
(
backupPath
);
const
missingWorkspace
=
hasBackups
&&
!
fs
.
existsSync
(
workspacePath
);
// TODO@Ben migration from old workspace ID to new
if
(
hasBackups
&&
!
missingWorkspace
&&
!
isSingleFolderWorkspaceIdentifier
(
workspaceId
)
&&
workspaceId
.
id
!==
this
.
workspacesService
.
getWorkspaceId
(
workspacePath
))
{
staleBackupWorkspaces
.
push
({
workspaceIdentifier
:
workspaceId
,
backupPath
,
target
:
workspaceOrFolder
.
target
});
const
identifier
=
{
id
:
this
.
workspacesService
.
getWorkspaceId
(
workspacePath
),
configPath
:
workspacePath
}
as
IWorkspaceIdentifier
;
this
.
pushBackupPathsSync
(
identifier
,
this
.
backups
.
rootWorkspaces
);
const
newWorkspaceBackupPath
=
path
.
join
(
this
.
backupHome
,
identifier
.
id
);
try
{
fs
.
renameSync
(
backupPath
,
newWorkspaceBackupPath
);
}
catch
(
ex
)
{
this
.
logService
.
error
(
`Backup: Could not rename backup folder for legacy workspace:
${
ex
.
toString
()}
`
);
this
.
removeBackupPathSync
(
identifier
,
this
.
backups
.
rootWorkspaces
);
}
}
// If the workspace/folder has no backups, make sure to delete it
// If the workspace/folder has backups, but the target workspace is missing, convert backups to empty ones
if
(
!
hasBackups
||
missingWorkspace
)
{
...
...
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
c7837ea7
...
...
@@ -19,15 +19,8 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
isEqual
,
isEqualOrParent
}
from
'
vs/base/common/paths
'
;
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
createHash
}
from
'
crypto
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
*
as
json
from
'
vs/base/common/json
'
;
// TODO@Ben migration
export
interface
ILegacyStoredWorkspace
{
id
:
string
;
folders
:
string
[];
}
export
class
WorkspacesMainService
implements
IWorkspacesMainService
{
public
_serviceBrand
:
any
;
...
...
@@ -108,13 +101,6 @@ export class WorkspacesMainService implements IWorkspacesMainService {
throw
new
Error
(
`
${
path
}
cannot be parsed as JSON file (
${
error
}
).`
);
}
// TODO@Ben migration
const
legacyStoredWorkspace
=
(
<
any
>
storedWorkspace
)
as
ILegacyStoredWorkspace
;
if
(
legacyStoredWorkspace
.
folders
.
some
(
folder
=>
typeof
folder
===
'
string
'
))
{
storedWorkspace
.
folders
=
legacyStoredWorkspace
.
folders
.
map
(
folder
=>
({
path
:
URI
.
parse
(
folder
).
fsPath
}));
writeFileSync
(
path
,
JSON
.
stringify
(
storedWorkspace
,
null
,
'
\t
'
));
}
// Filter out folders which do not have a path set
if
(
Array
.
isArray
(
storedWorkspace
.
folders
))
{
storedWorkspace
.
folders
=
storedWorkspace
.
folders
.
filter
(
folder
=>
!!
folder
.
path
);
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
c7837ea7
...
...
@@ -20,7 +20,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
EmptyWorkspaceServiceImpl
,
WorkspaceServiceImpl
,
WorkspaceService
}
from
'
vs/workbench/services/configuration/node/configuration
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
realpath
,
readFile
,
writeFile
}
from
'
vs/base/node/pfs
'
;
import
{
realpath
}
from
'
vs/base/node/pfs
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
path
=
require
(
'
path
'
);
import
gracefulFs
=
require
(
'
graceful-fs
'
);
...
...
@@ -42,7 +42,6 @@ import { WorkspacesChannelClient } from 'vs/platform/workspaces/common/workspace
import
{
IWorkspacesService
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
ICredentialsService
}
from
'
vs/platform/credentials/common/credentials
'
;
import
{
CredentialsChannelClient
}
from
'
vs/platform/credentials/node/credentialsIpc
'
;
import
{
migrateStorageToMultiRootWorkspace
}
from
'
vs/platform/storage/common/migration
'
;
import
fs
=
require
(
'
fs
'
);
gracefulFs
.
gracefulify
(
fs
);
// enable gracefulFs
...
...
@@ -112,7 +111,6 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
}
function
createAndInitializeWorkspaceService
(
configuration
:
IWindowConfiguration
,
environmentService
:
EnvironmentService
,
workspacesService
:
IWorkspacesService
):
TPromise
<
WorkspaceService
>
{
return
migrateWorkspaceId
(
configuration
).
then
(()
=>
{
return
validateWorkspacePath
(
configuration
).
then
(()
=>
{
let
workspaceService
:
WorkspaceServiceImpl
|
EmptyWorkspaceServiceImpl
;
if
(
configuration
.
workspace
||
configuration
.
folderPath
)
{
...
...
@@ -123,30 +121,6 @@ function createAndInitializeWorkspaceService(configuration: IWindowConfiguration
return
workspaceService
.
initialize
().
then
(()
=>
workspaceService
,
error
=>
new
EmptyWorkspaceServiceImpl
(
environmentService
));
});
});
}
// TODO@Ben migration
function
migrateWorkspaceId
(
configuration
:
IWindowConfiguration
):
TPromise
<
void
>
{
if
(
!
configuration
.
workspace
||
!
configuration
.
workspace
.
configPath
)
{
return
TPromise
.
as
(
null
);
}
return
readFile
(
configuration
.
workspace
.
configPath
).
then
(
data
=>
{
try
{
const
raw
=
JSON
.
parse
(
data
.
toString
());
if
(
raw
.
id
)
{
const
previousWorkspaceId
=
raw
.
id
;
delete
raw
.
id
;
migrateStorageToMultiRootWorkspace
(
uri
.
from
({
path
:
previousWorkspaceId
,
scheme
:
'
root
'
}).
toString
(),
configuration
.
workspace
,
window
.
localStorage
);
return
writeFile
(
configuration
.
workspace
.
configPath
,
JSON
.
stringify
(
raw
,
null
,
'
\t
'
));
}
}
catch
(
error
)
{
};
return
void
0
;
}).
then
(()
=>
void
0
,
()
=>
void
0
);
}
function
validateWorkspacePath
(
configuration
:
IWindowConfiguration
):
TPromise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录