Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b950ad29
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,发现更多精彩内容 >>
提交
b950ad29
编写于
10月 04, 2017
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert terminal focus by index actions to commands
Fixes #35520
上级
3af9e4e9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
41 deletion
+44
-41
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+14
-13
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+0
-28
src/vs/workbench/parts/terminal/electron-browser/terminalCommands.ts
...bench/parts/terminal/electron-browser/terminalCommands.ts
+30
-0
未找到文件。
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
b950ad29
...
...
@@ -11,13 +11,14 @@ import * as debugActions from 'vs/workbench/parts/debug/browser/debugActions';
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
panel
from
'
vs/workbench/browser/panel
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
terminalCommands
from
'
vs/workbench/parts/terminal/electron-browser/terminalCommands
'
;
import
{
Extensions
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
ITerminalService
,
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED
,
KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED
,
TERMINAL_PANEL_ID
,
TERMINAL_DEFAULT_RIGHT_CLICK_COPY_PASTE
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
,
TerminalCursorStyle
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
TERMINAL_DEFAULT_SHELL_LINUX
,
TERMINAL_DEFAULT_SHELL_OSX
,
TERMINAL_DEFAULT_SHELL_WINDOWS
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
KillTerminalAction
,
CopyTerminalSelectionAction
,
CreateNewTerminalAction
,
FocusActiveTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
FocusTerminalAtIndexAction
,
SelectDefaultShellWindowsTerminalAction
,
RunSelectedTextInTerminalAction
,
RunActiveFileInTerminalAction
,
ScrollDownTerminalAction
,
ScrollDownPageTerminalAction
,
ScrollToBottomTerminalAction
,
ScrollUpTerminalAction
,
ScrollUpPageTerminalAction
,
ScrollToTopTerminalAction
,
TerminalPasteAction
,
ToggleTerminalAction
,
ClearTerminalAction
,
AllowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
,
RenameTerminalAction
,
SelectAllTerminalAction
,
FocusTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
,
ShowNextFindTermTerminalFindWidgetAction
,
ShowPreviousFindTermTerminalFindWidgetAction
,
DeleteWordLeftTerminalAction
,
DeleteWordRightTerminalAction
,
QuickOpenActionTermContributor
,
QuickOpenTermAction
,
TERMINAL_PICKER_PREFIX
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
KillTerminalAction
,
CopyTerminalSelectionAction
,
CreateNewTerminalAction
,
FocusActiveTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
SelectDefaultShellWindowsTerminalAction
,
RunSelectedTextInTerminalAction
,
RunActiveFileInTerminalAction
,
ScrollDownTerminalAction
,
ScrollDownPageTerminalAction
,
ScrollToBottomTerminalAction
,
ScrollUpTerminalAction
,
ScrollUpPageTerminalAction
,
ScrollToTopTerminalAction
,
TerminalPasteAction
,
ToggleTerminalAction
,
ClearTerminalAction
,
AllowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
,
RenameTerminalAction
,
SelectAllTerminalAction
,
FocusTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
,
ShowNextFindTermTerminalFindWidgetAction
,
ShowPreviousFindTermTerminalFindWidgetAction
,
DeleteWordLeftTerminalAction
,
DeleteWordRightTerminalAction
,
QuickOpenActionTermContributor
,
QuickOpenTermAction
,
TERMINAL_PICKER_PREFIX
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ShowAllCommandsAction
}
from
'
vs/workbench/parts/quickopen/browser/commandsHandler
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
...
...
@@ -191,15 +192,15 @@ configurationRegistry.registerConfiguration({
FocusActiveTerminalAction
.
ID
,
FocusPreviousTerminalAction
.
ID
,
FocusNextTerminalAction
.
ID
,
FocusTerminalAtIndexAction
.
getId
(
1
)
,
FocusTerminalAtIndexAction
.
getId
(
2
)
,
FocusTerminalAtIndexAction
.
getId
(
3
)
,
FocusTerminalAtIndexAction
.
getId
(
4
)
,
FocusTerminalAtIndexAction
.
getId
(
5
)
,
FocusTerminalAtIndexAction
.
getId
(
6
)
,
FocusTerminalAtIndexAction
.
getId
(
7
)
,
FocusTerminalAtIndexAction
.
getId
(
8
)
,
FocusTerminalAtIndexAction
.
getId
(
9
)
,
'
workbench.action.terminal.focusAtIndex1
'
,
'
workbench.action.terminal.focusAtIndex2
'
,
'
workbench.action.terminal.focusAtIndex3
'
,
'
workbench.action.terminal.focusAtIndex4
'
,
'
workbench.action.terminal.focusAtIndex5
'
,
'
workbench.action.terminal.focusAtIndex6
'
,
'
workbench.action.terminal.focusAtIndex7
'
,
'
workbench.action.terminal.focusAtIndex8
'
,
'
workbench.action.terminal.focusAtIndex9
'
,
TerminalPasteAction
.
ID
,
RunSelectedTextInTerminalAction
.
ID
,
RunActiveFileInTerminalAction
.
ID
,
...
...
@@ -281,9 +282,6 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(CreateNewTermina
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusActiveTerminalAction
,
FocusActiveTerminalAction
.
ID
,
FocusActiveTerminalAction
.
LABEL
),
'
Terminal: Focus Terminal
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusNextTerminalAction
,
FocusNextTerminalAction
.
ID
,
FocusNextTerminalAction
.
LABEL
),
'
Terminal: Focus Next Terminal
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusPreviousTerminalAction
,
FocusPreviousTerminalAction
.
ID
,
FocusPreviousTerminalAction
.
LABEL
),
'
Terminal: Focus Previous Terminal
'
,
category
);
for
(
let
i
=
1
;
i
<
10
;
i
++
)
{
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusTerminalAtIndexAction
,
FocusTerminalAtIndexAction
.
getId
(
i
),
FocusTerminalAtIndexAction
.
getLabel
(
i
)),
'
Terminal: Focus Terminal
'
+
i
,
category
);
}
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
TerminalPasteAction
,
TerminalPasteAction
.
ID
,
TerminalPasteAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_V
,
linux
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_V
},
...
...
@@ -360,5 +358,8 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(DeleteWordRightT
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
Delete
,
mac
:
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
Delete
}
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Delete Word Right
'
,
category
);
terminalCommands
.
setup
();
registerColors
();
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
b950ad29
...
...
@@ -256,34 +256,6 @@ export class FocusNextTerminalAction extends Action {
}
}
export
class
FocusTerminalAtIndexAction
extends
Action
{
private
static
ID_PREFIX
=
'
workbench.action.terminal.focusAtIndex
'
;
constructor
(
id
:
string
,
label
:
string
,
@
ITerminalService
private
terminalService
:
ITerminalService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
this
.
terminalService
.
setActiveInstanceByIndex
(
this
.
getTerminalNumber
()
-
1
);
return
this
.
terminalService
.
showPanel
(
true
);
}
public
static
getId
(
n
:
number
):
string
{
return
FocusTerminalAtIndexAction
.
ID_PREFIX
+
n
;
}
public
static
getLabel
(
n
:
number
):
string
{
return
nls
.
localize
(
'
workbench.action.terminal.focusAtIndex
'
,
'
Focus Terminal {0}
'
,
n
);
}
private
getTerminalNumber
():
number
{
return
parseInt
(
this
.
id
.
substr
(
FocusTerminalAtIndexAction
.
ID_PREFIX
.
length
));
}
}
export
class
FocusPreviousTerminalAction
extends
Action
{
public
static
ID
=
'
workbench.action.terminal.focusPrevious
'
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalCommands.ts
0 → 100644
浏览文件 @
b950ad29
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
ITerminalService
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
export
function
setup
():
void
{
registerOpenTerminalAtIndexCommands
();
}
function
registerOpenTerminalAtIndexCommands
():
void
{
for
(
let
i
=
0
;
i
<
9
;
i
++
)
{
const
terminalIndex
=
i
;
const
visibleIndex
=
i
+
1
;
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
`workbench.action.terminal.focusAtIndex
${
visibleIndex
}
`
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
void
0
,
primary
:
null
,
handler
:
accessor
=>
{
const
terminalService
=
accessor
.
get
(
ITerminalService
);
terminalService
.
setActiveInstanceByIndex
(
terminalIndex
);
return
terminalService
.
showPanel
(
true
);
}
});
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录