Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7d840a33
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,发现更多精彩内容 >>
提交
7d840a33
编写于
2月 08, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more list/tree commands (for #11517)
上级
7a5b24d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
183 addition
and
13 deletion
+183
-13
src/vs/base/parts/tree/browser/treeDefaults.ts
src/vs/base/parts/tree/browser/treeDefaults.ts
+11
-11
src/vs/workbench/electron-browser/commands.ts
src/vs/workbench/electron-browser/commands.ts
+172
-2
未找到文件。
src/vs/base/parts/tree/browser/treeDefaults.ts
浏览文件 @
7d840a33
...
...
@@ -139,6 +139,8 @@ export class DefaultController implements _.IController {
this
.
options
=
options
;
this
.
downKeyBindingDispatcher
=
new
KeybindingDispatcher
();
this
.
upKeyBindingDispatcher
=
new
KeybindingDispatcher
();
if
(
typeof
options
.
keyboardSupport
!==
'
boolean
'
||
options
.
keyboardSupport
)
{
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
UpArrow
,
(
t
,
e
)
=>
this
.
onUp
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
DownArrow
,
(
t
,
e
)
=>
this
.
onDown
(
t
,
e
));
...
...
@@ -147,19 +149,17 @@ export class DefaultController implements _.IController {
if
(
platform
.
isMacintosh
)
{
this
.
downKeyBindingDispatcher
.
set
(
KeyMod
.
CtrlCmd
|
KeyCode
.
UpArrow
,
(
t
,
e
)
=>
this
.
onLeft
(
t
,
e
));
}
}
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
PageUp
,
(
t
,
e
)
=>
this
.
onPageUp
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
PageDown
,
(
t
,
e
)
=>
this
.
onPageDown
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
Home
,
(
t
,
e
)
=>
this
.
onHome
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
End
,
(
t
,
e
)
=>
this
.
onEnd
(
t
,
e
));
// TODO@Ben adopt more keybindings as configurable commands
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
Space
,
(
t
,
e
)
=>
this
.
onSpace
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
PageUp
,
(
t
,
e
)
=>
this
.
onPageUp
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
PageDown
,
(
t
,
e
)
=>
this
.
onPageDown
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
Escape
,
(
t
,
e
)
=>
this
.
onEscape
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
Home
,
(
t
,
e
)
=>
this
.
onHome
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
End
,
(
t
,
e
)
=>
this
.
onEnd
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
Space
,
(
t
,
e
)
=>
this
.
onSpace
(
t
,
e
));
this
.
downKeyBindingDispatcher
.
set
(
KeyCode
.
Escape
,
(
t
,
e
)
=>
this
.
onEscape
(
t
,
e
));
this
.
upKeyBindingDispatcher
=
new
KeybindingDispatcher
(
);
this
.
upKeyBindingDispatcher
.
set
(
KeyCode
.
Enter
,
this
.
onEnter
.
bind
(
this
));
this
.
upKeyBindingDispatcher
.
set
(
KeyMod
.
CtrlCmd
|
KeyCode
.
Enter
,
this
.
onEnter
.
bind
(
this
));
this
.
upKeyBindingDispatcher
.
set
(
KeyCode
.
Enter
,
this
.
onEnter
.
bind
(
this
)
);
this
.
upKeyBindingDispatcher
.
set
(
KeyMod
.
CtrlCmd
|
KeyCode
.
Enter
,
this
.
onEnter
.
bind
(
this
));
}
}
public
onMouseDown
(
tree
:
_
.
ITree
,
element
:
any
,
event
:
mouse
.
IMouseEvent
,
origin
:
string
=
'
mouse
'
):
boolean
{
...
...
src/vs/workbench/electron-browser/commands.ts
浏览文件 @
7d840a33
...
...
@@ -90,7 +90,7 @@ export function registerCommands(): void {
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.
left
'
,
id
:
'
list.
collapse
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
LeftArrow
,
...
...
@@ -121,7 +121,7 @@ export function registerCommands(): void {
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.
right
'
,
id
:
'
list.
expand
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
RightArrow
,
...
...
@@ -147,6 +147,176 @@ export function registerCommands(): void {
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.pageUp
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
PageUp
,
handler
:
(
accessor
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
focused
=
listService
.
getFocused
();
// List
if
(
focused
instanceof
List
)
{
const
list
=
focused
;
list
.
focusPreviousPage
();
list
.
reveal
(
list
.
getFocus
()[
0
]);
}
// Tree
else
if
(
focused
)
{
const
tree
=
focused
;
tree
.
focusPreviousPage
({
origin
:
'
keyboard
'
});
tree
.
reveal
(
tree
.
getFocus
()).
done
(
null
,
errors
.
onUnexpectedError
);
}
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.pageDown
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
PageDown
,
handler
:
(
accessor
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
focused
=
listService
.
getFocused
();
// List
if
(
focused
instanceof
List
)
{
const
list
=
focused
;
list
.
focusNextPage
();
list
.
reveal
(
list
.
getFocus
()[
0
]);
}
// Tree
else
if
(
focused
)
{
const
tree
=
focused
;
tree
.
focusNextPage
({
origin
:
'
keyboard
'
});
tree
.
reveal
(
tree
.
getFocus
()).
done
(
null
,
errors
.
onUnexpectedError
);
}
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.first
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
Home
,
handler
:
(
accessor
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
focused
=
listService
.
getFocused
();
// Tree only
if
(
!
(
focused
instanceof
List
))
{
const
tree
=
focused
;
tree
.
focusFirst
({
origin
:
'
keyboard
'
});
tree
.
reveal
(
tree
.
getFocus
()).
done
(
null
,
errors
.
onUnexpectedError
);
}
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.last
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
End
,
handler
:
(
accessor
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
focused
=
listService
.
getFocused
();
// Tree only
if
(
!
(
focused
instanceof
List
))
{
const
tree
=
focused
;
tree
.
focusLast
({
origin
:
'
keyboard
'
});
tree
.
reveal
(
tree
.
getFocus
()).
done
(
null
,
errors
.
onUnexpectedError
);
}
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.select
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
Enter
,
secondary
:
[
KeyMod
.
CtrlCmd
|
KeyCode
.
Enter
],
handler
:
(
accessor
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
focused
=
listService
.
getFocused
();
// List
if
(
focused
instanceof
List
)
{
const
list
=
focused
;
list
.
setSelection
(
list
.
getFocus
());
}
// Tree
else
if
(
focused
)
{
const
tree
=
focused
;
const
focus
=
tree
.
getFocus
();
if
(
focus
)
{
tree
.
setSelection
([
focus
],
{
origin
:
'
keyboard
'
});
}
}
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.toggleExpand
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
Space
,
handler
:
(
accessor
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
focused
=
listService
.
getFocused
();
// Tree only
if
(
!
(
focused
instanceof
List
))
{
const
tree
=
focused
;
const
focus
=
tree
.
getFocus
();
if
(
focus
)
{
tree
.
toggleExpansion
(
focus
);
}
}
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
list.clear
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ListFocusContext
,
primary
:
KeyCode
.
Escape
,
handler
:
(
accessor
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
focused
=
listService
.
getFocused
();
// Tree only
if
(
!
(
focused
instanceof
List
))
{
const
tree
=
focused
;
if
(
tree
.
getSelection
().
length
)
{
tree
.
clearSelection
({
origin
:
'
keyboard
'
});
return
void
0
;
}
if
(
tree
.
getFocus
())
{
tree
.
clearFocus
({
origin
:
'
keyboard
'
});
return
void
0
;
}
}
}
});
// --- commands
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录