Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9a384a4f
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,发现更多精彩内容 >>
提交
9a384a4f
编写于
8月 22, 2018
作者:
N
Nilesh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added new command for sending custom sequence to terminal
上级
fe747f81
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
71 addition
and
4 deletion
+71
-4
src/vs/workbench/parts/terminal/common/terminalCommands.ts
src/vs/workbench/parts/terminal/common/terminalCommands.ts
+3
-2
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+7
-1
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+61
-1
未找到文件。
src/vs/workbench/parts/terminal/common/terminalCommands.ts
浏览文件 @
9a384a4f
...
...
@@ -54,7 +54,8 @@ export const enum TERMINAL_COMMAND_ID {
SELECT_TO_NEXT_COMMAND
=
'
workbench.action.terminal.selectToNextCommand
'
,
SELECT_TO_PREVIOUS_LINE
=
'
workbench.action.terminal.selectToPreviousLine
'
,
SELECT_TO_NEXT_LINE
=
'
workbench.action.terminal.selectToNextLine
'
,
TOGGLE_ESCAPE_SEQUENCE_LOGGING
=
'
toggleEscapeSequenceLogging
'
TOGGLE_ESCAPE_SEQUENCE_LOGGING
=
'
toggleEscapeSequenceLogging
'
,
SEND_SEQUENCE
=
'
workbench.action.terminal.sendSequence
'
}
...
...
@@ -79,4 +80,4 @@ function registerOpenTerminalAtIndexCommands(): void {
}
});
}
}
\ No newline at end of file
}
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
9a384a4f
...
...
@@ -17,7 +17,7 @@ import { getTerminalDefaultShellUnixLike, getTerminalDefaultShellWindows } from
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
,
ClearSelectionTerminalAction
,
CopyTerminalSelectionAction
,
CreateNewTerminalAction
,
CreateNewInActiveWorkspaceTerminalAction
,
FocusActiveTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
SelectDefaultShellWindowsTerminalAction
,
RunSelectedTextInTerminalAction
,
RunActiveFileInTerminalAction
,
ScrollDownTerminalAction
,
ScrollDownPageTerminalAction
,
ScrollToBottomTerminalAction
,
ScrollUpTerminalAction
,
ScrollUpPageTerminalAction
,
ScrollToTopTerminalAction
,
TerminalPasteAction
,
ToggleTerminalAction
,
ClearTerminalAction
,
AllowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
,
RenameTerminalAction
,
SelectAllTerminalAction
,
FocusTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
,
DeleteWordLeftTerminalAction
,
DeleteWordRightTerminalAction
,
QuickOpenActionTermContributor
,
QuickOpenTermAction
,
TERMINAL_PICKER_PREFIX
,
MoveToLineStartTerminalAction
,
MoveToLineEndTerminalAction
,
SplitTerminalAction
,
SplitInActiveWorkspaceTerminalAction
,
FocusPreviousPaneTerminalAction
,
FocusNextPaneTerminalAction
,
ResizePaneLeftTerminalAction
,
ResizePaneRightTerminalAction
,
ResizePaneUpTerminalAction
,
ResizePaneDownTerminalAction
,
ScrollToPreviousCommandAction
,
ScrollToNextCommandAction
,
SelectToPreviousCommandAction
,
SelectToNextCommandAction
,
SelectToPreviousLineAction
,
SelectToNextLineAction
,
ToggleEscapeSequenceLoggingAction
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
KillTerminalAction
,
ClearSelectionTerminalAction
,
CopyTerminalSelectionAction
,
CreateNewTerminalAction
,
CreateNewInActiveWorkspaceTerminalAction
,
FocusActiveTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
SelectDefaultShellWindowsTerminalAction
,
RunSelectedTextInTerminalAction
,
RunActiveFileInTerminalAction
,
ScrollDownTerminalAction
,
ScrollDownPageTerminalAction
,
ScrollToBottomTerminalAction
,
ScrollUpTerminalAction
,
ScrollUpPageTerminalAction
,
ScrollToTopTerminalAction
,
TerminalPasteAction
,
ToggleTerminalAction
,
ClearTerminalAction
,
AllowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
,
RenameTerminalAction
,
SelectAllTerminalAction
,
FocusTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
,
DeleteWordLeftTerminalAction
,
DeleteWordRightTerminalAction
,
QuickOpenActionTermContributor
,
QuickOpenTermAction
,
TERMINAL_PICKER_PREFIX
,
MoveToLineStartTerminalAction
,
MoveToLineEndTerminalAction
,
SplitTerminalAction
,
SplitInActiveWorkspaceTerminalAction
,
FocusPreviousPaneTerminalAction
,
FocusNextPaneTerminalAction
,
ResizePaneLeftTerminalAction
,
ResizePaneRightTerminalAction
,
ResizePaneUpTerminalAction
,
ResizePaneDownTerminalAction
,
ScrollToPreviousCommandAction
,
ScrollToNextCommandAction
,
SelectToPreviousCommandAction
,
SelectToNextCommandAction
,
SelectToPreviousLineAction
,
SelectToNextLineAction
,
ToggleEscapeSequenceLoggingAction
,
SendSequenceTerminalCommand
}
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
'
;
...
...
@@ -534,6 +534,12 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(SelectToPrevious
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
SelectToNextLineAction
,
SelectToNextLineAction
.
ID
,
SelectToNextLineAction
.
LABEL
),
'
Terminal: Select To Next Line
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ToggleEscapeSequenceLoggingAction
,
ToggleEscapeSequenceLoggingAction
.
ID
,
ToggleEscapeSequenceLoggingAction
.
LABEL
),
'
Terminal: Toggle Escape Sequence Logging
'
,
category
);
const
sendSequenceTerminalCommand
=
new
SendSequenceTerminalCommand
({
id
:
SendSequenceTerminalCommand
.
ID
,
precondition
:
null
});
sendSequenceTerminalCommand
.
register
();
setupTerminalCommands
();
setupTerminalMenu
();
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
9a384a4f
...
...
@@ -20,13 +20,14 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import
{
IQuickInputService
,
IPickOptions
,
IQuickPickItem
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
ActionBarContributor
}
from
'
vs/workbench/browser/actions
'
;
import
{
TerminalEntry
}
from
'
vs/workbench/parts/terminal/browser/terminalQuickOpen
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
PICK_WORKSPACE_FOLDER_COMMAND_ID
}
from
'
vs/workbench/browser/actions/workspaceCommands
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
TERMINAL_COMMAND_ID
}
from
'
vs/workbench/parts/terminal/common/terminalCommands
'
;
import
{
Command
}
from
'
vs/editor/browser/editorExtensions
'
;
export
const
TERMINAL_PICKER_PREFIX
=
'
term
'
;
...
...
@@ -227,6 +228,65 @@ export class MoveToLineEndTerminalAction extends BaseSendTextTerminalAction {
}
}
export
class
SendSequenceTerminalCommand
extends
Command
{
public
static
readonly
ID
=
TERMINAL_COMMAND_ID
.
SEND_SEQUENCE
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.sendSequence
'
,
"
Send Custom Sequence To Terminal
"
);
public
runCommand
(
accessor
:
ServicesAccessor
,
args
:
any
):
void
{
const
terminalInstance
=
accessor
.
get
(
ITerminalService
).
getActiveInstance
();
if
(
!
terminalInstance
)
{
return
;
}
const
text
=
args
.
text
.
split
(
'
'
);
var
terminalText
;
for
(
let
i
=
0
;
i
<
text
.
length
;
i
++
)
{
terminalText
=
'
'
+
prepareTerminaText
(
text
[
i
]);
terminalInstance
.
sendText
(
terminalText
,
false
);
}
}
}
function
prepareTerminaText
(
text
:
string
):
string
{
// Hexcodes and excape char
if
(
text
.
substring
(
0
,
2
).
toLowerCase
()
===
'
\\
x
'
)
{
// Valid hex with 2 digits
// var isOk = /^\\x[0-9a-f]{2}$/i.test(text);
if
(
/^
\\
x
[
0-9a-f
]{2}
$/i
.
test
(
text
))
{
return
String
.
fromCharCode
(
parseInt
(
text
.
substring
(
2
),
16
));
}
}
// ctrl modifier with single char
if
(
text
.
indexOf
(
'
+
'
)
>=
0
)
{
const
text1
=
text
.
split
(
'
+
'
);
if
(
text1
[
0
].
toLowerCase
()
===
'
ctrl
'
)
{
if
(
text1
[
1
].
length
===
1
)
{
return
String
.
fromCharCode
(
text1
[
1
].
toUpperCase
().
charCodeAt
(
0
)
-
64
);
}
}
}
// handle enter
if
(
text
.
toLowerCase
()
===
'
enter
'
)
{
return
'
\n
'
;
}
// Arrow keys
if
(
text
.
toLowerCase
()
===
'
down
'
)
{
return
String
.
fromCharCode
(
15
);
}
if
(
text
.
toLowerCase
()
===
'
up
'
)
{
return
String
.
fromCharCode
(
16
);
}
if
(
text
.
toLowerCase
()
===
'
right
'
)
{
return
String
.
fromCharCode
(
17
);
}
if
(
text
.
toLowerCase
()
===
'
left
'
)
{
return
String
.
fromCharCode
(
18
);
}
return
text
;
}
export
class
CreateNewTerminalAction
extends
Action
{
public
static
readonly
ID
=
TERMINAL_COMMAND_ID
.
NEW
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录