Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
44f9a685
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,发现更多精彩内容 >>
提交
44f9a685
编写于
1月 17, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Welcome: Improve "keyboard tips" visual presentation (fixes #64901)
上级
6c570ec9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
52 deletion
+32
-52
src/vs/base/browser/ui/keybindingLabel/keybindingLabel.ts
src/vs/base/browser/ui/keybindingLabel/keybindingLabel.ts
+12
-5
src/vs/base/parts/quickopen/browser/quickOpenModel.ts
src/vs/base/parts/quickopen/browser/quickOpenModel.ts
+1
-2
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
...ench/parts/extensions/electron-browser/extensionEditor.ts
+1
-1
src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts
.../workbench/parts/preferences/browser/keybindingWidgets.ts
+2
-2
src/vs/workbench/parts/watermark/electron-browser/watermark.css
.../workbench/parts/watermark/electron-browser/watermark.css
+0
-19
src/vs/workbench/parts/watermark/electron-browser/watermark.ts
...s/workbench/parts/watermark/electron-browser/watermark.ts
+16
-23
未找到文件。
src/vs/base/browser/ui/keybindingLabel/keybindingLabel.ts
浏览文件 @
44f9a685
...
@@ -4,12 +4,12 @@
...
@@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./keybindingLabel
'
;
import
'
vs/css!./keybindingLabel
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
equals
}
from
'
vs/base/common/objects
'
;
import
{
equals
}
from
'
vs/base/common/objects
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
ResolvedKeybinding
,
ResolvedKeybindingPart
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
ResolvedKeybindingPart
}
from
'
vs/base/common/keyCodes
'
;
import
{
UILabelProvider
}
from
'
vs/base/common/keybindingLabels
'
;
import
{
UILabelProvider
}
from
'
vs/base/common/keybindingLabels
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
localize
}
from
'
vs/nls
'
;
const
$
=
dom
.
$
;
const
$
=
dom
.
$
;
...
@@ -26,14 +26,18 @@ export interface Matches {
...
@@ -26,14 +26,18 @@ export interface Matches {
chordPart
:
PartMatches
;
chordPart
:
PartMatches
;
}
}
export
class
KeybindingLabel
implements
IDisposable
{
export
interface
KeybindingLabelOptions
{
renderUnboundKeybindings
:
boolean
;
}
export
class
KeybindingLabel
{
private
domNode
:
HTMLElement
;
private
domNode
:
HTMLElement
;
private
keybinding
:
ResolvedKeybinding
;
private
keybinding
:
ResolvedKeybinding
;
private
matches
:
Matches
;
private
matches
:
Matches
;
private
didEverRender
:
boolean
;
private
didEverRender
:
boolean
;
constructor
(
container
:
HTMLElement
,
private
os
:
OperatingSystem
)
{
constructor
(
container
:
HTMLElement
,
private
os
:
OperatingSystem
,
private
options
?:
KeybindingLabelOptions
)
{
this
.
domNode
=
dom
.
append
(
container
,
$
(
'
.monaco-keybinding
'
));
this
.
domNode
=
dom
.
append
(
container
,
$
(
'
.monaco-keybinding
'
));
this
.
didEverRender
=
false
;
this
.
didEverRender
=
false
;
container
.
appendChild
(
this
.
domNode
);
container
.
appendChild
(
this
.
domNode
);
...
@@ -43,7 +47,7 @@ export class KeybindingLabel implements IDisposable {
...
@@ -43,7 +47,7 @@ export class KeybindingLabel implements IDisposable {
return
this
.
domNode
;
return
this
.
domNode
;
}
}
set
(
keybinding
:
ResolvedKeybinding
,
matches
:
Matches
)
{
set
(
keybinding
:
ResolvedKeybinding
,
matches
?
:
Matches
)
{
if
(
this
.
didEverRender
&&
this
.
keybinding
===
keybinding
&&
KeybindingLabel
.
areSame
(
this
.
matches
,
matches
))
{
if
(
this
.
didEverRender
&&
this
.
keybinding
===
keybinding
&&
KeybindingLabel
.
areSame
(
this
.
matches
,
matches
))
{
return
;
return
;
}
}
...
@@ -66,6 +70,8 @@ export class KeybindingLabel implements IDisposable {
...
@@ -66,6 +70,8 @@ export class KeybindingLabel implements IDisposable {
this
.
renderPart
(
this
.
domNode
,
chordPart
,
this
.
matches
?
this
.
matches
.
chordPart
:
null
);
this
.
renderPart
(
this
.
domNode
,
chordPart
,
this
.
matches
?
this
.
matches
.
chordPart
:
null
);
}
}
this
.
domNode
.
title
=
this
.
keybinding
.
getAriaLabel
()
||
''
;
this
.
domNode
.
title
=
this
.
keybinding
.
getAriaLabel
()
||
''
;
}
else
if
(
this
.
options
&&
this
.
options
.
renderUnboundKeybindings
)
{
this
.
renderUnbound
(
this
.
domNode
);
}
}
this
.
didEverRender
=
true
;
this
.
didEverRender
=
true
;
...
@@ -98,7 +104,8 @@ export class KeybindingLabel implements IDisposable {
...
@@ -98,7 +104,8 @@ export class KeybindingLabel implements IDisposable {
}
}
}
}
dispose
()
{
private
renderUnbound
(
parent
:
HTMLElement
):
void
{
dom
.
append
(
parent
,
$
(
'
span.monaco-keybinding-key
'
,
undefined
,
localize
(
'
unbound
'
,
"
Unbound
"
)));
}
}
private
static
areSame
(
a
:
Matches
,
b
:
Matches
):
boolean
{
private
static
areSame
(
a
:
Matches
,
b
:
Matches
):
boolean
{
...
...
src/vs/base/parts/quickopen/browser/quickOpenModel.ts
浏览文件 @
44f9a685
...
@@ -474,7 +474,7 @@ class Renderer implements IRenderer<QuickOpenEntry> {
...
@@ -474,7 +474,7 @@ class Renderer implements IRenderer<QuickOpenEntry> {
data
.
detail
.
set
(
entry
.
getDetail
(),
detailHighlights
);
data
.
detail
.
set
(
entry
.
getDetail
(),
detailHighlights
);
// Keybinding
// Keybinding
data
.
keybinding
.
set
(
entry
.
getKeybinding
()
,
null
);
data
.
keybinding
.
set
(
entry
.
getKeybinding
());
}
}
}
}
...
@@ -484,7 +484,6 @@ class Renderer implements IRenderer<QuickOpenEntry> {
...
@@ -484,7 +484,6 @@ class Renderer implements IRenderer<QuickOpenEntry> {
data
.
actionBar
=
null
;
data
.
actionBar
=
null
;
data
.
container
=
null
;
data
.
container
=
null
;
data
.
entry
=
null
;
data
.
entry
=
null
;
data
.
keybinding
.
dispose
();
data
.
keybinding
=
null
;
data
.
keybinding
=
null
;
data
.
detail
.
dispose
();
data
.
detail
.
dispose
();
data
.
detail
=
null
;
data
.
detail
=
null
;
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
浏览文件 @
44f9a685
...
@@ -999,7 +999,7 @@ export class ExtensionEditor extends BaseEditor {
...
@@ -999,7 +999,7 @@ export class ExtensionEditor extends BaseEditor {
const
renderKeybinding
=
(
keybinding
:
ResolvedKeybinding
):
HTMLElement
=>
{
const
renderKeybinding
=
(
keybinding
:
ResolvedKeybinding
):
HTMLElement
=>
{
const
element
=
$
(
''
);
const
element
=
$
(
''
);
new
KeybindingLabel
(
element
,
OS
).
set
(
keybinding
,
null
);
new
KeybindingLabel
(
element
,
OS
).
set
(
keybinding
);
return
element
;
return
element
;
};
};
...
...
src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts
浏览文件 @
44f9a685
...
@@ -257,10 +257,10 @@ export class DefineKeybindingWidget extends Widget {
...
@@ -257,10 +257,10 @@ export class DefineKeybindingWidget extends Widget {
this
.
_chordPart
=
chordPart
;
this
.
_chordPart
=
chordPart
;
dom
.
clearNode
(
this
.
_outputNode
);
dom
.
clearNode
(
this
.
_outputNode
);
dom
.
clearNode
(
this
.
_showExistingKeybindingsNode
);
dom
.
clearNode
(
this
.
_showExistingKeybindingsNode
);
new
KeybindingLabel
(
this
.
_outputNode
,
OS
).
set
(
this
.
_firstPart
,
null
);
new
KeybindingLabel
(
this
.
_outputNode
,
OS
).
set
(
this
.
_firstPart
);
if
(
this
.
_chordPart
)
{
if
(
this
.
_chordPart
)
{
this
.
_outputNode
.
appendChild
(
document
.
createTextNode
(
nls
.
localize
(
'
defineKeybinding.chordsTo
'
,
"
chord to
"
)));
this
.
_outputNode
.
appendChild
(
document
.
createTextNode
(
nls
.
localize
(
'
defineKeybinding.chordsTo
'
,
"
chord to
"
)));
new
KeybindingLabel
(
this
.
_outputNode
,
OS
).
set
(
this
.
_chordPart
,
null
);
new
KeybindingLabel
(
this
.
_outputNode
,
OS
).
set
(
this
.
_chordPart
);
}
}
const
label
=
this
.
getUserSettingsLabel
();
const
label
=
this
.
getUserSettingsLabel
();
if
(
label
)
{
if
(
label
)
{
...
...
src/vs/workbench/parts/watermark/electron-browser/watermark.css
浏览文件 @
44f9a685
...
@@ -50,25 +50,6 @@
...
@@ -50,25 +50,6 @@
text-align
:
left
;
text-align
:
left
;
}
}
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dd
>
.shortcuts
{
padding-left
:
0.5em
;
padding-right
:
0.5em
;
}
.mac
>
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dd
>
.shortcuts
{
letter-spacing
:
0.15em
;
font-family
:
"Lucida Grande"
,
sans-serif
;
}
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dd
>
.unbound
{
padding-left
:
0.5em
;
padding-right
:
0.5em
;
}
.mac
>
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dd
>
.unbound
{
font-family
:
"Lucida Grande"
,
sans-serif
;
}
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dt
,
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dt
,
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dd
{
.monaco-workbench
>
.part.editor
>
.content.empty
>
.watermark
dd
{
display
:
table-cell
;
display
:
table-cell
;
...
...
src/vs/workbench/parts/watermark/electron-browser/watermark.ts
浏览文件 @
44f9a685
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import
'
vs/css!./watermark
'
;
import
'
vs/css!./watermark
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
isMacintosh
,
OS
}
from
'
vs/base/common/platform
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
...
@@ -22,63 +22,63 @@ import { ShowAllCommandsAction } from 'vs/workbench/parts/quickopen/browser/comm
...
@@ -22,63 +22,63 @@ import { ShowAllCommandsAction } from 'vs/workbench/parts/quickopen/browser/comm
import
{
Parts
,
IPartService
,
IDimension
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
Parts
,
IPartService
,
IDimension
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
StartAction
}
from
'
vs/workbench/parts/debug/browser/debugActions
'
;
import
{
StartAction
}
from
'
vs/workbench/parts/debug/browser/debugActions
'
;
import
{
FindInFilesActionId
}
from
'
vs/workbench/parts/search/common/constants
'
;
import
{
FindInFilesActionId
}
from
'
vs/workbench/parts/search/common/constants
'
;
import
{
escape
}
from
'
vs/base/common/strings
'
;
import
{
QUICKOPEN_ACTION_ID
}
from
'
vs/workbench/browser/parts/quickopen/quickopen
'
;
import
{
QUICKOPEN_ACTION_ID
}
from
'
vs/workbench/browser/parts/quickopen/quickopen
'
;
import
{
TERMINAL_COMMAND_ID
}
from
'
vs/workbench/parts/terminal/common/terminalCommands
'
;
import
{
TERMINAL_COMMAND_ID
}
from
'
vs/workbench/parts/terminal/common/terminalCommands
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
KeybindingLabel
}
from
'
vs/base/browser/ui/keybindingLabel/keybindingLabel
'
;
const
$
=
dom
.
$
;
const
$
=
dom
.
$
;
interface
WatermarkEntry
{
interface
WatermarkEntry
{
text
:
string
;
text
:
string
;
id
s
:
string
[]
;
id
:
string
;
mac
?:
boolean
;
mac
?:
boolean
;
}
}
const
showCommands
:
WatermarkEntry
=
{
const
showCommands
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.showCommands
'
,
"
Show All Commands
"
),
text
:
nls
.
localize
(
'
watermark.showCommands
'
,
"
Show All Commands
"
),
id
s
:
[
ShowAllCommandsAction
.
ID
]
id
:
ShowAllCommandsAction
.
ID
};
};
const
quickOpen
:
WatermarkEntry
=
{
const
quickOpen
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.quickOpen
'
,
"
Go to File
"
),
text
:
nls
.
localize
(
'
watermark.quickOpen
'
,
"
Go to File
"
),
id
s
:
[
QUICKOPEN_ACTION_ID
]
id
:
QUICKOPEN_ACTION_ID
};
};
const
openFileNonMacOnly
:
WatermarkEntry
=
{
const
openFileNonMacOnly
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.openFile
'
,
"
Open File
"
),
text
:
nls
.
localize
(
'
watermark.openFile
'
,
"
Open File
"
),
id
s
:
[
OpenFileAction
.
ID
]
,
id
:
OpenFileAction
.
ID
,
mac
:
false
mac
:
false
};
};
const
openFolderNonMacOnly
:
WatermarkEntry
=
{
const
openFolderNonMacOnly
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.openFolder
'
,
"
Open Folder
"
),
text
:
nls
.
localize
(
'
watermark.openFolder
'
,
"
Open Folder
"
),
id
s
:
[
OpenFolderAction
.
ID
]
,
id
:
OpenFolderAction
.
ID
,
mac
:
false
mac
:
false
};
};
const
openFileOrFolderMacOnly
:
WatermarkEntry
=
{
const
openFileOrFolderMacOnly
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.openFileFolder
'
,
"
Open File or Folder
"
),
text
:
nls
.
localize
(
'
watermark.openFileFolder
'
,
"
Open File or Folder
"
),
id
s
:
[
OpenFileFolderAction
.
ID
]
,
id
:
OpenFileFolderAction
.
ID
,
mac
:
true
mac
:
true
};
};
const
openRecent
:
WatermarkEntry
=
{
const
openRecent
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.openRecent
'
,
"
Open Recent
"
),
text
:
nls
.
localize
(
'
watermark.openRecent
'
,
"
Open Recent
"
),
id
s
:
[
OpenRecentAction
.
ID
]
id
:
OpenRecentAction
.
ID
};
};
const
newUntitledFile
:
WatermarkEntry
=
{
const
newUntitledFile
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.newUntitledFile
'
,
"
New Untitled File
"
),
text
:
nls
.
localize
(
'
watermark.newUntitledFile
'
,
"
New Untitled File
"
),
id
s
:
[
GlobalNewUntitledFileAction
.
ID
]
id
:
GlobalNewUntitledFileAction
.
ID
};
};
const
newUntitledFileMacOnly
:
WatermarkEntry
=
assign
({
mac
:
true
},
newUntitledFile
);
const
newUntitledFileMacOnly
:
WatermarkEntry
=
assign
({
mac
:
true
},
newUntitledFile
);
const
toggleTerminal
:
WatermarkEntry
=
{
const
toggleTerminal
:
WatermarkEntry
=
{
text
:
nls
.
localize
({
key
:
'
watermark.toggleTerminal
'
,
comment
:
[
'
toggle is a verb here
'
]
},
"
Toggle Terminal
"
),
text
:
nls
.
localize
({
key
:
'
watermark.toggleTerminal
'
,
comment
:
[
'
toggle is a verb here
'
]
},
"
Toggle Terminal
"
),
id
s
:
[
TERMINAL_COMMAND_ID
.
TOGGLE
]
id
:
TERMINAL_COMMAND_ID
.
TOGGLE
};
};
const
findInFiles
:
WatermarkEntry
=
{
const
findInFiles
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.findInFiles
'
,
"
Find in Files
"
),
text
:
nls
.
localize
(
'
watermark.findInFiles
'
,
"
Find in Files
"
),
id
s
:
[
FindInFilesActionId
]
id
:
FindInFilesActionId
};
};
const
startDebugging
:
WatermarkEntry
=
{
const
startDebugging
:
WatermarkEntry
=
{
text
:
nls
.
localize
(
'
watermark.startDebugging
'
,
"
Start Debugging
"
),
text
:
nls
.
localize
(
'
watermark.startDebugging
'
,
"
Start Debugging
"
),
id
s
:
[
StartAction
.
ID
]
id
:
StartAction
.
ID
};
};
const
noFolderEntries
=
[
const
noFolderEntries
=
[
...
@@ -98,7 +98,6 @@ const folderEntries = [
...
@@ -98,7 +98,6 @@ const folderEntries = [
toggleTerminal
toggleTerminal
];
];
const
UNBOUND
=
nls
.
localize
(
'
watermark.unboundCommand
'
,
"
unbound
"
);
const
WORKBENCH_TIPS_ENABLED_KEY
=
'
workbench.tips.enabled
'
;
const
WORKBENCH_TIPS_ENABLED_KEY
=
'
workbench.tips.enabled
'
;
export
class
WatermarkContribution
implements
IWorkbenchContribution
{
export
class
WatermarkContribution
implements
IWorkbenchContribution
{
...
@@ -161,15 +160,9 @@ export class WatermarkContribution implements IWorkbenchContribution {
...
@@ -161,15 +160,9 @@ export class WatermarkContribution implements IWorkbenchContribution {
const
dt
=
dom
.
append
(
dl
,
$
(
'
dt
'
));
const
dt
=
dom
.
append
(
dl
,
$
(
'
dt
'
));
dt
.
textContent
=
entry
.
text
;
dt
.
textContent
=
entry
.
text
;
const
dd
=
dom
.
append
(
dl
,
$
(
'
dd
'
));
const
dd
=
dom
.
append
(
dl
,
$
(
'
dd
'
));
dd
.
innerHTML
=
entry
.
ids
const
keybinding
=
new
KeybindingLabel
(
dd
,
OS
,
{
renderUnboundKeybindings
:
true
});
.
map
(
id
=>
{
keybinding
.
set
(
this
.
keybindingService
.
lookupKeybinding
(
entry
.
id
));
let
k
=
this
.
keybindingService
.
lookupKeybinding
(
id
);
dd
.
innerHTML
=
keybinding
.
element
.
outerHTML
;
if
(
k
)
{
return
`<span class="shortcuts">
${
escape
(
k
.
getLabel
())}
</span>`
;
}
return
`<span class="unbound">
${
escape
(
UNBOUND
)}
</span>`
;
})
.
join
(
'
/
'
);
});
});
};
};
update
();
update
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录