Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7b8dbf65
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,体验更适合开发者的 AI 搜索 >>
提交
7b8dbf65
编写于
7月 18, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add a method to fully resolve a workspace on the main side
上级
84fd73be
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
17 deletion
+14
-17
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+2
-2
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+2
-2
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+7
-9
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
...rkspaces/test/electron-main/workspacesMainService.test.ts
+3
-4
未找到文件。
src/vs/code/electron-main/windows.ts
浏览文件 @
7b8dbf65
...
...
@@ -273,7 +273,7 @@ export class WindowsManager implements IWindowsMainService {
// Don't Save: delete workspace
case
ConfirmResult
.
DONT_SAVE
:
this
.
workspacesService
.
deleteUntitledWorkspace
(
workspace
);
this
.
workspacesService
.
deleteUntitledWorkspace
Sync
(
workspace
);
e
.
veto
(
false
);
break
;
...
...
@@ -915,7 +915,7 @@ export class WindowsManager implements IWindowsMainService {
// Workspace
const
workspace
=
this
.
workspacesService
.
resolveWorkspaceSync
(
candidate
);
if
(
workspace
)
{
return
{
workspace
};
return
{
workspace
:
{
id
:
workspace
.
id
,
configPath
:
candidate
}
};
}
// File
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
7b8dbf65
...
...
@@ -47,10 +47,10 @@ export interface IWorkspacesMainService extends IWorkspacesService {
onWorkspaceSaved
:
Event
<
IWorkspaceSavedEvent
>
;
onWorkspaceDeleted
:
Event
<
IWorkspaceIdentifier
>
;
resolveWorkspaceSync
(
path
:
string
):
I
WorkspaceIdentifier
;
resolveWorkspaceSync
(
path
:
string
):
I
StoredWorkspace
;
isUntitledWorkspace
(
workspace
:
IWorkspaceIdentifier
):
boolean
;
deleteUntitledWorkspace
(
workspace
:
IWorkspaceIdentifier
):
void
;
deleteUntitledWorkspace
Sync
(
workspace
:
IWorkspaceIdentifier
):
void
;
}
export
interface
IWorkspacesService
{
...
...
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
7b8dbf65
...
...
@@ -46,7 +46,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
return
this
.
_onWorkspaceDeleted
.
event
;
}
public
resolveWorkspaceSync
(
path
:
string
):
I
WorkspaceIdentifier
{
public
resolveWorkspaceSync
(
path
:
string
):
I
StoredWorkspace
{
const
isWorkspace
=
this
.
isInsideWorkspacesHome
(
path
)
||
extname
(
path
)
===
`.
${
WORKSPACE_EXTENSION
}
`
;
if
(
!
isWorkspace
)
{
return
null
;
// does not look like a valid workspace config file
...
...
@@ -60,10 +60,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
return
null
;
// looks like an invalid workspace file
}
return
{
id
:
workspace
.
id
,
configPath
:
path
};
return
workspace
;
}
catch
(
error
)
{
this
.
logService
.
log
(
`
${
path
}
cannot be parsed as JSON file (
${
error
}
).`
);
...
...
@@ -115,18 +112,19 @@ export class WorkspacesMainService implements IWorkspacesMainService {
// Copy to new target
return
nfcall
(
copy
,
workspace
.
configPath
,
target
).
then
(()
=>
{
const
savedWorkspace
=
this
.
resolveWorkspaceSync
(
target
);
const
savedWorkspaceIdentifier
=
{
id
:
savedWorkspace
.
id
,
configPath
:
target
};
// Event
this
.
_onWorkspaceSaved
.
fire
({
workspace
:
savedWorkspace
,
oldConfigPath
:
workspace
.
configPath
});
this
.
_onWorkspaceSaved
.
fire
({
workspace
:
savedWorkspace
Identifier
,
oldConfigPath
:
workspace
.
configPath
});
// Delete untitled workspace
this
.
deleteUntitledWorkspace
(
workspace
);
this
.
deleteUntitledWorkspace
Sync
(
workspace
);
return
savedWorkspace
;
return
savedWorkspace
Identifier
;
});
}
public
deleteUntitledWorkspace
(
workspace
:
IWorkspaceIdentifier
):
void
{
public
deleteUntitledWorkspace
Sync
(
workspace
:
IWorkspaceIdentifier
):
void
{
if
(
!
this
.
isUntitledWorkspace
(
workspace
))
{
return
;
// only supported for untitled workspaces
}
...
...
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
浏览文件 @
7b8dbf65
...
...
@@ -30,10 +30,10 @@ suite('WorkspacesMainService', () => {
class
TestWorkspacesMainService
extends
WorkspacesMainService
{
public
deleteWorkspaceCall
:
IWorkspaceIdentifier
;
public
deleteUntitledWorkspace
(
workspace
:
IWorkspaceIdentifier
):
void
{
public
deleteUntitledWorkspace
Sync
(
workspace
:
IWorkspaceIdentifier
):
void
{
this
.
deleteWorkspaceCall
=
workspace
;
super
.
deleteUntitledWorkspace
(
workspace
);
super
.
deleteUntitledWorkspace
Sync
(
workspace
);
}
}
...
...
@@ -83,7 +83,6 @@ suite('WorkspacesMainService', () => {
test
(
'
resolveWorkspace
'
,
done
=>
{
return
service
.
createWorkspace
([
process
.
cwd
(),
os
.
tmpdir
()]).
then
(
workspace
=>
{
assert
.
ok
(
service
.
resolveWorkspaceSync
(
workspace
.
configPath
));
// make it a valid workspace path
...
...
@@ -92,7 +91,7 @@ suite('WorkspacesMainService', () => {
workspace
.
configPath
=
newPath
;
const
resolved
=
service
.
resolveWorkspaceSync
(
workspace
.
configPath
);
assert
.
deepEqual
(
resolved
,
{
id
:
workspace
.
id
,
configPath
:
workspace
.
configPath
});
assert
.
deepEqual
(
resolved
,
{
id
:
workspace
.
id
,
folders
:
[
process
.
cwd
(),
os
.
tmpdir
()]
});
done
();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录