Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f3ae32fc
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,发现更多精彩内容 >>
提交
f3ae32fc
编写于
6月 21, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
💄
上级
92b2d108
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
41 deletion
+36
-41
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/node/extHostConfiguration.ts
src/vs/workbench/api/node/extHostConfiguration.ts
+12
-21
src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts
...ch/test/electron-browser/api/extHostConfiguration.test.ts
+23
-19
未找到文件。
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
f3ae32fc
...
...
@@ -90,7 +90,7 @@ export function createApiFactory(
const
extHostCommands
=
col
.
define
(
ExtHostContext
.
ExtHostCommands
).
set
<
ExtHostCommands
>
(
new
ExtHostCommands
(
threadService
,
extHostHeapService
));
const
extHostTreeViews
=
col
.
define
(
ExtHostContext
.
ExtHostTreeViews
).
set
<
ExtHostTreeViews
>
(
new
ExtHostTreeViews
(
threadService
,
extHostCommands
));
const
extHostWorkspace
=
col
.
define
(
ExtHostContext
.
ExtHostWorkspace
).
set
<
ExtHostWorkspace
>
(
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
));
const
extHostConfiguration
=
col
.
define
(
ExtHostContext
.
ExtHostConfiguration
).
set
<
ExtHostConfiguration
>
(
new
ExtHostConfiguration
(
threadService
.
get
(
MainContext
.
MainThreadConfiguration
),
initData
.
configuration
,
extHostWorkspace
));
const
extHostConfiguration
=
col
.
define
(
ExtHostContext
.
ExtHostConfiguration
).
set
<
ExtHostConfiguration
>
(
new
ExtHostConfiguration
(
threadService
.
get
(
MainContext
.
MainThreadConfiguration
),
extHostWorkspace
,
initData
.
configuration
));
const
extHostDiagnostics
=
col
.
define
(
ExtHostContext
.
ExtHostDiagnostics
).
set
<
ExtHostDiagnostics
>
(
new
ExtHostDiagnostics
(
threadService
));
const
languageFeatures
=
col
.
define
(
ExtHostContext
.
ExtHostLanguageFeatures
).
set
<
ExtHostLanguageFeatures
>
(
new
ExtHostLanguageFeatures
(
threadService
,
extHostDocuments
,
extHostCommands
,
extHostHeapService
,
extHostDiagnostics
));
const
extHostFileSystemEvent
=
col
.
define
(
ExtHostContext
.
ExtHostFileSystemEventService
).
set
<
ExtHostFileSystemEventService
>
(
new
ExtHostFileSystemEventService
());
...
...
src/vs/workbench/api/node/extHostConfiguration.ts
浏览文件 @
f3ae32fc
...
...
@@ -25,41 +25,32 @@ function lookUp(tree: any, key: string) {
export
class
ExtHostConfiguration
extends
ExtHostConfigurationShape
{
private
_onDidChangeConfiguration
=
new
Emitter
<
void
>
();
private
_proxy
:
MainThreadConfigurationShape
;
private
_data
:
IConfigurationData
<
any
>
;
private
_extHostWorkspace
:
ExtHostWorkspace
;
private
readonly
_onDidChangeConfiguration
=
new
Emitter
<
void
>
();
private
readonly
_proxy
:
MainThreadConfigurationShape
;
private
readonly
_extHostWorkspace
:
ExtHostWorkspace
;
private
_configuration
:
Configuration
<
any
>
;
constructor
(
proxy
:
MainThreadConfigurationShape
,
data
:
IConfigurationData
<
any
>
,
extWorkspace
:
ExtHostWorkspace
)
{
constructor
(
proxy
:
MainThreadConfigurationShape
,
extHostWorkspace
:
ExtHostWorkspace
,
data
:
IConfigurationData
<
any
>
)
{
super
();
this
.
_proxy
=
proxy
;
this
.
_
data
=
data
;
this
.
_
extHostWorkspace
=
extWorkspace
;
this
.
_
extHostWorkspace
=
extHostWorkspace
;
this
.
_
configuration
=
Configuration
.
parse
(
data
,
extHostWorkspace
.
workspace
)
;
}
get
onDidChangeConfiguration
():
Event
<
void
>
{
return
this
.
_onDidChangeConfiguration
&&
this
.
_onDidChangeConfiguration
.
event
;
}
public
$acceptConfigurationChanged
(
data
:
IConfigurationData
<
any
>
)
{
this
.
_configuration
=
null
;
this
.
_data
=
data
;
$acceptConfigurationChanged
(
data
:
IConfigurationData
<
any
>
)
{
this
.
_configuration
=
Configuration
.
parse
(
data
,
this
.
_extHostWorkspace
.
workspace
);
this
.
_onDidChangeConfiguration
.
fire
(
undefined
);
}
private
get
configuration
():
Configuration
<
any
>
{
if
(
!
this
.
_configuration
)
{
this
.
_configuration
=
Configuration
.
parse
(
this
.
_data
,
this
.
_extHostWorkspace
.
workspace
);
}
return
this
.
_configuration
;
}
public
getConfiguration
(
section
?:
string
):
WorkspaceConfiguration
{
getConfiguration
(
section
?:
string
):
WorkspaceConfiguration
{
const
config
=
section
?
lookUp
(
this
.
configuration
.
getValue
(),
section
)
:
this
.
configuration
.
getValue
();
?
lookUp
(
this
.
_
configuration
.
getValue
(),
section
)
:
this
.
_
configuration
.
getValue
();
const
result
:
WorkspaceConfiguration
=
{
has
(
key
:
string
):
boolean
{
...
...
@@ -83,7 +74,7 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
},
inspect
:
<
T
>
(
key
:
string
):
{
key
:
string
;
defaultValue
?:
T
;
globalValue
?:
T
;
workspaceValue
?:
T
}
=>
{
key
=
section
?
`
${
section
}
.
${
key
}
`
:
key
;
const
config
=
this
.
configuration
.
values
()[
key
];
const
config
=
this
.
_
configuration
.
values
()[
key
];
if
(
config
)
{
return
{
key
,
...
...
src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts
浏览文件 @
f3ae32fc
...
...
@@ -29,11 +29,11 @@ suite('ExtHostConfiguration', function () {
if
(
!
shape
)
{
shape
=
new
class
extends
MainThreadConfigurationShape
{
};
}
return
new
ExtHostConfiguration
(
shape
,
{
return
new
ExtHostConfiguration
(
shape
,
new
ExtHostWorkspace
(
new
TestThreadService
(),
null
),
{
defaults
:
new
ConfigurationModel
(
contents
),
user
:
new
ConfigurationModel
(
contents
),
folders
:
Object
.
create
(
null
)
}
,
new
ExtHostWorkspace
(
new
TestThreadService
(),
null
)
);
});
}
test
(
'
getConfiguration fails regression test 1.7.1 -> 1.8 #15552
'
,
function
()
{
...
...
@@ -91,23 +91,27 @@ suite('ExtHostConfiguration', function () {
'
wordWrap
'
:
'
bounded
'
}
},
[
'
editor.wordWrap
'
]);
const
testObject
=
new
ExtHostConfiguration
(
new
class
extends
MainThreadConfigurationShape
{
},
{
defaults
:
new
ConfigurationModel
({
'
editor
'
:
{
'
wordWrap
'
:
'
off
'
}
},
[
'
editor.wordWrap
'
]),
user
:
new
ConfigurationModel
({
'
editor
'
:
{
'
wordWrap
'
:
'
on
'
}
},
[
'
editor.wordWrap
'
]),
folders
},
new
ExtHostWorkspace
(
new
TestThreadService
(),
{
'
id
'
:
'
foo
'
,
'
roots
'
:
[
URI
.
file
(
'
foo
'
)],
'
name
'
:
'
foo
'
}));
const
testObject
=
new
ExtHostConfiguration
(
new
class
extends
MainThreadConfigurationShape
{
},
new
ExtHostWorkspace
(
new
TestThreadService
(),
{
'
id
'
:
'
foo
'
,
'
roots
'
:
[
URI
.
file
(
'
foo
'
)],
'
name
'
:
'
foo
'
}),
{
defaults
:
new
ConfigurationModel
({
'
editor
'
:
{
'
wordWrap
'
:
'
off
'
}
},
[
'
editor.wordWrap
'
]),
user
:
new
ConfigurationModel
({
'
editor
'
:
{
'
wordWrap
'
:
'
on
'
}
},
[
'
editor.wordWrap
'
]),
folders
}
);
const
actual
=
testObject
.
getConfiguration
().
inspect
(
'
editor.wordWrap
'
);
assert
.
equal
(
actual
.
defaultValue
,
'
off
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录