Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c6453d86
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,发现更多精彩内容 >>
提交
c6453d86
编写于
9月 25, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #33485
上级
dbffd8ac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
15 deletion
+33
-15
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+19
-5
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
...workbench/parts/preferences/browser/preferencesWidgets.ts
+14
-10
未找到文件。
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
c6453d86
...
...
@@ -228,7 +228,7 @@ export class PreferencesEditor extends BaseEditor {
private
updateInput
(
oldInput
:
PreferencesEditorInput
,
newInput
:
PreferencesEditorInput
,
options
?:
EditorOptions
):
TPromise
<
void
>
{
const
resource
=
toResource
(
newInput
.
master
);
this
.
settingsTargetsWidget
.
setTarget
(
this
.
getSettingsConfigurationTargetUri
(
resource
),
this
.
getSettingsConfigurationTarget
(
resource
));
this
.
settingsTargetsWidget
.
updateTargets
(
this
.
getSettingsConfigurationTargetUri
(
resource
),
this
.
getSettingsConfigurationTarget
(
resource
));
return
this
.
sideBySidePreferencesWidget
.
setInput
(
<
DefaultPreferencesEditorInput
>
newInput
.
details
,
<
EditorInput
>
newInput
.
master
,
options
).
then
(({
defaultPreferencesRenderer
,
editablePreferencesRenderer
})
=>
{
this
.
preferencesRenderers
.
defaultPreferencesRenderer
=
defaultPreferencesRenderer
;
...
...
@@ -278,9 +278,14 @@ export class PreferencesEditor extends BaseEditor {
private
onWorkbenchStateChanged
():
void
{
if
(
this
.
input
)
{
const
settingsResource
=
toResource
((
<
PreferencesEditorInput
>
this
.
input
).
master
);
const
target
=
this
.
getSettingsConfigurationTarget
(
settingsResource
);
if
(
target
!==
ConfigurationTarget
.
USER
)
{
const
editableSettingsResource
=
toResource
((
<
PreferencesEditorInput
>
this
.
input
).
master
);
const
newConfigurationTarget
=
this
.
getSettingsConfigurationTarget
(
editableSettingsResource
);
if
(
newConfigurationTarget
)
{
if
(
newConfigurationTarget
!==
this
.
settingsTargetsWidget
.
configurationTarget
)
{
// Update the editor if the configuration target of the settings resource changed
this
.
switchSettings
(
editableSettingsResource
);
}
}
else
{
this
.
switchSettings
(
this
.
preferencesService
.
userSettingsResource
);
}
}
...
...
@@ -798,7 +803,7 @@ abstract class AbstractSettingsEditorContribution extends Disposable {
return
TPromise
.
as
(
null
);
}
pr
ivate
_onModelChanged
():
void
{
pr
otected
_onModelChanged
():
void
{
const
model
=
this
.
editor
.
getModel
();
this
.
disposePreferencesRenderer
();
if
(
model
)
{
...
...
@@ -875,6 +880,15 @@ class SettingsEditorContribution extends AbstractSettingsEditorContribution impl
static
ID
:
string
=
'
editor.contrib.settings
'
;
constructor
(
editor
:
ICodeEditor
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IPreferencesService
preferencesService
:
IPreferencesService
,
@
IWorkspaceContextService
workspaceContextService
:
IWorkspaceContextService
)
{
super
(
editor
,
instantiationService
,
preferencesService
,
workspaceContextService
);
this
.
_register
(
this
.
workspaceContextService
.
onDidChangeWorkbenchState
(()
=>
this
.
_onModelChanged
()));
}
getId
():
string
{
return
SettingsEditorContribution
.
ID
;
}
...
...
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
浏览文件 @
c6453d86
...
...
@@ -271,7 +271,7 @@ export class SettingsTargetsWidget extends Widget {
private
borderColor
:
Color
;
constructor
(
parent
:
HTMLElement
,
private
uri
:
URI
,
private
t
arget
:
ConfigurationTarget
,
constructor
(
parent
:
HTMLElement
,
private
_uri
:
URI
,
private
_configuartionT
arget
:
ConfigurationTarget
,
@
IWorkspaceContextService
private
workspaceContextService
:
IWorkspaceContextService
,
@
IPreferencesService
private
preferencesService
:
IPreferencesService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
...
...
@@ -285,9 +285,13 @@ export class SettingsTargetsWidget extends Widget {
}));
}
public
setTarget
(
uri
:
URI
,
target
:
ConfigurationTarget
):
void
{
this
.
uri
=
uri
;
this
.
target
=
target
;
get
configurationTarget
():
ConfigurationTarget
{
return
this
.
_configuartionTarget
;
}
public
updateTargets
(
uri
:
URI
,
configuartionTarget
:
ConfigurationTarget
):
void
{
this
.
_uri
=
uri
;
this
.
_configuartionTarget
=
configuartionTarget
;
this
.
updateLabel
();
}
...
...
@@ -308,8 +312,8 @@ export class SettingsTargetsWidget extends Widget {
}
private
updateLabel
():
void
{
this
.
targetLabel
.
textContent
=
getSettingsTargetName
(
this
.
target
,
this
.
uri
,
this
.
workspaceContextService
);
const
details
=
ConfigurationTarget
.
FOLDER
===
this
.
t
arget
?
localize
(
'
folderSettingsDetails
'
,
"
Folder Settings
"
)
:
''
;
this
.
targetLabel
.
textContent
=
getSettingsTargetName
(
this
.
_configuartionTarget
,
this
.
_
uri
,
this
.
workspaceContextService
);
const
details
=
ConfigurationTarget
.
FOLDER
===
this
.
_configuartionT
arget
?
localize
(
'
folderSettingsDetails
'
,
"
Folder Settings
"
)
:
''
;
this
.
targetDetails
.
textContent
=
details
;
DOM
.
toggleClass
(
this
.
targetDetails
,
'
empty
'
,
!
details
);
}
...
...
@@ -332,7 +336,7 @@ export class SettingsTargetsWidget extends Widget {
actions
.
push
(
<
IAction
>
{
id
:
'
userSettingsTarget
'
,
label
:
getSettingsTargetName
(
ConfigurationTarget
.
USER
,
userSettingsResource
,
this
.
workspaceContextService
),
checked
:
this
.
uri
.
toString
()
===
userSettingsResource
.
toString
(),
checked
:
this
.
_
uri
.
toString
()
===
userSettingsResource
.
toString
(),
enabled
:
true
,
run
:
()
=>
this
.
onTargetClicked
(
userSettingsResource
)
});
...
...
@@ -342,7 +346,7 @@ export class SettingsTargetsWidget extends Widget {
actions
.
push
(
<
IAction
>
{
id
:
'
workspaceSettingsTarget
'
,
label
:
getSettingsTargetName
(
ConfigurationTarget
.
WORKSPACE
,
workspaceSettingsResource
,
this
.
workspaceContextService
),
checked
:
this
.
uri
.
toString
()
===
workspaceSettingsResource
.
toString
(),
checked
:
this
.
_
uri
.
toString
()
===
workspaceSettingsResource
.
toString
(),
enabled
:
true
,
run
:
()
=>
this
.
onTargetClicked
(
workspaceSettingsResource
)
});
...
...
@@ -355,7 +359,7 @@ export class SettingsTargetsWidget extends Widget {
return
<
IAction
>
{
id
:
'
folderSettingsTarget
'
+
index
,
label
:
getSettingsTargetName
(
ConfigurationTarget
.
FOLDER
,
folder
.
uri
,
this
.
workspaceContextService
),
checked
:
this
.
uri
.
toString
()
===
folder
.
uri
.
toString
(),
checked
:
this
.
_
uri
.
toString
()
===
folder
.
uri
.
toString
(),
enabled
:
true
,
run
:
()
=>
this
.
onTargetClicked
(
folder
.
uri
)
};
...
...
@@ -366,7 +370,7 @@ export class SettingsTargetsWidget extends Widget {
}
private
onTargetClicked
(
target
:
URI
):
void
{
if
(
this
.
uri
.
toString
()
===
target
.
toString
())
{
if
(
this
.
_
uri
.
toString
()
===
target
.
toString
())
{
return
;
}
this
.
_onDidTargetChange
.
fire
(
target
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录