Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
537b5bbc
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,发现更多精彩内容 >>
提交
537b5bbc
编写于
8月 24, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extension editor: improve keybindings
上级
4c1bb8b8
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
47 addition
and
17 deletion
+47
-17
src/vs/base/browser/dom.ts
src/vs/base/browser/dom.ts
+21
-3
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+2
-2
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
...ench/parts/extensions/electron-browser/extensionEditor.ts
+22
-10
src/vs/workbench/parts/extensions/electron-browser/media/extensionEditor.css
...rts/extensions/electron-browser/media/extensionEditor.css
+2
-2
未找到文件。
src/vs/base/browser/dom.ts
浏览文件 @
537b5bbc
...
...
@@ -944,7 +944,7 @@ export function prepend<T extends Node>(parent: HTMLElement, child: T): T {
const
SELECTOR_REGEX
=
/
([\w\-]
+
)?(
#
([\w\-]
+
))?((
.
([\w\-]
+
))
*
)
/
;
// Similar to builder, but much more lightweight
export
function
$
<
T
extends
HTMLElement
>
(
description
:
string
,
attrs
?:
{
[
key
:
string
]:
any
;
},
...
children
:
(
HTMLElement
|
string
)[]):
T
{
export
function
$
<
T
extends
HTMLElement
>
(
description
:
string
,
attrs
?:
{
[
key
:
string
]:
any
;
},
...
children
:
(
Node
|
string
)[]):
T
{
let
match
=
SELECTOR_REGEX
.
exec
(
description
);
if
(
!
match
)
{
...
...
@@ -964,16 +964,34 @@ export function $<T extends HTMLElement>(description: string, attrs?: { [key: st
.
forEach
(
name
=>
result
.
setAttribute
(
name
,
attrs
[
name
]));
children
.
forEach
(
child
=>
{
if
(
child
instanceof
HTMLElement
)
{
if
(
child
instanceof
Node
)
{
result
.
appendChild
(
child
);
}
else
{
result
.
appendChild
(
document
.
createTextNode
(
child
));
result
.
appendChild
(
document
.
createTextNode
(
child
as
string
));
}
});
return
result
as
T
;
}
export
function
join
(
nodes
:
Node
[],
separator
:
Node
|
string
):
Node
[]
{
const
result
:
Node
[]
=
[];
nodes
.
forEach
((
node
,
index
)
=>
{
if
(
index
>
0
)
{
if
(
separator
instanceof
Node
)
{
result
.
push
(
separator
.
cloneNode
());
}
else
{
result
.
push
(
document
.
createTextNode
(
separator
));
}
}
result
.
push
(
node
);
});
return
result
;
}
export
function
show
(...
elements
:
HTMLElement
[]):
void
{
for
(
let
element
of
elements
)
{
element
.
style
.
display
=
''
;
...
...
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
537b5bbc
...
...
@@ -41,7 +41,7 @@ export interface IJSONValidation {
fileMatch
:
string
;
}
export
interface
IKeyBinding
s
{
export
interface
IKeyBinding
{
command
:
string
;
key
:
string
;
when
?:
string
;
...
...
@@ -77,7 +77,7 @@ export interface IExtensionContributions {
debuggers
?:
IDebugger
[];
grammars
?:
IGrammar
[];
jsonValidation
?:
IJSONValidation
[];
keybindings
?:
IKeyBinding
s
[];
keybindings
?:
IKeyBinding
[];
languages
?:
ILanguage
[];
menus
?:
{
[
context
:
string
]:
IMenu
[]
};
snippets
?:
ISnippet
[];
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
浏览文件 @
537b5bbc
...
...
@@ -18,13 +18,13 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import
{
IDisposable
,
empty
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Builder
}
from
'
vs/base/browser/builder
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
append
,
$
,
addClass
,
removeClass
,
finalHandler
}
from
'
vs/base/browser/dom
'
;
import
{
append
,
$
,
addClass
,
removeClass
,
finalHandler
,
join
}
from
'
vs/base/browser/dom
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/common/viewletService
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtensionGalleryService
,
IExtensionManifest
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IExtensionGalleryService
,
IExtensionManifest
,
IKeyBinding
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
ExtensionsInput
}
from
'
./extensionsInput
'
;
import
{
IExtensionsWorkbenchService
,
IExtensionsViewlet
,
VIEWLET_ID
,
IExtension
}
from
'
./extensions
'
;
...
...
@@ -385,17 +385,16 @@ export class ExtensionEditor extends BaseEditor {
const
rawKeybindings
=
manifest
.
contributes
.
keybindings
||
[];
rawKeybindings
.
forEach
(
userString
=>
{
let
command
=
allCommands
[
userString
.
command
];
const
keybinding
=
new
Keybinding
(
Keybinding
.
fromUserSettingsLabel
(
userString
.
key
));
const
key
=
this
.
keybindingService
.
getLabelFor
(
keybinding
);
rawKeybindings
.
forEach
(
rawKeybinding
=>
{
const
keyLabel
=
this
.
keybindingToLabel
(
rawKeybinding
);
let
command
=
allCommands
[
rawKeybinding
.
command
];
if
(
!
command
)
{
command
=
{
id
:
userString
.
command
,
title
:
''
,
keybindings
:
[
key
],
menus
:
[]
};
command
=
{
id
:
rawKeybinding
.
command
,
title
:
''
,
keybindings
:
[
keyLabel
],
menus
:
[]
};
allCommands
[
command
.
id
]
=
command
;
commands
.
push
(
command
);
}
else
{
command
.
keybindings
.
push
(
key
);
command
.
keybindings
.
push
(
key
Label
);
}
});
...
...
@@ -413,15 +412,28 @@ export class ExtensionEditor extends BaseEditor {
$
(
'
th
'
,
null
,
localize
(
'
menuContexts
'
,
"
Menu Contexts
"
))
),
...
commands
.
map
(
c
=>
$
(
'
tr
'
,
null
,
$
(
'
td
'
,
null
,
c
.
id
),
$
(
'
td
'
,
null
,
$
(
'
code
'
,
null
,
c
.
id
)
),
$
(
'
td
'
,
null
,
c
.
title
),
$
(
'
td
'
,
null
,
...
c
.
keybindings
.
map
(
keybinding
=>
$
(
'
code
'
,
null
,
keybinding
)
)),
$
(
'
td
'
,
null
,
...
join
(
c
.
keybindings
.
map
(
keybinding
=>
$
(
'
code
'
,
null
,
keybinding
)),
'
'
)),
$
(
'
td
'
,
null
,
...
c
.
menus
.
map
(
context
=>
$
(
'
code
'
,
null
,
context
)))
))
)
));
}
private
keybindingToLabel
(
rawKeyBinding
:
IKeyBinding
):
string
{
let
key
:
string
;
switch
(
process
.
platform
)
{
case
'
win32
'
:
key
=
rawKeyBinding
.
win
;
break
;
case
'
linux
'
:
key
=
rawKeyBinding
.
linux
;
break
;
case
'
darwin
'
:
key
=
rawKeyBinding
.
mac
;
break
;
}
const
keyBinding
=
new
Keybinding
(
Keybinding
.
fromUserSettingsLabel
(
key
||
rawKeyBinding
.
key
));
return
this
.
keybindingService
.
getLabelFor
(
keyBinding
);
}
private
loadContents
(
loadingTask
:
()
=>
TPromise
<
any
>
):
void
{
this
.
contentDisposables
=
dispose
(
this
.
contentDisposables
);
...
...
src/vs/workbench/parts/extensions/electron-browser/media/extensionEditor.css
浏览文件 @
537b5bbc
...
...
@@ -192,7 +192,7 @@
.extension-editor
>
.body
>
.content
table
code
{
font-family
:
Monaco
,
Menlo
,
Consolas
,
"Droid Sans Mono"
,
"Inconsolata"
,
"Courier New"
,
monospace
,
"Droid Sans Fallback"
;
font-size
:
8
0%
;
font-size
:
9
0%
;
background-color
:
rgba
(
128
,
128
,
128
,
0.17
);
border-radius
:
4px
;
padding
:
1px
4px
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录