Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b2cd2e0b
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,发现更多精彩内容 >>
提交
b2cd2e0b
编写于
8月 30, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Empty path in the folders should be ignored (fixes #33393)
上级
4e463469
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
32 addition
and
28 deletion
+32
-28
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+13
-15
src/vs/workbench/services/configuration/common/configurationModels.ts
...ench/services/configuration/common/configurationModels.ts
+3
-3
src/vs/workbench/services/configuration/node/configuration.ts
...vs/workbench/services/configuration/node/configuration.ts
+16
-10
未找到文件。
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
b2cd2e0b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
'
use strict
'
;
'
use strict
'
;
import
{
IWorkspacesMainService
,
IWorkspaceIdentifier
,
IStoredWorkspace
,
WORKSPACE_EXTENSION
,
IWorkspaceSavedEvent
,
UNTITLED_WORKSPACE_NAME
,
IResolvedWorkspace
,
IStoredWorkspaceFolder
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspacesMainService
,
IWorkspaceIdentifier
,
IStoredWorkspace
,
WORKSPACE_EXTENSION
,
IWorkspaceSavedEvent
,
UNTITLED_WORKSPACE_NAME
,
IResolvedWorkspace
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
isParent
}
from
'
vs/platform/files/common/files
'
;
import
{
isParent
}
from
'
vs/platform/files/common/files
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
...
@@ -85,21 +85,17 @@ export class WorkspacesMainService implements IWorkspacesMainService {
...
@@ -85,21 +85,17 @@ export class WorkspacesMainService implements IWorkspacesMainService {
writeFileSync
(
path
,
JSON
.
stringify
(
workspace
,
null
,
'
\t
'
));
writeFileSync
(
path
,
JSON
.
stringify
(
workspace
,
null
,
'
\t
'
));
}
}
let
absoluteFolders
:
IStoredWorkspaceFolder
[]
=
[];
// relative paths get resolved against the workspace location
workspace
.
folders
.
forEach
(
folder
=>
{
workspace
.
folders
.
forEach
(
folder
=>
{
if
(
isAbsolute
(
folder
.
path
))
{
if
(
folder
.
path
&&
!
isAbsolute
(
folder
.
path
))
{
absoluteFolders
.
push
(
folder
);
folder
.
path
=
resolve
(
dirname
(
path
),
folder
.
path
);
}
else
{
absoluteFolders
.
push
({
path
:
resolve
(
dirname
(
path
),
folder
.
path
)
// relative paths get resolved against the workspace location
});
}
}
});
});
return
{
return
{
id
:
this
.
getWorkspaceId
(
path
),
id
:
this
.
getWorkspaceId
(
path
),
configPath
:
path
,
configPath
:
path
,
folders
:
absoluteF
olders
folders
:
workspace
.
f
olders
};
};
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
logService
.
log
(
error
.
toString
());
this
.
logService
.
log
(
error
.
toString
());
...
@@ -205,6 +201,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
...
@@ -205,6 +201,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
// is a parent of the location of the workspace file itself. Otherwise keep
// is a parent of the location of the workspace file itself. Otherwise keep
// using absolute paths.
// using absolute paths.
storedWorkspace
.
folders
.
forEach
(
folder
=>
{
storedWorkspace
.
folders
.
forEach
(
folder
=>
{
if
(
folder
.
path
)
{
if
(
!
isAbsolute
(
folder
.
path
))
{
if
(
!
isAbsolute
(
folder
.
path
))
{
folder
.
path
=
resolve
(
sourceConfigFolder
,
folder
.
path
);
// relative paths get resolved against the workspace location
folder
.
path
=
resolve
(
sourceConfigFolder
,
folder
.
path
);
// relative paths get resolved against the workspace location
}
}
...
@@ -212,6 +209,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
...
@@ -212,6 +209,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
if
(
isEqualOrParent
(
folder
.
path
,
targetConfigFolder
,
!
isLinux
))
{
if
(
isEqualOrParent
(
folder
.
path
,
targetConfigFolder
,
!
isLinux
))
{
folder
.
path
=
relative
(
targetConfigFolder
,
folder
.
path
);
// absolute paths get converted to relative ones to workspace location if possible
folder
.
path
=
relative
(
targetConfigFolder
,
folder
.
path
);
// absolute paths get converted to relative ones to workspace location if possible
}
}
}
});
});
return
writeFile
(
targetConfigPath
,
JSON
.
stringify
(
storedWorkspace
,
null
,
'
\t
'
)).
then
(()
=>
{
return
writeFile
(
targetConfigPath
,
JSON
.
stringify
(
storedWorkspace
,
null
,
'
\t
'
)).
then
(()
=>
{
...
...
src/vs/workbench/services/configuration/common/configurationModels.ts
浏览文件 @
b2cd2e0b
...
@@ -15,7 +15,7 @@ import { IStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces
...
@@ -15,7 +15,7 @@ import { IStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces
export
class
WorkspaceConfigurationModel
<
T
>
extends
CustomConfigurationModel
<
T
>
{
export
class
WorkspaceConfigurationModel
<
T
>
extends
CustomConfigurationModel
<
T
>
{
private
_raw
:
T
;
private
_raw
:
T
;
private
_folders
:
string
[];
private
_folders
:
IStoredWorkspaceFolder
[];
private
_worksapaceSettings
:
ConfigurationModel
<
T
>
;
private
_worksapaceSettings
:
ConfigurationModel
<
T
>
;
private
_tasksConfiguration
:
ConfigurationModel
<
T
>
;
private
_tasksConfiguration
:
ConfigurationModel
<
T
>
;
private
_launchConfiguration
:
ConfigurationModel
<
T
>
;
private
_launchConfiguration
:
ConfigurationModel
<
T
>
;
...
@@ -27,7 +27,7 @@ export class WorkspaceConfigurationModel<T> extends CustomConfigurationModel<T>
...
@@ -27,7 +27,7 @@ export class WorkspaceConfigurationModel<T> extends CustomConfigurationModel<T>
this
.
_workspaceConfiguration
=
this
.
consolidate
();
this
.
_workspaceConfiguration
=
this
.
consolidate
();
}
}
get
folders
():
string
[]
{
get
folders
():
IStoredWorkspaceFolder
[]
{
return
this
.
_folders
;
return
this
.
_folders
;
}
}
...
@@ -38,7 +38,7 @@ export class WorkspaceConfigurationModel<T> extends CustomConfigurationModel<T>
...
@@ -38,7 +38,7 @@ export class WorkspaceConfigurationModel<T> extends CustomConfigurationModel<T>
protected
processRaw
(
raw
:
T
):
void
{
protected
processRaw
(
raw
:
T
):
void
{
this
.
_raw
=
raw
;
this
.
_raw
=
raw
;
this
.
_folders
=
(
(
this
.
_raw
[
'
folders
'
]
||
[])
as
IStoredWorkspaceFolder
[]).
map
(
folder
=>
folder
.
path
)
;
this
.
_folders
=
(
this
.
_raw
[
'
folders
'
]
||
[])
as
IStoredWorkspaceFolder
[]
;
this
.
_worksapaceSettings
=
this
.
parseConfigurationModel
(
'
settings
'
);
this
.
_worksapaceSettings
=
this
.
parseConfigurationModel
(
'
settings
'
);
this
.
_tasksConfiguration
=
this
.
parseConfigurationModel
(
'
tasks
'
);
this
.
_tasksConfiguration
=
this
.
parseConfigurationModel
(
'
tasks
'
);
this
.
_launchConfiguration
=
this
.
parseConfigurationModel
(
'
launch
'
);
this
.
_launchConfiguration
=
this
.
parseConfigurationModel
(
'
launch
'
);
...
...
src/vs/workbench/services/configuration/node/configuration.ts
浏览文件 @
b2cd2e0b
...
@@ -9,7 +9,7 @@ import * as paths from 'vs/base/common/paths';
...
@@ -9,7 +9,7 @@ import * as paths from 'vs/base/common/paths';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
StrictResourceMap
}
from
'
vs/base/common/map
'
;
import
{
StrictResourceMap
}
from
'
vs/base/common/map
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
import
{
equals
,
coalesce
}
from
'
vs/base/common/arrays
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
collections
from
'
vs/base/common/collections
'
;
import
*
as
collections
from
'
vs/base/common/collections
'
;
...
@@ -33,7 +33,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
...
@@ -33,7 +33,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
ExtensionsRegistry
,
ExtensionMessageCollector
}
from
'
vs/platform/extensions/common/extensionsRegistry
'
;
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
{
IConfigurationNode
,
IConfigurationRegistry
,
Extensions
,
editorConfigurationSchemaId
,
IDefaultConfigurationExtension
,
validateProperty
,
ConfigurationScope
,
schemaId
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
createHash
}
from
'
crypto
'
;
import
{
createHash
}
from
'
crypto
'
;
import
{
getWorkspaceLabel
,
IWorkspacesService
,
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
getWorkspaceLabel
,
IWorkspacesService
,
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
IStoredWorkspaceFolder
}
from
'
vs/platform/workspaces/common/workspaces
'
;
interface
IStat
{
interface
IStat
{
resource
:
URI
;
resource
:
URI
;
...
@@ -436,26 +436,32 @@ export class WorkspaceServiceImpl extends WorkspaceService {
...
@@ -436,26 +436,32 @@ export class WorkspaceServiceImpl extends WorkspaceService {
return
this
.
workspaceConfiguration
.
load
(
this
.
workspaceConfigPath
)
return
this
.
workspaceConfiguration
.
load
(
this
.
workspaceConfigPath
)
.
then
(()
=>
{
.
then
(()
=>
{
const
workspaceConfigurationModel
=
this
.
workspaceConfiguration
.
workspaceConfigurationModel
;
const
workspaceConfigurationModel
=
this
.
workspaceConfiguration
.
workspaceConfigurationModel
;
if
(
!
workspaceConfigurationModel
.
folders
.
length
)
{
const
workspaceFolders
=
this
.
parseWorkspaceFolders
(
workspaceConfigurationModel
.
folders
);
if
(
!
workspaceFolders
.
length
)
{
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
'
Invalid workspace configuraton file
'
+
this
.
workspaceConfigPath
));
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
'
Invalid workspace configuraton file
'
+
this
.
workspaceConfigPath
));
}
}
const
workspaceId
=
(
this
.
workspaceIdentifier
as
IWorkspaceIdentifier
).
id
;
const
workspaceId
=
(
this
.
workspaceIdentifier
as
IWorkspaceIdentifier
).
id
;
const
workspaceName
=
getWorkspaceLabel
({
id
:
workspaceId
,
configPath
:
this
.
workspaceConfigPath
.
fsPath
},
this
.
environmentService
);
const
workspaceName
=
getWorkspaceLabel
({
id
:
workspaceId
,
configPath
:
this
.
workspaceConfigPath
.
fsPath
},
this
.
environmentService
);
this
.
workspace
=
new
Workspace
(
workspaceId
,
workspaceName
,
this
.
parseWorkspaceFolders
(
workspaceConfigurationModel
.
folders
)
,
this
.
workspaceConfigPath
);
this
.
workspace
=
new
Workspace
(
workspaceId
,
workspaceName
,
workspaceFolders
,
this
.
workspaceConfigPath
);
this
.
legacyWorkspace
=
new
LegacyWorkspace
(
this
.
workspace
.
roots
[
0
]);
this
.
legacyWorkspace
=
new
LegacyWorkspace
(
this
.
workspace
.
roots
[
0
]);
this
.
_register
(
this
.
workspaceConfiguration
.
onDidUpdateConfiguration
(()
=>
this
.
onWorkspaceConfigurationChanged
()));
this
.
_register
(
this
.
workspaceConfiguration
.
onDidUpdateConfiguration
(()
=>
this
.
onWorkspaceConfigurationChanged
()));
return
null
;
return
null
;
});
});
}
}
private
parseWorkspaceFolders
(
configuredFolders
:
string
[]):
URI
[]
{
private
parseWorkspaceFolders
(
configuredFolders
:
IStoredWorkspaceFolder
[]):
URI
[]
{
return
configuredFolders
.
map
(
configuredFolder
=>
{
return
coalesce
(
configuredFolders
.
map
(
configuredFolder
=>
{
if
(
paths
.
isAbsolute
(
configuredFolder
))
{
const
path
=
configuredFolder
.
path
;
return
URI
.
file
(
configuredFolder
);
if
(
!
path
)
{
return
void
0
;
}
}
return
URI
.
file
(
paths
.
join
(
paths
.
dirname
(
this
.
workspaceConfigPath
.
fsPath
),
configuredFolder
));
if
(
paths
.
isAbsolute
(
path
))
{
});
return
URI
.
file
(
path
);
}
return
URI
.
file
(
paths
.
join
(
paths
.
dirname
(
this
.
workspaceConfigPath
.
fsPath
),
path
));
}));
}
}
private
registerWorkspaceConfigSchema
():
void
{
private
registerWorkspaceConfigSchema
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录