Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
6075d650
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
6075d650
编写于
9月 18, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
config: trigger events from workspace initialize (for #32945)
上级
512d47f7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
32 deletion
+53
-32
src/vs/platform/workspace/common/workspace.ts
src/vs/platform/workspace/common/workspace.ts
+24
-4
src/vs/workbench/services/configuration/node/configuration.ts
...vs/workbench/services/configuration/node/configuration.ts
+29
-28
未找到文件。
src/vs/platform/workspace/common/workspace.ts
浏览文件 @
6075d650
...
...
@@ -127,15 +127,27 @@ export class Workspace implements IWorkspace {
private
_foldersMap
:
TrieMap
<
WorkspaceFolder
>
=
new
TrieMap
<
WorkspaceFolder
>
();
private
_folders
:
WorkspaceFolder
[];
private
_id
:
string
;
private
_name
:
string
;
private
_configuration
:
URI
;
private
_ctime
:
number
;
constructor
(
public
readonly
id
:
string
,
private
_
name
:
string
,
id
:
string
,
name
:
string
,
folders
:
WorkspaceFolder
[],
private
_
configuration
:
URI
=
null
,
public
readonly
ctime
?:
number
configuration
:
URI
=
null
,
ctime
?:
number
)
{
this
.
update
(
id
,
name
,
folders
,
configuration
,
ctime
);
}
public
update
(
id
:
string
,
name
:
string
,
folders
:
WorkspaceFolder
[],
configuration
:
URI
=
null
,
ctime
?:
number
)
{
this
.
_id
=
id
;
this
.
_name
=
name
;
this
.
folders
=
folders
;
this
.
_configuration
=
configuration
;
this
.
_ctime
=
ctime
;
}
public
get
folders
():
WorkspaceFolder
[]
{
...
...
@@ -147,6 +159,14 @@ export class Workspace implements IWorkspace {
this
.
updateFoldersMap
();
}
public
get
id
():
string
{
return
this
.
_id
;
}
public
get
ctime
():
number
{
return
this
.
_ctime
;
}
public
get
name
():
string
{
return
this
.
_name
;
}
...
...
src/vs/workbench/services/configuration/node/configuration.ts
浏览文件 @
6075d650
...
...
@@ -333,7 +333,31 @@ export class WorkspaceServiceImpl extends WorkspaceService {
}
public
initialize
(
arg
:
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
|
IWindowConfiguration
):
TPromise
<
any
>
{
return
this
.
initializeWorkspace
(
arg
).
then
(()
=>
this
.
initializeConfiguration
(
true
));
const
handleStateChange
=
!!
this
.
workspace
;
if
(
!
this
.
workspace
)
{
this
.
workspace
=
new
Workspace
(
''
,
''
,
[]);
}
const
currentState
=
this
.
getWorkbenchState
();
const
currentFolders
=
this
.
workspace
.
folders
;
return
this
.
initializeWorkspace
(
arg
).
then
(()
=>
this
.
initializeConfiguration
(
true
)).
then
(()
=>
{
if
(
!
handleStateChange
)
{
return
;
}
const
newState
=
this
.
getWorkbenchState
();
if
(
newState
!==
currentState
)
{
this
.
_onDidChangeWorkbenchState
.
fire
(
newState
);
this
.
_onDidChangeWorkspaceName
.
fire
();
}
const
foldersChanged
=
!
equals
(
this
.
workspace
.
folders
,
currentFolders
,
(
folder1
,
folder2
)
=>
folder1
.
uri
.
fsPath
===
folder2
.
uri
.
fsPath
);
if
(
foldersChanged
)
{
this
.
_onDidChangeWorkspaceFolders
.
fire
();
}
});
}
public
reloadConfiguration
(
section
?:
string
):
TPromise
<
any
>
{
...
...
@@ -394,30 +418,6 @@ export class WorkspaceServiceImpl extends WorkspaceService {
return
this
.
initializeEmptyWorkspace
(
arg
);
}
// TODO@Sandeep use again once we can change workspace without window reload
// private onWorkspaceChange(configPath: URI): TPromise<void> {
// let workspaceName = this.workspace.name;
// this.workspaceConfigPath = configPath;
// // Reset the workspace if current workspace is single folder
// if (this.hasFolderWorkspace()) {
// this.folderPath = null;
// this.workspace = null;
// }
// // Update workspace configuration path with new path
// else {
// this.workspace.configuration = configPath;
// this.workspace.name = getWorkspaceLabel({ id: this.workspace.id, configPath: this.workspace.configuration.fsPath }, this.environmentService);
// }
// return this.initialize().then(() => {
// if (workspaceName !== this.workspace.name) {
// this._onDidChangeWorkspaceName.fire();
// }
// });
// }
private
initializeMulitFolderWorkspace
(
workspaceIdentifier
:
IWorkspaceIdentifier
):
TPromise
<
void
>
{
this
.
registerWorkspaceConfigSchema
();
const
workspaceConfigPath
=
URI
.
file
(
workspaceIdentifier
.
configPath
);
...
...
@@ -430,7 +430,8 @@ export class WorkspaceServiceImpl extends WorkspaceService {
}
const
workspaceId
=
workspaceIdentifier
.
id
;
const
workspaceName
=
getWorkspaceLabel
({
id
:
workspaceId
,
configPath
:
workspaceConfigPath
.
fsPath
},
this
.
environmentService
);
this
.
workspace
=
new
Workspace
(
workspaceId
,
workspaceName
,
workspaceFolders
,
workspaceConfigPath
);
this
.
workspace
.
update
(
workspaceId
,
workspaceName
,
workspaceFolders
,
workspaceConfigPath
);
this
.
_register
(
this
.
workspaceConfiguration
.
onDidUpdateConfiguration
(()
=>
this
.
onWorkspaceConfigurationChanged
(
workspaceConfigPath
)));
return
null
;
});
...
...
@@ -484,14 +485,14 @@ export class WorkspaceServiceImpl extends WorkspaceService {
const
ctime
=
isLinux
?
workspaceStat
.
ino
:
workspaceStat
.
birthtime
.
getTime
();
// On Linux, birthtime is ctime, so we cannot use it! We use the ino instead!
const
id
=
createHash
(
'
md5
'
).
update
(
folderPath
.
fsPath
).
update
(
ctime
?
String
(
ctime
)
:
''
).
digest
(
'
hex
'
);
const
folder
=
URI
.
file
(
folderPath
.
fsPath
);
this
.
workspace
=
new
Workspac
e
(
id
,
paths
.
basename
(
folderPath
.
fsPath
),
toWorkspaceFolders
([{
path
:
folder
.
fsPath
}]),
null
,
ctime
);
this
.
workspace
.
updat
e
(
id
,
paths
.
basename
(
folderPath
.
fsPath
),
toWorkspaceFolders
([{
path
:
folder
.
fsPath
}]),
null
,
ctime
);
return
TPromise
.
as
(
null
);
});
}
private
initializeEmptyWorkspace
(
configuration
:
IWindowConfiguration
):
TPromise
<
void
>
{
let
id
=
configuration
.
backupPath
?
URI
.
from
({
path
:
paths
.
basename
(
configuration
.
backupPath
),
scheme
:
'
empty
'
}).
toString
()
:
''
;
this
.
workspace
=
new
Workspac
e
(
id
,
''
,
[]);
this
.
workspace
.
updat
e
(
id
,
''
,
[]);
return
TPromise
.
as
(
null
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录