Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
76bc7c04
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,发现更多精彩内容 >>
提交
76bc7c04
编写于
6月 12, 2017
作者:
D
Daniel Imms
提交者:
GitHub
6月 12, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #28464 from jammerware/topic/issue-10023
Topic/issue 10023
上级
01fa0b83
354042ac
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
54 addition
and
3 deletion
+54
-3
src/vs/workbench/parts/terminal/common/terminal.ts
src/vs/workbench/parts/terminal/common/terminal.ts
+5
-0
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+2
-1
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+29
-0
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+18
-2
未找到文件。
src/vs/workbench/parts/terminal/common/terminal.ts
浏览文件 @
76bc7c04
...
...
@@ -330,4 +330,9 @@ export interface ITerminalInstance {
* Experimental: Call to enable onData to be passed over IPC to the extension host.
*/
enableApiOnData
():
void
;
/**
* Sets the title of the terminal instance.
*/
setTitle
(
title
:
string
):
void
;
}
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
76bc7c04
...
...
@@ -18,7 +18,7 @@ import { TERMINAL_DEFAULT_SHELL_LINUX, TERMINAL_DEFAULT_SHELL_OSX, TERMINAL_DEFA
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actionRegistry
'
;
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
,
SelectAllTerminalAction
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
KillTerminalAction
,
CopyTerminalSelectionAction
,
CreateNewTerminalAction
,
FocusActiveTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
FocusTerminalAtIndexAction
,
SelectDefaultShellWindowsTerminalAction
,
RunSelectedTextInTerminalAction
,
RunActiveFileInTerminalAction
,
ScrollDownTerminalAction
,
ScrollDownPageTerminalAction
,
ScrollToBottomTerminalAction
,
ScrollUpTerminalAction
,
ScrollUpPageTerminalAction
,
ScrollToTopTerminalAction
,
TerminalPasteAction
,
ToggleTerminalAction
,
ClearTerminalAction
,
AllowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
,
RenameTerminalAction
,
SelectAllTerminalAction
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
ShowAllCommandsAction
}
from
'
vs/workbench/parts/quickopen/browser/commandsHandler
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
...
...
@@ -276,5 +276,6 @@ if (platform.isWindows) {
}
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
AllowWorkspaceShellTerminalCommand
,
AllowWorkspaceShellTerminalCommand
.
ID
,
AllowWorkspaceShellTerminalCommand
.
LABEL
),
'
Terminal: Allow Workspace Shell Configuration
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
DisallowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
.
ID
,
DisallowWorkspaceShellTerminalCommand
.
LABEL
),
'
Terminal: Disallow Workspace Shell Configuration
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
RenameTerminalAction
,
RenameTerminalAction
.
ID
,
RenameTerminalAction
.
LABEL
),
'
Terminal: Rename
'
,
category
);
registerColors
();
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
76bc7c04
...
...
@@ -17,6 +17,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
attachSelectBoxStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
export
class
ToggleTerminalAction
extends
TogglePanelAction
{
...
...
@@ -554,3 +555,31 @@ export class DisallowWorkspaceShellTerminalCommand extends Action {
return
TPromise
.
as
(
void
0
);
}
}
export
class
RenameTerminalAction
extends
Action
{
public
static
ID
=
'
workbench.action.terminal.rename
'
;
public
static
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.rename
'
,
"
Rename
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IQuickOpenService
private
quickOpenService
:
IQuickOpenService
,
@
ITerminalService
private
terminalService
:
ITerminalService
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
const
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
!
terminalInstance
)
{
return
TPromise
.
as
(
void
0
);
}
return
this
.
quickOpenService
.
input
({
prompt
:
nls
.
localize
(
'
workbench.action.terminal.rename.prompt
'
,
"
Enter terminal name
"
),
}).
then
(
name
=>
{
if
(
name
)
{
terminalInstance
.
setTitle
(
name
);
}
});
}
}
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
76bc7c04
...
...
@@ -76,6 +76,7 @@ export class TerminalInstance implements ITerminalInstance {
private
_terminalHasTextContextKey
:
IContextKey
<
boolean
>
;
private
_cols
:
number
;
private
_rows
:
number
;
private
_messageTitleListener
:
(
message
:
{
type
:
string
,
content
:
string
})
=>
void
;
private
_widgetManager
:
TerminalWidgetManager
;
private
_linkHandler
:
TerminalLinkHandler
;
...
...
@@ -494,12 +495,13 @@ export class TerminalInstance implements ITerminalInstance {
});
if
(
!
shell
.
name
)
{
// Only listen for process title changes when a name is not provided
this
.
_
process
.
on
(
'
message
'
,
(
message
)
=>
{
this
.
_
messageTitleListener
=
(
message
)
=>
{
if
(
message
.
type
===
'
title
'
)
{
this
.
_title
=
message
.
content
?
message
.
content
:
''
;
this
.
_onTitleChanged
.
fire
(
this
.
_title
);
}
});
};
this
.
_process
.
on
(
'
message
'
,
this
.
_messageTitleListener
);
}
this
.
_process
.
on
(
'
message
'
,
(
message
)
=>
{
if
(
message
.
type
===
'
pid
'
)
{
...
...
@@ -780,6 +782,20 @@ export class TerminalInstance implements ITerminalInstance {
public
static
setTerminalProcessFactory
(
factory
:
ITerminalProcessFactory
):
void
{
this
.
_terminalProcessFactory
=
factory
;
}
public
setTitle
(
title
:
string
):
void
{
const
didTitleChange
=
title
!==
this
.
_title
;
if
(
didTitleChange
)
{
this
.
_onTitleChanged
.
fire
(
title
);
}
// If the title was not set by the API, unregister the handler that
// automatically updates the terminal name
if
(
this
.
_process
&&
this
.
_messageTitleListener
)
{
this
.
_process
.
removeListener
(
'
message
'
,
this
.
_messageTitleListener
);
this
.
_messageTitleListener
=
null
;
}
}
}
registerThemingParticipant
((
theme
:
ITheme
,
collector
:
ICssStyleCollector
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录