Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
549478a0
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,发现更多精彩内容 >>
提交
549478a0
编写于
6月 10, 2016
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add focusNext, focusPrevious commands, remove conflicting keybinding
上级
099352bc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
93 addition
and
11 deletion
+93
-11
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+9
-10
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
+2
-0
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+34
-0
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
...orkbench/parts/terminal/electron-browser/terminalPanel.ts
+22
-1
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+26
-0
未找到文件。
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
549478a0
...
...
@@ -10,7 +10,7 @@ import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actionRegistry
'
;
import
{
TerminalService
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalService
'
;
import
{
CloseTerminalAction
,
CreateNewTerminalAction
,
FocusTerminalAction
,
ToggleTerminalAction
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
CloseTerminalAction
,
CreateNewTerminalAction
,
FocusTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
ToggleTerminalAction
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
ITerminalService
,
TERMINAL_PANEL_ID
,
TERMINAL_DEFAULT_SHELL_LINUX
,
TERMINAL_DEFAULT_SHELL_OSX
,
TERMINAL_DEFAULT_SHELL_WINDOWS
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
import
*
as
panel
from
'
vs/workbench/browser/panel
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
...
...
@@ -91,16 +91,15 @@ registerSingleton(ITerminalService, TerminalService);
// On mac cmd+` is reserved to cycle between windows, that's why the keybindings use WinCtrl
let
actionRegistry
=
<
IWorkbenchActionRegistry
>
Registry
.
as
(
ActionExtensions
.
WorkbenchActions
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ToggleTerminalAction
,
ToggleTerminalAction
.
ID
,
ToggleTerminalAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
US_BACKTICK
,
mac
:
{
primary
:
KeyMod
.
WinCtrl
|
KeyCode
.
US_BACKTICK
}
}),
'
View:
'
+
ToggleTerminalAction
.
LABEL
,
nls
.
localize
(
'
viewCategory
'
,
"
View
"
));
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusTerminalAction
,
FocusTerminalAction
.
ID
,
FocusTerminalAction
.
LABEL
),
FocusTerminalAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
CloseTerminalAction
,
CloseTerminalAction
.
ID
,
CloseTerminalAction
.
LABEL
),
CloseTerminalAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
CreateNewTerminalAction
,
CreateNewTerminalAction
.
ID
,
CreateNewTerminalAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
US_BACKTICK
,
mac
:
{
primary
:
KeyMod
.
WinCtrl
|
KeyMod
.
Shift
|
KeyCode
.
US_BACKTICK
}
}),
CreateNewTerminalAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
CloseTerminalAction
,
CloseTerminalAction
.
ID
,
CloseTerminalAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_X
,
mac
:
{
primary
:
KeyMod
.
WinCtrl
|
KeyMod
.
Shift
|
KeyCode
.
KEY_X
}
}),
CloseTerminalAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusTerminalAction
,
FocusTerminalAction
.
ID
,
FocusTerminalAction
.
LABEL
),
FocusTerminalAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusNextTerminalAction
,
FocusNextTerminalAction
.
ID
,
FocusNextTerminalAction
.
LABEL
),
CloseTerminalAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusPreviousTerminalAction
,
FocusPreviousTerminalAction
.
ID
,
FocusPreviousTerminalAction
.
LABEL
),
CloseTerminalAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ToggleTerminalAction
,
ToggleTerminalAction
.
ID
,
ToggleTerminalAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
US_BACKTICK
,
mac
:
{
primary
:
KeyMod
.
WinCtrl
|
KeyCode
.
US_BACKTICK
}
}),
'
View:
'
+
ToggleTerminalAction
.
LABEL
,
nls
.
localize
(
'
viewCategory
'
,
"
View
"
));
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
浏览文件 @
549478a0
...
...
@@ -45,5 +45,7 @@ export interface ITerminalService {
close
():
TPromise
<
any
>
;
createNew
():
TPromise
<
any
>
;
focus
():
TPromise
<
any
>
;
focusNext
():
TPromise
<
any
>
;
focusPrevious
():
TPromise
<
any
>
;
toggle
():
TPromise
<
any
>
;
}
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
549478a0
...
...
@@ -74,4 +74,38 @@ export class FocusTerminalAction extends Action {
public
run
(
event
?:
any
):
TPromise
<
any
>
{
return
this
.
terminalService
.
focus
();
}
}
export
class
FocusNextTerminalAction
extends
Action
{
public
static
ID
=
'
workbench.action.terminal.focusNext
'
;
public
static
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.focusNext
'
,
"
Terminal: Focus Next Terminal
"
);
constructor
(
id
:
string
,
label
:
string
,
@
ITerminalService
private
terminalService
:
ITerminalService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
return
this
.
terminalService
.
focusNext
();
}
}
export
class
FocusPreviousTerminalAction
extends
Action
{
public
static
ID
=
'
workbench.action.terminal.focusPrevious
'
;
public
static
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.focusPrevious
'
,
"
Terminal: Focus Previous Terminal
"
);
constructor
(
id
:
string
,
label
:
string
,
@
ITerminalService
private
terminalService
:
ITerminalService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
return
this
.
terminalService
.
focusPrevious
();
}
}
\ No newline at end of file
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
浏览文件 @
549478a0
...
...
@@ -158,13 +158,34 @@ export class TerminalPanel extends Panel {
this
.
layout
(
new
Dimension
(
this
.
parentDomElement
.
offsetWidth
,
this
.
parentDomElement
.
offsetHeight
));
}
public
focus
():
void
{
if
(
this
.
terminalInstances
.
length
>
0
)
{
this
.
terminalInstances
[
this
.
activeTerminalIndex
].
focus
(
true
);
}
}
public
focusNext
():
void
{
if
(
this
.
terminalInstances
.
length
>
1
)
{
this
.
activeTerminalIndex
++
;
if
(
this
.
activeTerminalIndex
>=
this
.
terminalInstances
.
length
)
{
this
.
activeTerminalIndex
=
0
;
}
this
.
setActiveTerminal
(
this
.
activeTerminalIndex
);
this
.
focus
();
}
}
public
focusPrevious
():
void
{
if
(
this
.
terminalInstances
.
length
>
1
)
{
this
.
activeTerminalIndex
--
;
if
(
this
.
activeTerminalIndex
<
0
)
{
this
.
activeTerminalIndex
=
this
.
terminalInstances
.
length
-
1
;
}
this
.
setActiveTerminal
(
this
.
activeTerminalIndex
);
this
.
focus
();
}
}
public
dispose
():
void
{
this
.
toDispose
=
lifecycle
.
dispose
(
this
.
toDispose
);
while
(
this
.
terminalInstances
.
length
>
0
)
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
549478a0
...
...
@@ -22,6 +22,32 @@ export class TerminalService implements ITerminalService {
return
this
.
panelService
.
openPanel
(
TERMINAL_PANEL_ID
,
true
);
}
public
focusNext
():
TPromise
<
any
>
{
return
this
.
focus
().
then
(()
=>
{
let
panel
=
this
.
panelService
.
getActivePanel
();
if
(
!
panel
||
panel
.
getId
()
!==
TERMINAL_PANEL_ID
)
{
return
this
.
toggle
().
then
(()
=>
{
panel
=
this
.
panelService
.
getActivePanel
();
return
(
<
TerminalPanel
>
panel
).
focusNext
();
});
}
return
(
<
TerminalPanel
>
panel
).
focusNext
();
});
}
public
focusPrevious
():
TPromise
<
any
>
{
return
this
.
focus
().
then
(()
=>
{
let
panel
=
this
.
panelService
.
getActivePanel
();
if
(
!
panel
||
panel
.
getId
()
!==
TERMINAL_PANEL_ID
)
{
return
this
.
toggle
().
then
(()
=>
{
panel
=
this
.
panelService
.
getActivePanel
();
return
(
<
TerminalPanel
>
panel
).
focusPrevious
();
});
}
return
(
<
TerminalPanel
>
panel
).
focusPrevious
();
});
}
public
toggle
():
TPromise
<
any
>
{
const
panel
=
this
.
panelService
.
getActivePanel
();
if
(
panel
&&
panel
.
getId
()
===
TERMINAL_PANEL_ID
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录