Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
83270589
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,发现更多精彩内容 >>
提交
83270589
编写于
9月 09, 2016
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Get xterm.js initializing
上级
f95f8c66
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
67 addition
and
36 deletion
+67
-36
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
...h/parts/terminal/electron-browser/terminalConfigHelper.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+32
-33
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
...orkbench/parts/terminal/electron-browser/terminalPanel.ts
+31
-2
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+3
-0
未找到文件。
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
浏览文件 @
83270589
...
...
@@ -93,7 +93,7 @@ export class TerminalConfigHelper {
public
constructor
(
private
platform
:
Platform
,
private
configurationService
:
IConfigurationService
)
{
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
}
public
getTheme
(
baseThemeId
:
string
):
string
[]
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
83270589
...
...
@@ -45,14 +45,15 @@ export class TerminalInstance implements ITerminalInstance {
private
onExitCallback
:
(
TerminalInstance
)
=>
void
,
private
configHelper
:
TerminalConfigHelper
,
private
container
:
HTMLElement
,
private
contextService
:
IWorkspaceContextService
,
private
messageService
:
IMessageService
,
private
terminalService
:
ITerminalService
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
ITerminalService
private
terminalService
:
ITerminalService
)
{
this
.
_id
=
TerminalInstance
.
ID_COUNTER
++
;
this
.
createProcess
();
if
(
container
)
{
console
.
log
(
'
attach to element
'
,
container
);
this
.
attachToElement
(
container
);
}
}
...
...
@@ -66,11 +67,36 @@ export class TerminalInstance implements ITerminalInstance {
DOM
.
addClass
(
this
.
wrapperElement
,
'
terminal-wrapper
'
);
this
.
terminalDomElement
=
document
.
createElement
(
'
div
'
);
this
.
xterm
=
xterm
();
this
.
xterm
.
open
(
this
.
terminalDomElement
);
this
.
wrapperElement
=
document
.
createElement
(
'
div
'
);
DOM
.
addClass
(
this
.
wrapperElement
,
'
terminal-wrapper
'
);
this
.
terminalDomElement
=
document
.
createElement
(
'
div
'
);
this
.
process
.
on
(
'
message
'
,
(
message
)
=>
{
if
(
message
.
type
===
'
data
'
)
{
this
.
xterm
.
write
(
message
.
content
);
}
});
this
.
xterm
.
on
(
'
data
'
,
(
data
)
=>
{
this
.
process
.
send
({
event
:
'
input
'
,
data
:
this
.
sanitizeInput
(
data
)
});
return
false
;
});
this
.
xterm
.
attachCustomKeydownHandler
((
event
:
KeyboardEvent
)
=>
{
// Allow the toggle tab mode keybinding to pass through the terminal so that focus can
// be escaped
let
standardKeyboardEvent
=
new
StandardKeyboardEvent
(
event
);
if
(
this
.
skipTerminalKeybindings
.
some
((
k
)
=>
standardKeyboardEvent
.
equals
(
k
.
value
)))
{
event
.
preventDefault
();
return
false
;
}
// If tab focus mode is on, tab is not passed to the terminal
if
(
TabFocus
.
getTabFocusMode
()
&&
event
.
keyCode
===
9
)
{
return
false
;
}
});
let
xtermHelper
:
HTMLElement
=
this
.
xterm
.
element
.
querySelector
(
'
.xterm-helpers
'
);
let
focusTrap
:
HTMLElement
=
document
.
createElement
(
'
div
'
);
focusTrap
.
setAttribute
(
'
tabindex
'
,
'
0
'
);
...
...
@@ -137,12 +163,6 @@ export class TerminalInstance implements ITerminalInstance {
}
});
}
this
.
xterm
=
xterm
();
this
.
process
.
on
(
'
message
'
,
(
message
)
=>
{
if
(
message
.
type
===
'
data
'
)
{
this
.
xterm
.
write
(
message
.
content
);
}
});
this
.
process
.
on
(
'
exit
'
,
(
exitCode
)
=>
{
// Prevent dispose functions being triggered multiple times
if
(
!
this
.
isExiting
)
{
...
...
@@ -154,27 +174,6 @@ export class TerminalInstance implements ITerminalInstance {
this
.
onExitCallback
(
this
);
}
});
this
.
xterm
.
on
(
'
data
'
,
(
data
)
=>
{
this
.
process
.
send
({
event
:
'
input
'
,
data
:
this
.
sanitizeInput
(
data
)
});
return
false
;
});
this
.
xterm
.
attachCustomKeydownHandler
((
event
:
KeyboardEvent
)
=>
{
// Allow the toggle tab mode keybinding to pass through the terminal so that focus can
// be escaped
let
standardKeyboardEvent
=
new
StandardKeyboardEvent
(
event
);
if
(
this
.
skipTerminalKeybindings
.
some
((
k
)
=>
standardKeyboardEvent
.
equals
(
k
.
value
)))
{
event
.
preventDefault
();
return
false
;
}
// If tab focus mode is on, tab is not passed to the terminal
if
(
TabFocus
.
getTabFocusMode
()
&&
event
.
keyCode
===
9
)
{
return
false
;
}
});
}
public
createTerminalEnv
(
parentEnv
:
IStringDictionary
<
string
>
,
shell
:
IShell
,
workspace
:
IWorkspace
,
locale
?:
string
):
IStringDictionary
<
string
>
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
浏览文件 @
83270589
...
...
@@ -3,15 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
Dimension
}
from
'
vs/base/browser/builder
'
;
import
{
Builder
,
Dimension
}
from
'
vs/base/browser/builder
'
;
import
{
IActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITerminalPanel
,
TERMINAL_PANEL_ID
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
import
{
ITerminalPanel
,
ITerminalService
,
TERMINAL_PANEL_ID
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
import
{
KillTerminalAction
,
CreateNewTerminalAction
,
SwitchTerminalInstanceAction
,
SwitchTerminalInstanceActionItem
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
Panel
}
from
'
vs/workbench/browser/panel
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
export
class
TerminalPanel
extends
Panel
implements
ITerminalPanel
{
...
...
@@ -19,14 +21,41 @@ export class TerminalPanel extends Panel implements ITerminalPanel {
private
actions
:
IAction
[];
//private contextMenuActions: IAction[];
private
parentDomElement
:
HTMLElement
;
private
terminalContainer
:
HTMLElement
;
//private currentBaseThemeId: string;
//private themeStyleElement: HTMLElement;
//private fontStyleElement: HTMLElement;
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
ITerminalService
private
terminalService
:
ITerminalService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
(
TERMINAL_PANEL_ID
,
telemetryService
);
}
public
create
(
parent
:
Builder
):
TPromise
<
any
>
{
super
.
create
(
parent
);
this
.
parentDomElement
=
parent
.
getHTMLElement
();
DOM
.
addClass
(
this
.
parentDomElement
,
'
integrated-terminal
'
);
//this.themeStyleElement = document.createElement('style');
//this.fontStyleElement = document.createElement('style');
this
.
terminalContainer
=
document
.
createElement
(
'
div
'
);
DOM
.
addClass
(
this
.
terminalContainer
,
'
terminal-outer-container
'
);
//this.parentDomElement.appendChild(this.themeStyleElement);
//this.parentDomElement.appendChild(this.fontStyleElement);
this
.
parentDomElement
.
appendChild
(
this
.
terminalContainer
);
//this.attachEventListeners();
//this.configurationHelper = new TerminalConfigHelper(platform.platform, this.configurationService, parent);
this
.
terminalService
.
setContainers
(
this
.
getContainer
(),
this
.
terminalContainer
);
return
TPromise
.
as
(
void
0
);
}
public
layout
(
dimension
?:
Dimension
):
void
{
if
(
!
dimension
)
{
return
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
83270589
...
...
@@ -50,6 +50,8 @@ export class TerminalService implements ITerminalService {
}
public
createInstance
():
ITerminalInstance
{
console
.
log
(
'
creating instance
'
);
console
.
log
(
'
config helper
'
,
this
.
configHelper
);
let
terminalInstance
=
<
TerminalInstance
>
this
.
instantiationService
.
createInstance
(
TerminalInstance
,
this
.
terminalFocusContextKey
,
this
.
onTerminalInstanceDispose
.
bind
(
this
),
this
.
configHelper
,
this
.
terminalContainer
);
this
.
terminalInstances
.
push
(
terminalInstance
);
...
...
@@ -105,6 +107,7 @@ export class TerminalService implements ITerminalService {
}
public
setContainers
(
panelContainer
:
Builder
,
terminalContainer
:
HTMLElement
):
void
{
console
.
log
(
'
set containers
'
);
this
.
terminalContainer
=
terminalContainer
;
this
.
_terminalInstances
.
forEach
(
terminalInstance
=>
{
terminalInstance
.
attachToElement
(
this
.
terminalContainer
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录