Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
2443cf50
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
未验证
提交
2443cf50
编写于
7月 13, 2019
作者:
D
Daniel Imms
提交者:
GitHub
7月 13, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #77298 from microsoft/tyriar/77228_dimensionss
Improve terminal grid dimensions caching
上级
167e621c
9f69f439
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
104 addition
and
60 deletion
+104
-60
extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts
.../vscode-api-tests/src/singlefolder-tests/terminal.test.ts
+20
-21
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+4
-1
src/vs/workbench/api/browser/mainThreadTerminalService.ts
src/vs/workbench/api/browser/mainThreadTerminalService.ts
+22
-15
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+6
-0
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+8
-8
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+30
-7
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+8
-2
src/vs/workbench/contrib/terminal/common/terminalProcessExtHostProxy.ts
...ch/contrib/terminal/common/terminalProcessExtHostProxy.ts
+1
-1
src/vs/workbench/contrib/terminal/common/terminalService.ts
src/vs/workbench/contrib/terminal/common/terminalService.ts
+5
-5
未找到文件。
extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts
浏览文件 @
2443cf50
...
...
@@ -270,27 +270,6 @@ suite('window namespace tests', () => {
window
.
createTerminal
({
name
:
'
c
'
,
virtualProcess
});
});
test
(
'
should get dimensions event when shown
'
,
(
done
)
=>
{
const
reg1
=
window
.
onDidOpenTerminal
(
term
=>
{
reg1
.
dispose
();
equal
(
terminal
,
term
);
term
.
show
();
});
const
virtualProcess
:
TerminalVirtualProcess
=
{
onDidWrite
:
new
EventEmitter
<
string
>
().
event
,
setDimensions
:
dimensions
=>
{
ok
(
dimensions
.
columns
>
0
);
ok
(
dimensions
.
rows
>
0
);
const
reg2
=
window
.
onDidCloseTerminal
(()
=>
{
reg2
.
dispose
();
done
();
});
terminal
.
dispose
();
}
};
const
terminal
=
window
.
createTerminal
({
name
:
'
foo
'
,
virtualProcess
});
});
test
(
'
should fire Terminal.onData on write
'
,
(
done
)
=>
{
const
reg1
=
window
.
onDidOpenTerminal
(
term
=>
{
equal
(
terminal
,
term
);
...
...
@@ -313,6 +292,26 @@ suite('window namespace tests', () => {
const
terminal
=
window
.
createTerminal
({
name
:
'
foo
'
,
virtualProcess
});
});
test
(
'
should fire provide dimensions on start as the terminal has been shown
'
,
(
done
)
=>
{
const
reg1
=
window
.
onDidOpenTerminal
(
term
=>
{
equal
(
terminal
,
term
);
reg1
.
dispose
();
});
const
virtualProcess
:
TerminalVirtualProcess
=
{
onDidWrite
:
new
EventEmitter
<
string
>
().
event
,
start
:
(
dimensions
)
=>
{
ok
(
dimensions
!
.
columns
>
0
);
ok
(
dimensions
!
.
rows
>
0
);
const
reg3
=
window
.
onDidCloseTerminal
(()
=>
{
reg3
.
dispose
();
done
();
});
terminal
.
dispose
();
}
};
const
terminal
=
window
.
createTerminal
({
name
:
'
foo
'
,
virtualProcess
});
});
test
(
'
should respect dimension overrides
'
,
(
done
)
=>
{
const
reg1
=
window
.
onDidOpenTerminal
(
term
=>
{
equal
(
terminal
,
term
);
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
2443cf50
...
...
@@ -1084,8 +1084,11 @@ declare module 'vscode' {
/**
* Implement to handle when the terminal is ready to start firing events.
*
* @param initialDimensions The dimensions of the terminal, this will be undefined if the
* terminal panel has not been opened before this is called.
*/
start
?():
void
;
start
?(
initialDimensions
:
TerminalDimensions
|
undefined
):
void
;
}
//#endregion
...
...
src/vs/workbench/api/browser/mainThreadTerminalService.ts
浏览文件 @
2443cf50
...
...
@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import
{
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
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
,
TerminalLaunchConfig
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalProcessExtHostProxy
,
ITerminalProcessExtHostRequest
,
ITerminalDimensions
,
EXT_HOST_CREATION_DELAY
,
IAvailableShellsRequest
,
IDefaultShellAndArgsRequest
,
ITerminalVirtualProcessRequest
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ExtHostContext
,
ExtHostTerminalServiceShape
,
MainThreadTerminalServiceShape
,
MainContext
,
IExtHostContext
,
ShellLaunchConfigDto
,
TerminalLaunchConfig
,
ITerminalDimensionsDto
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
StopWatch
}
from
'
vs/base/common/stopwatch
'
;
...
...
@@ -48,7 +48,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_toDispose
.
add
(
_terminalService
.
onInstanceDimensionsChanged
(
instance
=>
this
.
_onInstanceDimensionsChanged
(
instance
)));
this
.
_toDispose
.
add
(
_terminalService
.
onInstanceMaximumDimensionsChanged
(
instance
=>
this
.
_onInstanceMaximumDimensionsChanged
(
instance
)));
this
.
_toDispose
.
add
(
_terminalService
.
onInstanceRequestExtHostProcess
(
request
=>
this
.
_onTerminalRequestExtHostProcess
(
request
)));
this
.
_toDispose
.
add
(
_terminalService
.
onInstanceRequestVirtualProcess
(
proxy
=>
this
.
_onTerminalRequestVirtualProcess
(
proxy
)));
this
.
_toDispose
.
add
(
_terminalService
.
onInstanceRequestVirtualProcess
(
e
=>
this
.
_onTerminalRequestVirtualProcess
(
e
)));
this
.
_toDispose
.
add
(
_terminalService
.
onActiveInstanceChanged
(
instance
=>
this
.
_onActiveTerminalChanged
(
instance
?
instance
.
id
:
null
)));
this
.
_toDispose
.
add
(
_terminalService
.
onInstanceTitleChanged
(
instance
=>
this
.
_onTitleChanged
(
instance
.
id
,
instance
.
title
)));
this
.
_toDispose
.
add
(
_terminalService
.
configHelper
.
onWorkspacePermissionsChanged
(
isAllowed
=>
this
.
_onWorkspacePermissionsChanged
(
isAllowed
)));
...
...
@@ -244,12 +244,13 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
return
;
}
const
ready
=
this
.
_terminalProcessesReady
[
request
.
proxy
.
terminalId
];
const
proxy
=
request
.
proxy
;
const
ready
=
this
.
_terminalProcessesReady
[
proxy
.
terminalId
];
if
(
ready
)
{
ready
(
request
.
proxy
);
delete
this
.
_terminalProcessesReady
[
request
.
proxy
.
terminalId
];
ready
(
proxy
);
delete
this
.
_terminalProcessesReady
[
proxy
.
terminalId
];
}
else
{
this
.
_terminalProcesses
[
request
.
proxy
.
terminalId
]
=
Promise
.
resolve
(
request
.
proxy
);
this
.
_terminalProcesses
[
proxy
.
terminalId
]
=
Promise
.
resolve
(
proxy
);
}
const
shellLaunchConfigDto
:
ShellLaunchConfigDto
=
{
name
:
request
.
shellLaunchConfig
.
name
,
...
...
@@ -258,16 +259,17 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
cwd
:
request
.
shellLaunchConfig
.
cwd
,
env
:
request
.
shellLaunchConfig
.
env
};
this
.
_proxy
.
$createProcess
(
request
.
proxy
.
terminalId
,
shellLaunchConfigDto
,
request
.
activeWorkspaceRootUri
,
request
.
cols
,
request
.
rows
,
request
.
isWorkspaceShellAllowed
);
request
.
proxy
.
onInput
(
data
=>
this
.
_proxy
.
$acceptProcessInput
(
request
.
proxy
.
terminalId
,
data
));
request
.
proxy
.
onResize
(
dimensions
=>
this
.
_proxy
.
$acceptProcessResize
(
request
.
proxy
.
terminalId
,
dimensions
.
cols
,
dimensions
.
rows
));
request
.
proxy
.
onShutdown
(
immediate
=>
this
.
_proxy
.
$acceptProcessShutdown
(
request
.
proxy
.
terminalId
,
immediate
));
request
.
proxy
.
onRequestCwd
(()
=>
this
.
_proxy
.
$acceptProcessRequestCwd
(
request
.
proxy
.
terminalId
));
request
.
proxy
.
onRequestInitialCwd
(()
=>
this
.
_proxy
.
$acceptProcessRequestInitialCwd
(
request
.
proxy
.
terminalId
));
request
.
proxy
.
onRequestLatency
(()
=>
this
.
_onRequestLatency
(
request
.
proxy
.
terminalId
));
this
.
_proxy
.
$createProcess
(
proxy
.
terminalId
,
shellLaunchConfigDto
,
request
.
activeWorkspaceRootUri
,
request
.
cols
,
request
.
rows
,
request
.
isWorkspaceShellAllowed
);
proxy
.
onInput
(
data
=>
this
.
_proxy
.
$acceptProcessInput
(
proxy
.
terminalId
,
data
));
proxy
.
onResize
(
dimensions
=>
this
.
_proxy
.
$acceptProcessResize
(
proxy
.
terminalId
,
dimensions
.
cols
,
dimensions
.
rows
));
proxy
.
onShutdown
(
immediate
=>
this
.
_proxy
.
$acceptProcessShutdown
(
proxy
.
terminalId
,
immediate
));
proxy
.
onRequestCwd
(()
=>
this
.
_proxy
.
$acceptProcessRequestCwd
(
proxy
.
terminalId
));
proxy
.
onRequestInitialCwd
(()
=>
this
.
_proxy
.
$acceptProcessRequestInitialCwd
(
proxy
.
terminalId
));
proxy
.
onRequestLatency
(()
=>
this
.
_onRequestLatency
(
proxy
.
terminalId
));
}
private
_onTerminalRequestVirtualProcess
(
proxy
:
ITerminalProcessExtHostProxy
):
void
{
private
_onTerminalRequestVirtualProcess
(
request
:
ITerminalVirtualProcessRequest
):
void
{
const
proxy
=
request
.
proxy
;
const
ready
=
this
.
_terminalProcessesReady
[
proxy
.
terminalId
];
if
(
!
ready
)
{
this
.
_terminalProcesses
[
proxy
.
terminalId
]
=
Promise
.
resolve
(
proxy
);
...
...
@@ -278,6 +280,11 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
// Note that onReisze is not being listened to here as it needs to fire when max dimensions
// change, excluding the dimension override
const
initialDimensions
:
ITerminalDimensionsDto
|
undefined
=
request
.
cols
&&
request
.
rows
?
{
columns
:
request
.
cols
,
rows
:
request
.
rows
}
:
undefined
;
this
.
_proxy
.
$startVirtualProcess
(
proxy
.
terminalId
,
initialDimensions
);
proxy
.
onInput
(
data
=>
this
.
_proxy
.
$acceptProcessInput
(
proxy
.
terminalId
,
data
));
proxy
.
onShutdown
(
immediate
=>
this
.
_proxy
.
$acceptProcessShutdown
(
proxy
.
terminalId
,
immediate
));
proxy
.
onRequestCwd
(()
=>
this
.
_proxy
.
$acceptProcessRequestCwd
(
proxy
.
terminalId
));
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
2443cf50
...
...
@@ -1135,6 +1135,11 @@ export interface IShellAndArgsDto {
args
:
string
[]
|
string
|
undefined
;
}
export
interface
ITerminalDimensionsDto
{
columns
:
number
;
rows
:
number
;
}
export
interface
ExtHostTerminalServiceShape
{
$acceptTerminalClosed
(
id
:
number
):
void
;
$acceptTerminalOpened
(
id
:
number
,
name
:
string
):
void
;
...
...
@@ -1146,6 +1151,7 @@ export interface ExtHostTerminalServiceShape {
$acceptTerminalDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$acceptTerminalMaximumDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$createProcess
(
id
:
number
,
shellLaunchConfig
:
ShellLaunchConfigDto
,
activeWorkspaceRootUri
:
UriComponents
,
cols
:
number
,
rows
:
number
,
isWorkspaceShellAllowed
:
boolean
):
void
;
$startVirtualProcess
(
id
:
number
,
initialDimensions
:
ITerminalDimensionsDto
|
undefined
):
void
;
$acceptProcessInput
(
id
:
number
,
data
:
string
):
void
;
$acceptProcessResize
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$acceptProcessShutdown
(
id
:
number
,
immediate
:
boolean
):
void
;
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
2443cf50
...
...
@@ -10,7 +10,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
terminalEnvironment
from
'
vs/workbench/contrib/terminal/common/terminalEnvironment
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ExtHostTerminalServiceShape
,
MainContext
,
MainThreadTerminalServiceShape
,
IMainContext
,
ShellLaunchConfigDto
,
IShellDefinitionDto
,
IShellAndArgsDto
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostTerminalServiceShape
,
MainContext
,
MainThreadTerminalServiceShape
,
IMainContext
,
ShellLaunchConfigDto
,
IShellDefinitionDto
,
IShellAndArgsDto
,
ITerminalDimensionsDto
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostConfiguration
,
ExtHostConfigProvider
}
from
'
vs/workbench/api/common/extHostConfiguration
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
EXT_HOST_CREATION_DELAY
,
IShellLaunchConfig
,
ITerminalEnvironment
,
ITerminalChildProcess
,
ITerminalDimensions
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
...
...
@@ -329,10 +329,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
public
createVirtualProcessTerminal
(
options
:
vscode
.
TerminalVirtualProcessOptions
):
vscode
.
Terminal
{
const
terminal
=
new
ExtHostTerminal
(
this
.
_proxy
,
options
.
name
);
const
p
=
new
ExtHostVirtualProcess
(
options
.
virtualProcess
);
terminal
.
createVirtualProcess
().
then
(()
=>
{
this
.
_setupExtHostProcessListeners
(
terminal
.
_id
,
p
);
p
.
startSendingEvents
();
});
terminal
.
createVirtualProcess
().
then
(()
=>
this
.
_setupExtHostProcessListeners
(
terminal
.
_id
,
p
));
this
.
_terminals
.
push
(
terminal
);
return
terminal
;
}
...
...
@@ -344,7 +341,6 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
const
p
=
new
ExtHostVirtualProcess
(
virtualProcess
);
this
.
_setupExtHostProcessListeners
(
id
,
p
);
p
.
startSendingEvents
();
}
public
createTerminalRenderer
(
name
:
string
):
vscode
.
TerminalRenderer
{
...
...
@@ -585,6 +581,10 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
this
.
_setupExtHostProcessListeners
(
id
,
new
TerminalProcess
(
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
,
enableConpty
,
this
.
_logService
));
}
public
$startVirtualProcess
(
id
:
number
,
initialDimensions
:
ITerminalDimensionsDto
|
undefined
):
void
{
(
this
.
_terminalProcesses
[
id
]
as
ExtHostVirtualProcess
).
startSendingEvents
(
initialDimensions
);
}
private
_setupExtHostProcessListeners
(
id
:
number
,
p
:
ITerminalChildProcess
):
void
{
p
.
onProcessReady
((
e
:
{
pid
:
number
,
cwd
:
string
})
=>
this
.
_proxy
.
$sendProcessReady
(
id
,
e
.
pid
,
e
.
cwd
));
p
.
onProcessTitleChanged
(
title
=>
this
.
_proxy
.
$sendProcessTitle
(
id
,
title
));
...
...
@@ -779,7 +779,7 @@ class ExtHostVirtualProcess implements ITerminalChildProcess {
return
Promise
.
resolve
(
0
);
}
startSendingEvents
():
void
{
startSendingEvents
(
initialDimensions
:
ITerminalDimensionsDto
|
undefined
):
void
{
// Flush all buffered events
this
.
_queuedEvents
.
forEach
(
e
=>
(
<
any
>
e
.
emitter
.
fire
)(
e
.
data
));
this
.
_queuedEvents
=
[];
...
...
@@ -798,7 +798,7 @@ class ExtHostVirtualProcess implements ITerminalChildProcess {
}
if
(
this
.
_virtualProcess
.
start
)
{
this
.
_virtualProcess
.
start
();
this
.
_virtualProcess
.
start
(
initialDimensions
);
}
}
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
2443cf50
...
...
@@ -151,10 +151,21 @@ export const DEFAULT_COMMANDS_TO_SKIP_SHELL: string[] = [
let
xtermConstructor
:
Promise
<
typeof
XTermTerminal
>
|
undefined
;
interface
ICanvasDimensions
{
width
:
number
;
height
:
number
;
}
interface
IGridDimensions
{
cols
:
number
;
rows
:
number
;
}
export
class
TerminalInstance
implements
ITerminalInstance
{
private
static
readonly
EOL_REGEX
=
/
\r?\n
/g
;
private
static
_lastKnownDimensions
:
dom
.
Dimension
|
null
=
null
;
private
static
_lastKnownCanvasDimensions
:
ICanvasDimensions
|
undefined
;
private
static
_lastKnownGridDimensions
:
IGridDimensions
|
undefined
;
private
static
_idCounter
=
1
;
private
_processManager
:
ITerminalProcessManager
|
undefined
;
...
...
@@ -327,16 +338,19 @@ export class TerminalInstance implements ITerminalInstance {
private
_evaluateColsAndRows
(
width
:
number
,
height
:
number
):
number
|
null
{
// Ignore if dimensions are undefined or 0
if
(
!
width
||
!
height
)
{
this
.
_setLastKnownColsAndRows
();
return
null
;
}
const
dimension
=
this
.
_getDimension
(
width
,
height
);
if
(
!
dimension
)
{
this
.
_setLastKnownColsAndRows
();
return
null
;
}
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
);
if
(
!
font
.
charWidth
||
!
font
.
charHeight
)
{
this
.
_setLastKnownColsAndRows
();
return
null
;
}
...
...
@@ -368,21 +382,28 @@ export class TerminalInstance implements ITerminalInstance {
return
dimension
.
width
;
}
private
_setLastKnownColsAndRows
():
void
{
if
(
TerminalInstance
.
_lastKnownGridDimensions
)
{
this
.
_cols
=
TerminalInstance
.
_lastKnownGridDimensions
.
cols
;
this
.
_rows
=
TerminalInstance
.
_lastKnownGridDimensions
.
rows
;
}
}
@
debounce
(
50
)
private
_fireMaximumDimensionsChanged
():
void
{
this
.
_onMaximumDimensionsChanged
.
fire
();
}
private
_getDimension
(
width
:
number
,
height
:
number
):
dom
.
Dimension
|
null
{
private
_getDimension
(
width
:
number
,
height
:
number
):
ICanvasDimensions
|
undefined
{
// The font needs to have been initialized
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
);
if
(
!
font
||
!
font
.
charWidth
||
!
font
.
charHeight
)
{
return
null
;
return
undefined
;
}
// The panel is minimized
if
(
!
this
.
_isVisible
)
{
return
TerminalInstance
.
_lastKnownDimensions
;
return
TerminalInstance
.
_lastKnown
Canvas
Dimensions
;
}
else
{
// Trigger scroll event manually so that the viewport's scroll area is synced. This
// needs to happen otherwise its scrollTop value is invalid when the panel is toggled as
...
...
@@ -394,7 +415,7 @@ export class TerminalInstance implements ITerminalInstance {
}
if
(
!
this
.
_wrapperElement
)
{
return
null
;
return
undefined
;
}
const
wrapperElementStyle
=
getComputedStyle
(
this
.
_wrapperElement
);
...
...
@@ -405,8 +426,8 @@ export class TerminalInstance implements ITerminalInstance {
const
innerWidth
=
width
-
marginLeft
-
marginRight
;
const
innerHeight
=
height
-
bottom
;
TerminalInstance
.
_lastKnownDimensions
=
new
dom
.
Dimension
(
innerWidth
,
innerHeight
);
return
TerminalInstance
.
_lastKnownDimensions
;
TerminalInstance
.
_lastKnown
Canvas
Dimensions
=
new
dom
.
Dimension
(
innerWidth
,
innerHeight
);
return
TerminalInstance
.
_lastKnown
Canvas
Dimensions
;
}
private
async
_getXtermConstructor
():
Promise
<
typeof
XTermTerminal
>
{
...
...
@@ -1295,7 +1316,9 @@ export class TerminalInstance implements ITerminalInstance {
if
(
cols
!==
this
.
_xterm
.
cols
||
rows
!==
this
.
_xterm
.
rows
)
{
this
.
_onDimensionsChanged
.
fire
();
}
this
.
_xterm
.
resize
(
cols
,
rows
);
TerminalInstance
.
_lastKnownGridDimensions
=
{
cols
,
rows
};
if
(
this
.
_isVisible
)
{
// HACK: Force the renderer to unpause by simulating an IntersectionObserver event.
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
2443cf50
...
...
@@ -229,7 +229,7 @@ export interface ITerminalService {
onInstanceDimensionsChanged
:
Event
<
ITerminalInstance
>
;
onInstanceMaximumDimensionsChanged
:
Event
<
ITerminalInstance
>
;
onInstanceRequestExtHostProcess
:
Event
<
ITerminalProcessExtHostRequest
>
;
onInstanceRequestVirtualProcess
:
Event
<
ITerminal
ProcessExtHostProxy
>
;
onInstanceRequestVirtualProcess
:
Event
<
ITerminal
VirtualProcessRequest
>
;
onInstancesChanged
:
Event
<
void
>
;
onInstanceTitleChanged
:
Event
<
ITerminalInstance
>
;
onActiveInstanceChanged
:
Event
<
ITerminalInstance
|
undefined
>
;
...
...
@@ -297,7 +297,7 @@ export interface ITerminalService {
extHostReady
(
remoteAuthority
:
string
):
void
;
requestExtHostProcess
(
proxy
:
ITerminalProcessExtHostProxy
,
shellLaunchConfig
:
IShellLaunchConfig
,
activeWorkspaceRootUri
:
URI
,
cols
:
number
,
rows
:
number
,
isWorkspaceShellAllowed
:
boolean
):
void
;
requestVirtualProcess
(
proxy
:
ITerminalProcessExtHostProxy
):
void
;
requestVirtualProcess
(
proxy
:
ITerminalProcessExtHostProxy
,
cols
:
number
,
rows
:
number
):
void
;
}
/**
...
...
@@ -767,6 +767,12 @@ export interface ITerminalProcessExtHostRequest {
isWorkspaceShellAllowed
:
boolean
;
}
export
interface
ITerminalVirtualProcessRequest
{
proxy
:
ITerminalProcessExtHostProxy
;
cols
:
number
;
rows
:
number
;
}
export
interface
IAvailableShellsRequest
{
(
shells
:
IShellDefinition
[]):
void
;
}
...
...
src/vs/workbench/contrib/terminal/common/terminalProcessExtHostProxy.ts
浏览文件 @
2443cf50
...
...
@@ -57,7 +57,7 @@ export class TerminalProcessExtHostProxy extends Disposable implements ITerminal
// Request a process if needed, if this is a virtual process this step can be skipped as
// there is no real "process" and we know it's ready on the ext host already.
if
(
shellLaunchConfig
.
isVirtualProcess
)
{
this
.
_terminalService
.
requestVirtualProcess
(
this
);
this
.
_terminalService
.
requestVirtualProcess
(
this
,
cols
,
rows
);
}
else
{
remoteAgentService
.
getEnvironment
().
then
(
env
=>
{
if
(
!
env
)
{
...
...
src/vs/workbench/contrib/terminal/common/terminalService.ts
浏览文件 @
2443cf50
...
...
@@ -8,7 +8,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
,
TERMINAL_PANEL_ID
,
ITerminalTab
,
ITerminalProcessExtHostProxy
,
ITerminalProcessExtHostRequest
,
KEYBINDING_CONTEXT_TERMINAL_IS_OPEN
,
ITerminalNativeService
,
IShellDefinition
,
IAvailableShellsRequest
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
,
TERMINAL_PANEL_ID
,
ITerminalTab
,
ITerminalProcessExtHostProxy
,
ITerminalProcessExtHostRequest
,
KEYBINDING_CONTEXT_TERMINAL_IS_OPEN
,
ITerminalNativeService
,
IShellDefinition
,
IAvailableShellsRequest
,
ITerminalVirtualProcessRequest
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
FindReplaceState
}
from
'
vs/editor/contrib/find/findState
'
;
...
...
@@ -55,8 +55,8 @@ export abstract class TerminalService implements ITerminalService {
public
get
onInstanceProcessIdReady
():
Event
<
ITerminalInstance
>
{
return
this
.
_onInstanceProcessIdReady
.
event
;
}
protected
readonly
_onInstanceRequestExtHostProcess
=
new
Emitter
<
ITerminalProcessExtHostRequest
>
();
public
get
onInstanceRequestExtHostProcess
():
Event
<
ITerminalProcessExtHostRequest
>
{
return
this
.
_onInstanceRequestExtHostProcess
.
event
;
}
protected
readonly
_onInstanceRequestVirtualProcess
=
new
Emitter
<
ITerminal
ProcessExtHostProxy
>
();
public
get
onInstanceRequestVirtualProcess
():
Event
<
ITerminal
ProcessExtHostProxy
>
{
return
this
.
_onInstanceRequestVirtualProcess
.
event
;
}
protected
readonly
_onInstanceRequestVirtualProcess
=
new
Emitter
<
ITerminal
VirtualProcessRequest
>
();
public
get
onInstanceRequestVirtualProcess
():
Event
<
ITerminal
VirtualProcessRequest
>
{
return
this
.
_onInstanceRequestVirtualProcess
.
event
;
}
protected
readonly
_onInstanceDimensionsChanged
=
new
Emitter
<
ITerminalInstance
>
();
public
get
onInstanceDimensionsChanged
():
Event
<
ITerminalInstance
>
{
return
this
.
_onInstanceDimensionsChanged
.
event
;
}
protected
readonly
_onInstanceMaximumDimensionsChanged
=
new
Emitter
<
ITerminalInstance
>
();
...
...
@@ -144,9 +144,9 @@ export abstract class TerminalService implements ITerminalService {
});
}
public
requestVirtualProcess
(
proxy
:
ITerminalProcessExtHostProxy
):
void
{
public
requestVirtualProcess
(
proxy
:
ITerminalProcessExtHostProxy
,
cols
:
number
,
rows
:
number
):
void
{
// Don't need to wait on extensions here as this can only be triggered by an extension
this
.
_onInstanceRequestVirtualProcess
.
fire
(
proxy
);
this
.
_onInstanceRequestVirtualProcess
.
fire
(
{
proxy
,
cols
,
rows
}
);
}
public
extHostReady
(
remoteAuthority
:
string
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录