Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4323d933
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,发现更多精彩内容 >>
提交
4323d933
编写于
4月 17, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make service responsible for attaching the process proxy
上级
4f3c8a14
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
43 addition
and
23 deletion
+43
-23
src/vs/workbench/parts/terminal/common/terminal.ts
src/vs/workbench/parts/terminal/common/terminal.ts
+9
-0
src/vs/workbench/parts/terminal/common/terminalService.ts
src/vs/workbench/parts/terminal/common/terminalService.ts
+2
-1
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
+0
-1
src/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts
...parts/terminal/electron-browser/terminalProcessManager.ts
+4
-2
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+14
-1
src/vs/workbench/parts/terminal/node/terminalProcessExtHostProxy.ts
...kbench/parts/terminal/node/terminalProcessExtHostProxy.ts
+12
-16
src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts
...rminal/test/electron-browser/terminalConfigHelper.test.ts
+1
-1
未找到文件。
src/vs/workbench/parts/terminal/common/terminal.ts
浏览文件 @
4323d933
...
...
@@ -206,6 +206,8 @@ export interface ITerminalService {
setContainers
(
panelContainer
:
HTMLElement
,
terminalContainer
:
HTMLElement
):
void
;
selectDefaultWindowsShell
():
TPromise
<
string
>
;
setWorkspaceShellAllowed
(
isAllowed
:
boolean
):
void
;
requestExtHostProcess
(
proxy
:
ITerminalProcessExtHostProxy
):
TPromise
<
void
>
;
}
export
const
enum
Direction
{
...
...
@@ -519,3 +521,10 @@ export enum ProcessState {
// was run.
KILLED_BY_PROCESS
}
export
interface
ITerminalProcessExtHostProxy
{
emitData
(
data
:
string
):
void
;
emitTitle
(
title
:
string
):
void
;
emitPid
(
pid
:
number
):
void
;
}
\ No newline at end of file
src/vs/workbench/parts/terminal/common/terminalService.ts
浏览文件 @
4323d933
...
...
@@ -9,7 +9,7 @@ import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/c
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
,
TERMINAL_PANEL_ID
,
ITerminalTab
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
,
TERMINAL_PANEL_ID
,
ITerminalTab
,
ITerminalProcessExtHostProxy
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
...
...
@@ -75,6 +75,7 @@ export abstract class TerminalService implements ITerminalService {
public
abstract
getActiveOrCreateInstance
(
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
public
abstract
selectDefaultWindowsShell
():
TPromise
<
string
>
;
public
abstract
setContainers
(
panelContainer
:
HTMLElement
,
terminalContainer
:
HTMLElement
):
void
;
public
abstract
requestExtHostProcess
(
proxy
:
ITerminalProcessExtHostProxy
):
TPromise
<
void
>
;
private
_restoreTabs
():
void
{
if
(
!
this
.
configHelper
.
config
.
experimentalRestore
)
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
浏览文件 @
4323d933
...
...
@@ -12,7 +12,7 @@ import { IWorkspaceConfigurationService } from 'vs/workbench/services/configurat
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITerminalConfiguration
,
ITerminalConfigHelper
,
ITerminalFont
,
IShellLaunchConfig
,
IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY
,
TERMINAL_CONFIG_SECTION
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
isFedora
}
from
'
vs/workbench/parts/terminal/
electron-browser
/terminal
'
;
import
{
isFedora
}
from
'
vs/workbench/parts/terminal/
node
/terminal
'
;
import
{
Terminal
as
XTermTerminal
}
from
'
vscode-xterm
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
4323d933
...
...
@@ -110,7 +110,6 @@ export class TerminalInstance implements ITerminalInstance {
@
ILogService
private
_logService
:
ILogService
)
{
this
.
_shellLaunchConfig
.
extensionHostOwned
=
true
;
this
.
_shellLaunchConfig
.
name
=
'
Test terminal renderer
'
;
this
.
_disposables
=
[];
this
.
_skipTerminalCommands
=
[];
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts
浏览文件 @
4323d933
...
...
@@ -17,7 +17,8 @@ import { IConfigurationResolverService } from 'vs/workbench/services/configurati
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
ITerminalChildProcess
,
IMessageFromTerminalProcess
}
from
'
vs/workbench/parts/terminal/node/terminal
'
;
import
{
TerminalProcessExtHostBridge
}
from
'
vs/workbench/parts/terminal/node/terminalProcessExtHostBridge
'
;
import
{
TerminalProcessExtHostProxy
}
from
'
vs/workbench/parts/terminal/node/terminalProcessExtHostProxy
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
/** The amount of time to consider terminal errors to be related to the launch */
const
LAUNCHING_DURATION
=
500
;
...
...
@@ -54,6 +55,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
@
IWorkspaceContextService
private
readonly
_workspaceContextService
:
IWorkspaceContextService
,
@
IHistoryService
private
readonly
_historyService
:
IHistoryService
,
@
IConfigurationResolverService
private
readonly
_configurationResolverService
:
IConfigurationResolverService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
ILogService
private
_logService
:
ILogService
)
{
}
...
...
@@ -115,7 +117,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
const
options
=
{
env
,
cwd
};
this
.
_logService
.
debug
(
`Terminal process launching`
,
options
);
if
(
shellLaunchConfig
.
extensionHostOwned
)
{
this
.
_process
=
new
TerminalProcessExtHostBridge
(
);
this
.
_process
=
this
.
_instantiationService
.
createInstance
(
TerminalProcessExtHostProxy
);
}
else
{
this
.
_process
=
cp
.
fork
(
Uri
.
parse
(
require
.
toUrl
(
'
bootstrap
'
)).
fsPath
,
[
'
--type=terminal
'
],
options
);
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
4323d933
...
...
@@ -13,7 +13,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IQuickOpenService
,
IPickOpenEntry
,
IPickOptions
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
ITerminalInstance
,
ITerminalService
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY
,
TERMINAL_PANEL_ID
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
ITerminalInstance
,
ITerminalService
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY
,
TERMINAL_PANEL_ID
,
ITerminalProcessExtHostProxy
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
TerminalService
as
AbstractTerminalService
}
from
'
vs/workbench/parts/terminal/common/terminalService
'
;
import
{
TerminalConfigHelper
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalConfigHelper
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
...
@@ -93,6 +93,19 @@ export class TerminalService extends AbstractTerminalService implements ITermina
return
this
.
_instantiationService
.
createInstance
(
TerminalInstance
,
terminalFocusContextKey
,
configHelper
,
undefined
,
shellLaunchConfig
,
true
);
}
public
requestExtHostProcess
(
proxy
:
ITerminalProcessExtHostProxy
):
TPromise
<
void
>
{
let
i
=
0
;
setTimeout
(()
=>
{
proxy
.
emitPid
(
-
1
);
proxy
.
emitTitle
(
'
test title
'
);
proxy
.
emitData
(
`test
${
i
++
}
\r\n`
);
},
0
);
setInterval
(()
=>
{
proxy
.
emitData
(
`test
${
i
++
}
\r\n`
);
},
1000
);
return
TPromise
.
as
(
void
0
);
}
public
focusFindWidget
():
TPromise
<
void
>
{
return
this
.
showPanel
(
false
).
then
(()
=>
{
let
panel
=
this
.
_panelService
.
getActivePanel
()
as
TerminalPanel
;
...
...
src/vs/workbench/parts/terminal/node/terminalProcessExtHost
Bridge
.ts
→
src/vs/workbench/parts/terminal/node/terminalProcessExtHost
Proxy
.ts
浏览文件 @
4323d933
...
...
@@ -5,32 +5,28 @@
import
{
ITerminalChildProcess
,
IMessageToTerminalProcess
,
IMessageFromTerminalProcess
}
from
'
vs/workbench/parts/terminal/node/terminal
'
;
import
{
EventEmitter
}
from
'
events
'
;
import
{
ITerminalService
,
ITerminalProcessExtHostProxy
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
export
class
TerminalProcessExtHost
Bridge
extends
EventEmitter
implements
ITerminalChildProcess
{
export
class
TerminalProcessExtHost
Proxy
extends
EventEmitter
implements
ITerminalChildProcess
,
ITerminalProcessExtHostProxy
{
public
connected
:
boolean
;
constructor
()
{
constructor
(
@
ITerminalService
private
_terminalService
:
ITerminalService
)
{
super
();
let
i
=
0
;
setTimeout
(()
=>
{
this
.
_emitPid
(
-
1
);
this
.
_emitTitle
(
'
test title
'
);
this
.
_emitData
(
`test
${
i
++
}
\r\n`
);
},
0
);
setInterval
(()
=>
{
this
.
_emitData
(
`test
${
i
++
}
\r\n`
);
},
1000
);
this
.
_terminalService
.
requestExtHostProcess
(
this
).
then
(()
=>
{
});
}
p
rivate
_
emitData
(
data
:
string
):
void
{
p
ublic
emitData
(
data
:
string
):
void
{
this
.
emit
(
'
message
'
,
{
type
:
'
data
'
,
content
:
data
}
as
IMessageFromTerminalProcess
);
}
p
rivate
_
emitTitle
(
title
:
string
):
void
{
this
.
emit
(
'
message
'
,
{
type
:
'
data
'
,
content
:
title
}
as
IMessageFromTerminalProcess
);
p
ublic
emitTitle
(
title
:
string
):
void
{
this
.
emit
(
'
message
'
,
{
type
:
'
title
'
,
content
:
title
}
as
IMessageFromTerminalProcess
);
}
p
rivate
_
emitPid
(
pid
:
number
):
void
{
this
.
emit
(
'
message
'
,
{
type
:
'
data
'
,
content
:
pid
}
as
IMessageFromTerminalProcess
);
p
ublic
emitPid
(
pid
:
number
):
void
{
this
.
emit
(
'
message
'
,
{
type
:
'
pid
'
,
content
:
pid
}
as
IMessageFromTerminalProcess
);
}
public
send
(
message
:
IMessageToTerminalProcess
):
boolean
{
...
...
src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts
浏览文件 @
4323d933
...
...
@@ -6,7 +6,7 @@
import
*
as
assert
from
'
assert
'
;
import
{
TerminalConfigHelper
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalConfigHelper
'
;
import
{
EDITOR_FONT_DEFAULTS
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
isFedora
}
from
'
vs/workbench/parts/terminal/
electron-browser
/terminal
'
;
import
{
isFedora
}
from
'
vs/workbench/parts/terminal/
node
/terminal
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
suite
(
'
Workbench - TerminalConfigHelper
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录