Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
bdd15725
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bdd15725
编写于
6月 26, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Push ext host check to mainThread, apply fix to request defaults too
Fixes #76049
上级
00eee140
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
17 deletion
+28
-17
src/vs/workbench/api/browser/mainThreadTerminalService.ts
src/vs/workbench/api/browser/mainThreadTerminalService.ts
+22
-6
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+5
-6
src/vs/workbench/contrib/terminal/common/terminalService.ts
src/vs/workbench/contrib/terminal/common/terminalService.ts
+1
-5
未找到文件。
src/vs/workbench/api/browser/mainThreadTerminalService.ts
浏览文件 @
bdd15725
...
...
@@ -4,12 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalProcessExtHostProxy
,
ITerminalProcessExtHostRequest
,
ITerminalDimensions
,
EXT_HOST_CREATION_DELAY
,
IAvailableShellsRequest
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalProcessExtHostProxy
,
ITerminalProcessExtHostRequest
,
ITerminalDimensions
,
EXT_HOST_CREATION_DELAY
,
IAvailableShellsRequest
,
IDefaultShellAndArgsRequest
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ExtHostContext
,
ExtHostTerminalServiceShape
,
MainThreadTerminalServiceShape
,
MainContext
,
IExtHostContext
,
ShellLaunchConfigDto
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
UriComponents
,
URI
}
from
'
vs/base/common/uri
'
;
import
{
StopWatch
}
from
'
vs/base/common/stopwatch
'
;
import
{
ITerminalInstanceService
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
IRemoteAgentService
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadTerminalService
)
export
class
MainThreadTerminalService
implements
MainThreadTerminalServiceShape
{
...
...
@@ -24,7 +25,8 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
constructor
(
extHostContext
:
IExtHostContext
,
@
ITerminalService
private
readonly
_terminalService
:
ITerminalService
,
@
ITerminalInstanceService
readonly
terminalInstanceService
:
ITerminalInstanceService
@
ITerminalInstanceService
readonly
terminalInstanceService
:
ITerminalInstanceService
,
@
IRemoteAgentService
readonly
_remoteAgentService
:
IRemoteAgentService
)
{
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostTerminalService
);
this
.
_remoteAuthority
=
extHostContext
.
remoteAuthority
;
...
...
@@ -51,7 +53,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
// ITerminalInstanceService listeners
if
(
terminalInstanceService
.
onRequestDefaultShellAndArgs
)
{
this
.
_toDispose
.
push
(
terminalInstanceService
.
onRequestDefaultShellAndArgs
(
r
=>
this
.
_proxy
.
$requestDefaultShellAndArgs
().
then
(
e
=>
r
(
e
.
shell
,
e
.
args
)
)));
this
.
_toDispose
.
push
(
terminalInstanceService
.
onRequestDefaultShellAndArgs
(
e
=>
this
.
_onRequestDefaultShellAndArgs
(
e
)));
}
// Set initial ext host state
...
...
@@ -291,10 +293,24 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_terminalProcesses
[
terminalId
].
emitLatency
(
sum
/
COUNT
);
}
private
_isPrimaryExtHost
():
boolean
{
// The "primary" ext host is the remote ext host if there is one, otherwise the local
const
conn
=
this
.
_remoteAgentService
.
getConnection
();
if
(
conn
)
{
return
this
.
_remoteAuthority
===
conn
.
remoteAuthority
;
}
return
true
;
}
private
_onRequestAvailableShells
(
request
:
IAvailableShellsRequest
):
void
{
if
(
request
.
remoteAuthority
!==
this
.
_remoteAuthority
)
{
return
;
if
(
this
.
_isPrimaryExtHost
())
{
this
.
_proxy
.
$requestAvailableShells
().
then
(
e
=>
request
(
e
));
}
}
private
_onRequestDefaultShellAndArgs
(
request
:
IDefaultShellAndArgsRequest
):
void
{
if
(
this
.
_isPrimaryExtHost
())
{
this
.
_proxy
.
$requestDefaultShellAndArgs
().
then
(
e
=>
request
(
e
.
shell
,
e
.
args
));
}
this
.
_proxy
.
$requestAvailableShells
().
then
(
e
=>
request
.
callback
(
e
));
}
}
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
bdd15725
...
...
@@ -758,8 +758,11 @@ export interface ITerminalProcessExtHostRequest {
}
export
interface
IAvailableShellsRequest
{
remoteAuthority
:
string
|
null
;
callback
:
(
shells
:
IShellDefinition
[])
=>
void
;
(
shells
:
IShellDefinition
[]):
void
;
}
export
interface
IDefaultShellAndArgsRequest
{
(
shell
:
string
,
args
:
string
[]
|
string
|
undefined
):
void
;
}
export
enum
LinuxDistro
{
...
...
@@ -796,7 +799,3 @@ export interface ITerminalChildProcess {
getCwd
():
Promise
<
string
>
;
getLatency
():
Promise
<
number
>
;
}
export
interface
IDefaultShellAndArgsRequest
{
(
shell
:
string
,
args
:
string
[]
|
string
|
undefined
):
void
;
}
\ No newline at end of file
src/vs/workbench/contrib/terminal/common/terminalService.ts
浏览文件 @
bdd15725
...
...
@@ -563,10 +563,6 @@ export abstract class TerminalService implements ITerminalService {
}
private
_detectWindowsShells
():
Promise
<
IShellDefinition
[]
>
{
const
conn
=
this
.
_remoteAgentService
.
getConnection
();
return
new
Promise
(
r
=>
this
.
_onRequestAvailableShells
.
fire
({
remoteAuthority
:
conn
?
conn
.
remoteAuthority
:
null
,
callback
:
r
}));
return
new
Promise
(
r
=>
this
.
_onRequestAvailableShells
.
fire
(
r
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录