Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
8cc5c650
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,发现更多精彩内容 >>
未验证
提交
8cc5c650
编写于
8月 25, 2018
作者:
R
Rob Lourens
提交者:
GitHub
8月 25, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #57165 from JacksonKearl/settings-tweaks
Settings tweaks
上级
6cc41bc1
367d0adc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
75 addition
and
59 deletion
+75
-59
src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css
...bench/parts/preferences/browser/media/settingsEditor2.css
+15
-3
src/vs/workbench/parts/preferences/browser/settingsEditor2.ts
...vs/workbench/parts/preferences/browser/settingsEditor2.ts
+19
-4
src/vs/workbench/parts/preferences/browser/settingsTree.ts
src/vs/workbench/parts/preferences/browser/settingsTree.ts
+39
-49
src/vs/workbench/parts/preferences/browser/settingsWidgets.ts
...vs/workbench/parts/preferences/browser/settingsWidgets.ts
+2
-3
未找到文件。
src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css
浏览文件 @
8cc5c650
...
...
@@ -281,17 +281,24 @@
text-overflow
:
ellipsis
;
}
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item.is-configured
::after
{
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item
>
.setting-item-modified-indicator
{
display
:
none
;
}
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item.is-configured
>
.setting-item-modified-indicator
{
display
:
block
;
content
:
' '
;
position
:
absolute
;
width
:
2px
;
width
:
6px
;
border-left-width
:
2px
;
border-left-style
:
solid
;
left
:
0px
;
top
:
15px
;
bottom
:
16px
;
}
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item-bool.
setting-item.is-configured
::afte
r
{
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item-bool.
is-configured
>
.setting-item-modified-indicato
r
{
bottom
:
23px
;
}
...
...
@@ -363,6 +370,11 @@
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item
.setting-item-description-markdown
a
:focus
{
outline
:
1px
solid
-webkit-focus-ring-color
;
outline-offset
:
-1px
;
text-decoration
:
underline
;
}
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item
.setting-item-description-markdown
a
:hover
{
text-decoration
:
underline
;
}
.settings-editor
>
.settings-body
>
.settings-tree-container
.setting-item
.setting-item-description-markdown
code
{
...
...
src/vs/workbench/parts/preferences/browser/settingsEditor2.ts
浏览文件 @
8cc5c650
...
...
@@ -26,11 +26,15 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
WorkbenchTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
badgeBackground
,
badgeForeground
,
contrastBorder
,
editorForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
attachButtonStyler
,
attachStylerCallback
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
EditorOptions
,
IEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
ResourceEditorModel
}
from
'
vs/workbench/common/editor/resourceEditorModel
'
;
import
{
SuggestEnabledInput
}
from
'
vs/workbench/parts/codeEditor/browser/suggestEnabledInput
'
;
import
{
PreferencesEditor
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
import
{
SettingsTarget
,
SettingsTargetsWidget
}
from
'
vs/workbench/parts/preferences/browser/preferencesWidgets
'
;
...
...
@@ -43,8 +47,6 @@ import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsSer
import
{
IPreferencesService
,
ISearchResult
,
ISettingsEditorModel
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
SettingsEditor2Input
}
from
'
vs/workbench/services/preferences/common/preferencesEditorInput
'
;
import
{
DefaultSettingsEditorModel
}
from
'
vs/workbench/services/preferences/common/preferencesModels
'
;
import
{
ResourceEditorModel
}
from
'
vs/workbench/common/editor/resourceEditorModel
'
;
import
{
badgeBackground
,
contrastBorder
,
badgeForeground
,
editorForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
const
$
=
DOM
.
$
;
...
...
@@ -111,7 +113,9 @@ export class SettingsEditor2 extends BaseEditor {
@
ILogService
private
logService
:
ILogService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
INotificationService
private
notificationService
:
INotificationService
)
{
super
(
SettingsEditor2
.
ID
,
telemetryService
,
themeService
);
this
.
delayedFilterLogging
=
new
Delayer
<
void
>
(
1000
);
...
...
@@ -484,7 +488,16 @@ export class SettingsEditor2 extends BaseEditor {
}));
}
public
notifyNoSaveNeeded
(
force
:
boolean
=
true
)
{
if
(
force
||
!
this
.
storageService
.
getBoolean
(
'
hasNotifiedOfSettingsAutosave
'
,
StorageScope
.
GLOBAL
,
false
))
{
this
.
storageService
.
store
(
'
hasNotifiedOfSettingsAutosave
'
,
true
,
StorageScope
.
GLOBAL
);
this
.
notificationService
.
info
(
localize
(
'
settingsNoSaveNeeded
'
,
"
Your changes are automatically saved as you edit.
"
));
}
}
private
onDidChangeSetting
(
key
:
string
,
value
:
any
):
void
{
this
.
notifyNoSaveNeeded
(
false
);
if
(
this
.
pendingSettingUpdate
&&
this
.
pendingSettingUpdate
.
key
!==
key
)
{
this
.
updateChangedSetting
(
key
,
value
);
}
...
...
@@ -728,7 +741,9 @@ export class SettingsEditor2 extends BaseEditor {
// If a single setting is being refreshed, it's ok to refresh now if that is not the focused setting
if
(
key
)
{
const
focusedKey
=
focusedSetting
.
getAttribute
(
SettingsRenderer
.
SETTING_KEY_ATTR
);
if
(
focusedKey
===
key
)
{
if
(
focusedKey
===
key
&&
!
DOM
.
hasClass
(
focusedSetting
,
'
setting-item-exclude
'
))
{
// update `exclude`s live, as they have a separate "submit edit" step built in before this
this
.
updateModifiedLabelForKey
(
key
);
this
.
scheduleRefresh
(
focusedSetting
,
key
);
return
TPromise
.
wrap
(
null
);
...
...
src/vs/workbench/parts/preferences/browser/settingsTree.ts
浏览文件 @
8cc5c650
...
...
@@ -21,7 +21,6 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
{
escapeRegExpCharacters
,
startsWith
}
from
'
vs/base/common/strings
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
...
@@ -48,7 +47,7 @@ const $ = DOM.$;
function
getExcludeDisplayValue
(
element
:
SettingsTreeSettingElement
):
IExcludeDataItem
[]
{
const
data
=
element
.
isConfigured
?
objects
.
mixin
({
...
element
.
scopeValue
},
element
.
defaultValue
,
false
)
:
{
...
element
.
defaultValue
,
...
element
.
scopeValue
}
:
element
.
defaultValue
;
return
Object
.
keys
(
data
)
...
...
@@ -318,17 +317,16 @@ export class SettingsRenderer implements ITreeRenderer {
this
.
descriptionMeasureContainer
)));
this
.
settingActions
=
[
this
.
instantiationService
.
createInstance
(
CopySettingNameAction
),
this
.
instantiationService
.
createInstance
(
CopySettingIdAction
),
this
.
instantiationService
.
createInstance
(
CopySettingAsJSONAction
),
new
Separator
(),
new
Action
(
'
settings.resetSetting
'
,
localize
(
'
resetSettingLabel
'
,
"
Reset Setting
"
),
undefined
,
undefined
,
(
context
:
SettingsTreeSettingElement
)
=>
{
if
(
context
)
{
this
.
_onDidChangeSetting
.
fire
({
key
:
context
.
setting
.
key
,
value
:
undefined
});
}
return
TPromise
.
wrap
(
null
);
})
}),
new
Separator
(),
this
.
instantiationService
.
createInstance
(
CopySettingIdAction
),
this
.
instantiationService
.
createInstance
(
CopySettingAsJSONAction
),
];
}
...
...
@@ -522,6 +520,8 @@ export class SettingsRenderer implements ITreeRenderer {
const
labelElement
=
DOM
.
append
(
labelCategoryContainer
,
$
(
'
span.setting-item-label
'
));
const
otherOverridesElement
=
DOM
.
append
(
titleElement
,
$
(
'
span.setting-item-overrides
'
));
const
descriptionElement
=
DOM
.
append
(
container
,
$
(
'
.setting-item-description
'
));
const
modifiedIndicatorElement
=
DOM
.
append
(
container
,
$
(
'
.setting-item-modified-indicator
'
));
modifiedIndicatorElement
.
title
=
localize
(
'
modified
'
,
"
Modified
"
);
const
valueElement
=
DOM
.
append
(
container
,
$
(
'
.setting-item-value
'
));
const
controlElement
=
DOM
.
append
(
valueElement
,
$
(
'
div.setting-item-control
'
));
...
...
@@ -661,6 +661,9 @@ export class SettingsRenderer implements ITreeRenderer {
const
descriptionAndValueElement
=
DOM
.
append
(
container
,
$
(
'
.setting-item-value-description
'
));
const
controlElement
=
DOM
.
append
(
descriptionAndValueElement
,
$
(
'
.setting-item-bool-control
'
));
const
descriptionElement
=
DOM
.
append
(
descriptionAndValueElement
,
$
(
'
.setting-item-description
'
));
const
modifiedIndicatorElement
=
DOM
.
append
(
container
,
$
(
'
.setting-item-modified-indicator
'
));
modifiedIndicatorElement
.
title
=
localize
(
'
modified
'
,
"
Modified
"
);
const
deprecationWarningElement
=
DOM
.
append
(
container
,
$
(
'
.setting-item-deprecation-message
'
));
...
...
@@ -791,36 +794,43 @@ export class SettingsRenderer implements ITreeRenderer {
common
.
toDispose
.
push
(
excludeWidget
.
onDidChangeExclude
(
e
=>
{
if
(
template
.
context
)
{
const
newValue
=
{
...
template
.
context
.
scopeValue
};
let
newValue
=
{
...
template
.
context
.
scopeValue
};
if
(
e
.
pattern
)
{
if
(
e
.
originalPattern
in
newValue
)
{
// editing something present in the value
newValue
[
e
.
pattern
]
=
newValue
[
e
.
originalPattern
];
delete
newValue
[
e
.
originalPattern
];
}
else
if
(
e
.
originalPattern
)
{
// editing a default
// first delete the existing entry, if present
if
(
e
.
originalPattern
)
{
if
(
e
.
originalPattern
in
template
.
context
.
defaultValue
)
{
// delete a default by overriding it
newValue
[
e
.
originalPattern
]
=
false
;
newValue
[
e
.
pattern
]
=
template
.
context
.
defaultValue
[
e
.
originalPattern
];
}
else
{
// adding a new pattern
newValue
[
e
.
pattern
]
=
true
;
}
}
else
{
if
(
e
.
originalPattern
in
newValue
)
{
// deleting a configured pattern
delete
newValue
[
e
.
originalPattern
];
}
else
if
(
e
.
originalPattern
)
{
// "deleting" a default by overriding it
newValue
[
e
.
originalPattern
]
=
false
;
}
}
// then add the new or updated entry, if present
if
(
e
.
pattern
)
{
if
(
e
.
pattern
in
template
.
context
.
defaultValue
&&
!
e
.
sibling
)
{
// add a default by deleting its override
delete
newValue
[
e
.
pattern
];
}
else
{
newValue
[
e
.
pattern
]
=
e
.
sibling
?
{
when
:
e
.
sibling
}
:
true
;
}
}
const
sortKeys
=
(
obj
)
=>
{
const
keyArray
=
Object
.
keys
(
obj
)
.
map
(
key
=>
({
key
,
val
:
obj
[
key
]
}))
.
sort
((
a
,
b
)
=>
a
.
key
.
localeCompare
(
b
.
key
));
const
retVal
=
{};
keyArray
.
forEach
(
pair
=>
{
retVal
[
pair
.
key
]
=
pair
.
val
;
});
return
retVal
;
};
this
.
_onDidChangeSetting
.
fire
({
key
:
template
.
context
.
setting
.
key
,
value
:
newValue
value
:
Object
.
keys
(
newValue
).
length
===
0
?
undefined
:
sortKeys
(
newValue
)
});
}
}));
...
...
@@ -1483,24 +1493,4 @@ class CopySettingAsJSONAction extends Action {
return
TPromise
.
as
(
null
);
}
}
class
CopySettingNameAction
extends
Action
{
static
readonly
ID
=
'
settings.copySettingName
'
;
static
readonly
LABEL
=
localize
(
'
copySettingNameLabel
'
,
"
Copy Setting Name
"
);
constructor
(
@
IClipboardService
private
clipboardService
:
IClipboardService
)
{
super
(
CopySettingNameAction
.
ID
,
CopySettingNameAction
.
LABEL
);
}
run
(
context
:
SettingsTreeSettingElement
):
TPromise
<
void
>
{
if
(
context
)
{
const
name
=
`
${
context
.
displayCategory
}
:
${
context
.
displayLabel
}
`
;
this
.
clipboardService
.
writeText
(
name
);
}
return
TPromise
.
as
(
null
);
}
}
}
\ No newline at end of file
src/vs/workbench/parts/preferences/browser/settingsWidgets.ts
浏览文件 @
8cc5c650
...
...
@@ -118,7 +118,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const
modifiedItemIndicatorColor
=
theme
.
getColor
(
modifiedItemIndicator
);
if
(
modifiedItemIndicatorColor
)
{
collector
.
addRule
(
`.settings-editor > .settings-body > .settings-tree-container .setting-item
.is-configured::after { background
-color:
${
modifiedItemIndicatorColor
}
; }`
);
collector
.
addRule
(
`.settings-editor > .settings-body > .settings-tree-container .setting-item
> .setting-item-modified-indicator { border
-color:
${
modifiedItemIndicatorColor
}
; }`
);
}
});
...
...
@@ -403,9 +403,8 @@ export class ExcludeSettingWidget extends Disposable {
pattern
,
sibling
:
siblingInput
&&
siblingInput
.
value
.
trim
()
});
}
else
{
this
.
renderList
();
}
this
.
renderList
();
};
const
onKeydown
=
(
e
:
StandardKeyboardEvent
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录