Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c387f80b
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,发现更多精彩内容 >>
提交
c387f80b
编写于
8月 24, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
multi root initialization
上级
8d6b6cdd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
15 deletion
+23
-15
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+6
-3
src/vs/workbench/services/configuration/common/configurationModels.ts
...ench/services/configuration/common/configurationModels.ts
+0
-4
src/vs/workbench/services/configuration/node/configuration.ts
...vs/workbench/services/configuration/node/configuration.ts
+15
-5
src/vs/workbench/services/configuration/test/node/configuration.test.ts
...ch/services/configuration/test/node/configuration.test.ts
+1
-1
src/vs/workbench/services/configuration/test/node/configurationEditingService.test.ts
...nfiguration/test/node/configurationEditingService.test.ts
+1
-2
未找到文件。
src/vs/workbench/electron-browser/main.ts
浏览文件 @
c387f80b
...
...
@@ -112,9 +112,12 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
function
createAndInitializeWorkspaceService
(
configuration
:
IWindowConfiguration
,
environmentService
:
EnvironmentService
,
workspacesService
:
IWorkspacesService
):
TPromise
<
WorkspaceService
>
{
return
validateWorkspacePath
(
configuration
).
then
(()
=>
{
const
workspaceConfigPath
=
configuration
.
workspace
?
uri
.
file
(
configuration
.
workspace
.
configPath
)
:
null
;
const
folderPath
=
configuration
.
folderPath
?
uri
.
file
(
configuration
.
folderPath
)
:
null
;
const
workspaceService
=
(
workspaceConfigPath
||
configuration
.
folderPath
)
?
new
WorkspaceServiceImpl
(
workspaceConfigPath
,
folderPath
,
environmentService
,
workspacesService
)
:
new
EmptyWorkspaceServiceImpl
(
environmentService
);
let
workspaceService
:
WorkspaceServiceImpl
|
EmptyWorkspaceServiceImpl
;
if
(
configuration
.
workspace
||
configuration
.
folderPath
)
{
workspaceService
=
new
WorkspaceServiceImpl
(
configuration
.
workspace
||
configuration
.
folderPath
,
environmentService
,
workspacesService
);
}
else
{
workspaceService
=
new
EmptyWorkspaceServiceImpl
(
environmentService
);
}
return
workspaceService
.
initialize
().
then
(()
=>
workspaceService
,
error
=>
new
EmptyWorkspaceServiceImpl
(
environmentService
));
});
...
...
src/vs/workbench/services/configuration/common/configurationModels.ts
浏览文件 @
c387f80b
...
...
@@ -29,10 +29,6 @@ export class WorkspaceConfigurationModel<T> extends CustomConfigurationModel<T>
this
.
_workspaceConfiguration
=
this
.
consolidate
();
}
get
id
():
string
{
return
this
.
_raw
[
'
id
'
];
}
get
folders
():
URI
[]
{
return
this
.
_folders
;
}
...
...
src/vs/workbench/services/configuration/node/configuration.ts
浏览文件 @
c387f80b
...
...
@@ -33,7 +33,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
ExtensionsRegistry
,
ExtensionMessageCollector
}
from
'
vs/platform/extensions/common/extensionsRegistry
'
;
import
{
IConfigurationNode
,
IConfigurationRegistry
,
Extensions
,
editorConfigurationSchemaId
,
IDefaultConfigurationExtension
,
validateProperty
,
ConfigurationScope
,
schemaId
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
createHash
}
from
'
crypto
'
;
import
{
getWorkspaceLabel
,
IWorkspacesService
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
getWorkspaceLabel
,
IWorkspacesService
,
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
interface
IStat
{
resource
:
URI
;
...
...
@@ -338,12 +338,21 @@ export class WorkspaceServiceImpl extends WorkspaceService {
public
_serviceBrand
:
any
;
private
workspaceConfigPath
:
URI
;
private
folderPath
:
URI
;
private
baseConfigurationService
:
GlobalConfigurationService
<
any
>
;
private
workspaceConfiguration
:
WorkspaceConfiguration
;
private
cachedFolderConfigs
:
StrictResourceMap
<
FolderConfiguration
<
any
>>
;
constructor
(
private
workspace
ConfigPath
:
URI
,
private
folderPath
:
URI
,
private
environmentService
:
IEnvironmentService
,
private
workspacesService
:
IWorkspacesService
,
private
workspaceSettingsRootFolder
:
string
=
WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME
)
{
constructor
(
private
workspace
Identifier
:
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
,
private
environmentService
:
IEnvironmentService
,
private
workspacesService
:
IWorkspacesService
,
private
workspaceSettingsRootFolder
:
string
=
WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME
)
{
super
();
if
(
isSingleFolderWorkspaceIdentifier
(
workspaceIdentifier
))
{
this
.
folderPath
=
URI
.
file
(
workspaceIdentifier
);
}
else
{
this
.
workspaceConfigPath
=
URI
.
file
(
workspaceIdentifier
.
configPath
);
}
this
.
workspaceConfiguration
=
this
.
_register
(
new
WorkspaceConfiguration
());
this
.
baseConfigurationService
=
this
.
_register
(
new
GlobalConfigurationService
(
environmentService
));
}
...
...
@@ -435,11 +444,12 @@ export class WorkspaceServiceImpl extends WorkspaceService {
return
this
.
workspaceConfiguration
.
load
(
this
.
workspaceConfigPath
)
.
then
(()
=>
{
const
workspaceConfigurationModel
=
this
.
workspaceConfiguration
.
workspaceConfigurationModel
;
if
(
!
workspaceConfigurationModel
.
id
||
!
workspaceConfigurationModel
.
folders
.
length
)
{
if
(
!
workspaceConfigurationModel
.
folders
.
length
)
{
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
'
Invalid workspace configuraton file
'
+
this
.
workspaceConfigPath
));
}
const
workspaceName
=
getWorkspaceLabel
({
id
:
workspaceConfigurationModel
.
id
,
configPath
:
this
.
workspaceConfigPath
.
fsPath
},
this
.
environmentService
);
this
.
workspace
=
new
Workspace
(
workspaceConfigurationModel
.
id
,
workspaceName
,
workspaceConfigurationModel
.
folders
,
this
.
workspaceConfigPath
);
const
workspaceId
=
(
this
.
workspaceIdentifier
as
IWorkspaceIdentifier
).
id
;
const
workspaceName
=
getWorkspaceLabel
({
id
:
workspaceId
,
configPath
:
this
.
workspaceConfigPath
.
fsPath
},
this
.
environmentService
);
this
.
workspace
=
new
Workspace
(
workspaceId
,
workspaceName
,
workspaceConfigurationModel
.
folders
,
this
.
workspaceConfigPath
);
this
.
legacyWorkspace
=
new
LegacyWorkspace
(
this
.
workspace
.
roots
[
0
]);
this
.
_register
(
this
.
workspaceConfiguration
.
onDidUpdateConfiguration
(()
=>
this
.
onWorkspaceConfigurationChanged
()));
return
null
;
...
...
src/vs/workbench/services/configuration/test/node/configuration.test.ts
浏览文件 @
c387f80b
...
...
@@ -47,7 +47,7 @@ suite('WorkspaceConfigurationService - Node', () => {
function
createService
(
workspaceDir
:
string
,
globalSettingsFile
:
string
):
TPromise
<
WorkspaceService
>
{
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
service
=
new
WorkspaceServiceImpl
(
null
,
URI
.
file
(
workspaceDir
)
,
environmentService
,
null
);
const
service
=
new
WorkspaceServiceImpl
(
workspaceDir
,
environmentService
,
null
);
return
service
.
initialize
().
then
(()
=>
service
);
}
...
...
src/vs/workbench/services/configuration/test/node/configurationEditingService.test.ts
浏览文件 @
c387f80b
...
...
@@ -11,7 +11,6 @@ import os = require('os');
import
path
=
require
(
'
path
'
);
import
fs
=
require
(
'
fs
'
);
import
*
as
json
from
'
vs/base/common/json
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ParsedArgs
,
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
...
...
@@ -118,7 +117,7 @@ suite('ConfigurationEditingService', () => {
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
const
workspacesService
=
instantiationService
.
stub
(
IWorkspacesService
,
{});
const
workspaceService
=
noWorkspace
?
new
EmptyWorkspaceServiceImpl
(
environmentService
)
:
new
WorkspaceServiceImpl
(
null
,
URI
.
file
(
workspaceDir
)
,
environmentService
,
workspacesService
);
const
workspaceService
=
noWorkspace
?
new
EmptyWorkspaceServiceImpl
(
environmentService
)
:
new
WorkspaceServiceImpl
(
workspaceDir
,
environmentService
,
workspacesService
);
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
instantiationService
.
stub
(
ILifecycleService
,
new
TestLifecycleService
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录