Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
03e1d7dd
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,发现更多精彩内容 >>
提交
03e1d7dd
编写于
11月 14, 2017
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix errant fuzzy widget and invisible count element on keybindings editor
上级
cfb83449
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
31 deletion
+49
-31
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+3
-1
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
...workbench/parts/preferences/browser/preferencesWidgets.ts
+46
-30
未找到文件。
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
03e1d7dd
...
...
@@ -143,7 +143,9 @@ export class PreferencesEditor extends BaseEditor {
this
.
searchWidget
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
SearchWidget
,
this
.
headerContainer
,
{
ariaLabel
:
nls
.
localize
(
'
SearchSettingsWidget.AriaLabel
'
,
"
Search settings
"
),
placeholder
:
nls
.
localize
(
'
SearchSettingsWidget.Placeholder
'
,
"
Search Settings
"
),
focusKey
:
this
.
focusSettingsContextKey
focusKey
:
this
.
focusSettingsContextKey
,
showFuzzyToggle
:
true
,
showResultCount
:
true
}));
this
.
searchWidget
.
setFuzzyToggleVisible
(
this
.
searchProvider
.
remoteSearchEnabled
);
this
.
searchWidget
.
fuzzyEnabled
=
this
.
memento
[
'
fuzzyEnabled
'
];
...
...
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
浏览文件 @
03e1d7dd
...
...
@@ -424,6 +424,8 @@ export class SettingsTargetsWidget extends Widget {
export
interface
SearchOptions
extends
IInputOptions
{
focusKey
?:
IContextKey
<
boolean
>
;
showFuzzyToggle
?:
boolean
;
showResultCount
?:
boolean
;
}
export
class
SearchWidget
extends
Widget
{
...
...
@@ -463,33 +465,37 @@ export class SearchWidget extends Widget {
this
.
domNode
=
DOM
.
append
(
parent
,
DOM
.
$
(
'
div.settings-header-widget
'
));
this
.
createSearchContainer
(
DOM
.
append
(
this
.
domNode
,
DOM
.
$
(
'
div.settings-search-container
'
)));
this
.
controlsDiv
=
DOM
.
append
(
this
.
domNode
,
DOM
.
$
(
'
div.settings-search-controls
'
));
this
.
fuzzyToggle
=
this
.
_register
(
new
Checkbox
({
actionClassName
:
'
prefs-fuzzy-search-toggle
'
,
isChecked
:
false
,
onChange
:
()
=>
{
this
.
inputBox
.
focus
();
this
.
_onDidChange
.
fire
();
},
title
:
localize
(
'
enableFuzzySearch
'
,
'
Enable experimental fuzzy search
'
)
}));
DOM
.
append
(
this
.
controlsDiv
,
this
.
fuzzyToggle
.
domNode
);
this
.
_register
(
attachCheckboxStyler
(
this
.
fuzzyToggle
,
this
.
themeService
));
if
(
this
.
options
.
showFuzzyToggle
)
{
this
.
fuzzyToggle
=
this
.
_register
(
new
Checkbox
({
actionClassName
:
'
prefs-fuzzy-search-toggle
'
,
isChecked
:
false
,
onChange
:
()
=>
{
this
.
inputBox
.
focus
();
this
.
_onDidChange
.
fire
();
},
title
:
localize
(
'
enableFuzzySearch
'
,
'
Enable experimental fuzzy search
'
)
}));
DOM
.
append
(
this
.
controlsDiv
,
this
.
fuzzyToggle
.
domNode
);
this
.
_register
(
attachCheckboxStyler
(
this
.
fuzzyToggle
,
this
.
themeService
));
}
this
.
countElement
=
DOM
.
append
(
this
.
controlsDiv
,
DOM
.
$
(
'
.settings-count-widget
'
));
this
.
_register
(
attachStylerCallback
(
this
.
themeService
,
{
badgeBackground
,
contrastBorder
},
colors
=>
{
const
background
=
colors
.
badgeBackground
?
colors
.
badgeBackground
.
toString
()
:
null
;
const
border
=
colors
.
contrastBorder
?
colors
.
contrastBorder
.
toString
()
:
null
;
if
(
this
.
options
.
showResultCount
)
{
this
.
countElement
=
DOM
.
append
(
this
.
controlsDiv
,
DOM
.
$
(
'
.settings-count-widget
'
));
this
.
_register
(
attachStylerCallback
(
this
.
themeService
,
{
badgeBackground
,
contrastBorder
},
colors
=>
{
const
background
=
colors
.
badgeBackground
?
colors
.
badgeBackground
.
toString
()
:
null
;
const
border
=
colors
.
contrastBorder
?
colors
.
contrastBorder
.
toString
()
:
null
;
this
.
countElement
.
style
.
backgroundColor
=
background
;
this
.
countElement
.
style
.
backgroundColor
=
background
;
this
.
countElement
.
style
.
borderWidth
=
border
?
'
1px
'
:
null
;
this
.
countElement
.
style
.
borderStyle
=
border
?
'
solid
'
:
null
;
this
.
countElement
.
style
.
borderColor
=
border
;
this
.
countElement
.
style
.
borderWidth
=
border
?
'
1px
'
:
null
;
this
.
countElement
.
style
.
borderStyle
=
border
?
'
solid
'
:
null
;
this
.
countElement
.
style
.
borderColor
=
border
;
this
.
styleCountElementForeground
();
}));
this
.
inputBox
.
inputElement
.
setAttribute
(
'
aria-live
'
,
'
assertive
'
);
this
.
styleCountElementForeground
();
}));
}
this
.
inputBox
.
inputElement
.
setAttribute
(
'
aria-live
'
,
'
assertive
'
);
const
focusTracker
=
this
.
_register
(
DOM
.
trackFocus
(
this
.
inputBox
.
inputElement
));
this
.
_register
(
focusTracker
.
addFocusListener
(()
=>
this
.
_onFocus
.
fire
()));
...
...
@@ -514,11 +520,13 @@ export class SearchWidget extends Widget {
}
public
showMessage
(
message
:
string
,
count
:
number
):
void
{
this
.
countElement
.
textContent
=
message
;
this
.
inputBox
.
inputElement
.
setAttribute
(
'
aria-label
'
,
message
);
DOM
.
toggleClass
(
this
.
countElement
,
'
no-results
'
,
count
===
0
);
this
.
inputBox
.
inputElement
.
style
.
paddingRight
=
this
.
getControlsWidth
()
+
'
px
'
;
this
.
styleCountElementForeground
();
if
(
this
.
countElement
)
{
this
.
countElement
.
textContent
=
message
;
this
.
inputBox
.
inputElement
.
setAttribute
(
'
aria-label
'
,
message
);
DOM
.
toggleClass
(
this
.
countElement
,
'
no-results
'
,
count
===
0
);
this
.
inputBox
.
inputElement
.
style
.
paddingRight
=
this
.
getControlsWidth
()
+
'
px
'
;
this
.
styleCountElementForeground
();
}
}
public
setFuzzyToggleVisible
(
visible
:
boolean
):
void
{
...
...
@@ -539,16 +547,24 @@ export class SearchWidget extends Widget {
public
layout
(
dimension
:
Dimension
)
{
if
(
dimension
.
width
<
400
)
{
DOM
.
addClass
(
this
.
countElement
,
'
hide
'
);
if
(
this
.
countElement
)
{
DOM
.
addClass
(
this
.
countElement
,
'
hide
'
);
}
this
.
inputBox
.
inputElement
.
style
.
paddingRight
=
'
0px
'
;
}
else
{
DOM
.
removeClass
(
this
.
countElement
,
'
hide
'
);
if
(
this
.
countElement
)
{
DOM
.
removeClass
(
this
.
countElement
,
'
hide
'
);
}
this
.
inputBox
.
inputElement
.
style
.
paddingRight
=
this
.
getControlsWidth
()
+
'
px
'
;
}
}
private
getControlsWidth
():
number
{
return
DOM
.
getTotalWidth
(
this
.
countElement
)
+
DOM
.
getTotalWidth
(
this
.
fuzzyToggle
.
domNode
)
+
20
;
const
countWidth
=
this
.
countElement
?
DOM
.
getTotalWidth
(
this
.
countElement
)
:
0
;
const
fuzzyToggleWidth
=
this
.
fuzzyToggle
?
DOM
.
getTotalWidth
(
this
.
fuzzyToggle
.
domNode
)
:
0
;
return
countWidth
+
fuzzyToggleWidth
+
20
;
}
public
focus
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录