Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a34100d2
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,发现更多精彩内容 >>
提交
a34100d2
编写于
9月 25, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#57935 Show recording badge
上级
b96ac3e1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
21 deletion
+51
-21
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
.../workbench/parts/preferences/browser/keybindingsEditor.ts
+35
-4
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
...nch/parts/preferences/browser/media/keybindingsEditor.css
+16
-17
未找到文件。
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
浏览文件 @
a34100d2
...
...
@@ -36,7 +36,7 @@ import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector }
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
KeyCode
,
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
listHighlightForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
listHighlightForeground
,
badgeBackground
,
contrastBorder
,
badgeForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
EditorExtensionsRegistry
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
...
...
@@ -44,6 +44,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
KeybindingsEditorInput
}
from
'
vs/workbench/services/preferences/common/preferencesEditorInput
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
attachStylerCallback
}
from
'
vs/platform/theme/common/styler
'
;
let
$
=
DOM
.
$
;
...
...
@@ -127,7 +128,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
layout
(
dimension
:
DOM
.
Dimension
):
void
{
this
.
dimension
=
dimension
;
this
.
searchWidget
.
layou
t
(
dimension
);
this
.
layoutSearchWidge
t
(
dimension
);
this
.
overlayContainer
.
style
.
width
=
dimension
.
width
+
'
px
'
;
this
.
overlayContainer
.
style
.
height
=
dimension
.
height
+
'
px
'
;
...
...
@@ -300,7 +301,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private
createHeader
(
parent
:
HTMLElement
):
void
{
this
.
headerContainer
=
DOM
.
append
(
parent
,
$
(
'
.keybindings-header
'
));
const
fullTextSearchPlaceholder
=
localize
(
'
SearchKeybindings.FullTextSearchPlaceholder
'
,
"
Type to search in keybindings
"
);
const
keybindingsSearchPlaceholder
=
localize
(
'
SearchKeybindings.KeybindingsSearchPlaceholder
'
,
"
Type keybindings to search, p
ress Escape to exit
"
);
const
keybindingsSearchPlaceholder
=
localize
(
'
SearchKeybindings.KeybindingsSearchPlaceholder
'
,
"
Recording Keys. P
ress Escape to exit
"
);
const
searchContainer
=
DOM
.
append
(
this
.
headerContainer
,
$
(
'
.search-container
'
));
this
.
searchWidget
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
KeybindingsSearchWidget
,
searchContainer
,
<
KeybindingsSearchOptions
>
{
...
...
@@ -313,6 +314,9 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this
.
_register
(
this
.
searchWidget
.
onDidChange
(
searchValue
=>
this
.
delayedFiltering
.
trigger
(()
=>
this
.
filterKeybindings
())));
this
.
_register
(
this
.
searchWidget
.
onEscape
(()
=>
this
.
recordKeysAction
.
checked
=
false
));
const
actionsContainer
=
DOM
.
append
(
searchContainer
,
DOM
.
$
(
'
.keybindings-search-actions-container
'
));
const
recordingBadge
=
this
.
createRecordingBadge
(
actionsContainer
);
const
sortByPrecedenceActionKeybinding
=
this
.
keybindingsService
.
lookupKeybinding
(
KEYBINDINGS_EDITOR_COMMAND_SORTBY_PRECEDENCE
);
const
sortByPrecedenceActionLabel
=
localize
(
'
sortByPrecedeneLabel
'
,
"
Sort by Precedence
"
);
this
.
sortByPrecedenceAction
=
new
Action
(
'
keybindings.editor.sortByPrecedence
'
,
sortByPrecedenceActionKeybinding
?
localize
(
'
sortByPrecedeneLabelWithKeybinding
'
,
"
{0} ({1})
"
,
sortByPrecedenceActionLabel
,
sortByPrecedenceActionKeybinding
.
getLabel
())
:
sortByPrecedenceActionLabel
,
'
sort-by-precedence
'
);
...
...
@@ -329,6 +333,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this
.
recordKeysAction
.
checked
=
false
;
this
.
_register
(
this
.
recordKeysAction
.
onDidChange
(
e
=>
{
if
(
e
.
checked
!==
void
0
)
{
DOM
.
toggleClass
(
recordingBadge
,
'
disabled
'
,
!
e
.
checked
);
if
(
e
.
checked
)
{
this
.
searchWidget
.
inputBox
.
setPlaceHolder
(
keybindingsSearchPlaceholder
);
this
.
searchWidget
.
inputBox
.
setAriaLabel
(
keybindingsSearchPlaceholder
);
...
...
@@ -343,7 +348,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
}));
this
.
actionBar
=
this
.
_register
(
new
ActionBar
(
search
Container
,
{
this
.
actionBar
=
this
.
_register
(
new
ActionBar
(
actions
Container
,
{
animated
:
false
,
actionItemProvider
:
(
action
:
Action
)
=>
{
if
(
action
.
id
===
this
.
sortByPrecedenceAction
.
id
)
{
...
...
@@ -361,6 +366,32 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this
.
createOpenKeybindingsElement
(
this
.
headerContainer
);
}
private
createRecordingBadge
(
container
:
HTMLElement
):
HTMLElement
{
const
recordingBadge
=
DOM
.
append
(
container
,
DOM
.
$
(
'
.recording-badge.disabled
'
));
recordingBadge
.
textContent
=
localize
(
'
recording
'
,
"
Recording Keys
"
);
this
.
_register
(
attachStylerCallback
(
this
.
themeService
,
{
badgeBackground
,
contrastBorder
,
badgeForeground
},
colors
=>
{
const
background
=
colors
.
badgeBackground
?
colors
.
badgeBackground
.
toString
()
:
null
;
const
border
=
colors
.
contrastBorder
?
colors
.
contrastBorder
.
toString
()
:
null
;
const
color
=
colors
.
badgeForeground
?
colors
.
badgeForeground
.
toString
()
:
null
;
recordingBadge
.
style
.
backgroundColor
=
background
;
recordingBadge
.
style
.
borderWidth
=
border
?
'
1px
'
:
null
;
recordingBadge
.
style
.
borderStyle
=
border
?
'
solid
'
:
null
;
recordingBadge
.
style
.
borderColor
=
border
;
recordingBadge
.
style
.
color
=
color
?
color
.
toString
()
:
null
;
}));
return
recordingBadge
;
}
private
layoutSearchWidget
(
dimension
:
DOM
.
Dimension
):
void
{
this
.
searchWidget
.
layout
(
dimension
);
DOM
.
toggleClass
(
this
.
headerContainer
,
'
small
'
,
dimension
.
width
<
400
);
this
.
searchWidget
.
inputBox
.
inputElement
.
style
.
paddingRight
=
'
60px
'
;
if
(
dimension
.
width
>
400
&&
this
.
recordKeysAction
.
checked
)
{
this
.
searchWidget
.
inputBox
.
inputElement
.
style
.
paddingRight
=
'
180px
'
;
}
}
private
createOpenKeybindingsElement
(
parent
:
HTMLElement
):
void
{
const
openKeybindingsContainer
=
DOM
.
append
(
parent
,
$
(
'
.open-keybindings-container
'
));
DOM
.
append
(
openKeybindingsContainer
,
$
(
''
,
null
,
localize
(
'
header-message
'
,
"
For advanced customizations open and edit
"
)));
...
...
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
浏览文件 @
a34100d2
...
...
@@ -17,37 +17,36 @@
position
:
relative
;
}
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.
monaco-action-ba
r
{
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.
keybindings-search-actions-containe
r
{
position
:
absolute
;
top
:
0
;
right
:
10px
;
margin-top
:
5px
;
display
:
flex
;
}
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.monaco-action-bar
.action-item
{
width
:
28px
;
}
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.monaco-action-bar
.action-item
>
.sort-by-precedence
{
background
:
url('sort_precedence.svg')
center
center
no-repeat
;
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.keybindings-search-actions-container
>
.recording-badge
{
margin-right
:
8px
;
padding
:
0px
8px
;
border-radius
:
2px
;
}
.
hc-black
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.monaco-action-bar
.action-item
>
.sort-by-precedenc
e
,
.
vs-dark
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.monaco-action-bar
.action-item
>
.sort-by-precedence
{
background
:
url('sort_precedence_inverse.svg')
center
center
no-repeat
;
.
keybindings-editor
>
.keybindings-header.small
>
.search-container
>
.keybindings-search-actions-container
>
.recording-badg
e
,
.
keybindings-editor
>
.keybindings-header
>
.search-container
>
.keybindings-search-actions-container
>
.recording-badge.disabled
{
display
:
none
;
}
.keybindings-editor
>
.keybindings-header
.search-container
>
.settings-search-input
{
vertical-align
:
middle
;
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.keybindings-search-actions-container
>
.monaco-action-bar
.action-item
{
margin-right
:
4px
;
}
.keybindings-editor
>
.keybindings-header
.search-container
>
.settings-search-input
>
.monaco-inputbox
{
height
:
30px
;
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.keybindings-search-actions-container
>
.monaco-action-bar
.action-item
>
.sort-by-precedence
{
background
:
url('sort_precedence.svg')
center
center
no-repeat
;
}
.
keybindings-editor
>
.keybindings-header
.search-container
>
.settings-search-input
>
.monaco-inputbox
.input
{
font-size
:
14px
;
padding-left
:
10px
;
.
hc-black
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.keybindings-search-actions-container
>
.monaco-action-bar
.action-item
>
.sort-by-precedence
,
.vs-dark
.keybindings-editor
>
.keybindings-header
>
.search-container
>
.keybindings-search-actions-container
>
.monaco-action-bar
.action-item
>
.sort-by-precedence
{
background
:
url('sort_precedence_inverse.svg')
center
center
no-repeat
;
}
.keybindings-editor
>
.keybindings-header
.open-keybindings-container
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录