Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7238f384
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,发现更多精彩内容 >>
未验证
提交
7238f384
编写于
9月 10, 2021
作者:
M
Megan Rogge
提交者:
GitHub
9月 10, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow up to TerminalProperty (#132892)
上级
01936c58
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
86 addition
and
63 deletion
+86
-63
src/vs/platform/terminal/common/terminal.ts
src/vs/platform/terminal/common/terminal.ts
+12
-7
src/vs/platform/terminal/node/ptyHostService.ts
src/vs/platform/terminal/node/ptyHostService.ts
+2
-2
src/vs/platform/terminal/node/ptyService.ts
src/vs/platform/terminal/node/ptyService.ts
+4
-4
src/vs/platform/terminal/node/terminalProcess.ts
src/vs/platform/terminal/node/terminalProcess.ts
+18
-4
src/vs/workbench/api/common/extHostTerminalService.ts
src/vs/workbench/api/common/extHostTerminalService.ts
+2
-2
src/vs/workbench/contrib/terminal/browser/remotePty.ts
src/vs/workbench/contrib/terminal/browser/remotePty.ts
+18
-17
src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts
...rkbench/contrib/terminal/browser/remoteTerminalService.ts
+1
-1
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+1
-1
src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.ts
...h/contrib/terminal/browser/terminalProcessExtHostProxy.ts
+2
-2
src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts
...kbench/contrib/terminal/browser/terminalProcessManager.ts
+2
-2
src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts
...orkbench/contrib/terminal/common/remoteTerminalChannel.ts
+3
-3
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+2
-2
src/vs/workbench/contrib/terminal/electron-sandbox/localPty.ts
...s/workbench/contrib/terminal/electron-sandbox/localPty.ts
+18
-15
src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalService.ts
...contrib/terminal/electron-sandbox/localTerminalService.ts
+1
-1
未找到文件。
src/vs/platform/terminal/common/terminal.ts
浏览文件 @
7238f384
...
...
@@ -178,13 +178,18 @@ export enum TerminalIpcChannels {
export
const
IPtyService
=
createDecorator
<
IPtyService
>
(
'
ptyService
'
);
export
const
enum
TerminalPropertyType
{
c
wd
,
i
nitialCwd
C
wd
,
I
nitialCwd
}
export
interface
TerminalProperty
{
type
:
TerminalPropertyType
,
value
:
any
export
interface
ITerminalProperty
<
T
extends
TerminalPropertyType
>
{
type
:
T
,
value
:
ITerminalPropertyMap
[
T
]
}
export
interface
ITerminalPropertyMap
{
[
TerminalPropertyType
.
Cwd
]:
string
,
[
TerminalPropertyType
.
InitialCwd
]:
string
,
}
export
interface
IPtyService
{
...
...
@@ -207,7 +212,7 @@ export interface IPtyService {
readonly
onProcessOrphanQuestion
:
Event
<
{
id
:
number
}
>
;
readonly
onDidRequestDetach
:
Event
<
{
requestId
:
number
,
workspaceId
:
string
,
instanceId
:
number
}
>
;
readonly
onProcessDidChangeHasChildProcesses
:
Event
<
{
id
:
number
,
event
:
boolean
}
>
;
readonly
onDidChangeProperty
:
Event
<
{
id
:
number
,
event
:
TerminalProperty
}
>
readonly
onDidChangeProperty
:
Event
<
{
id
:
number
,
property
:
ITerminalProperty
<
any
>
}
>
restartPtyHost
?():
Promise
<
void
>
;
shutdownAll
?():
Promise
<
void
>
;
...
...
@@ -483,7 +488,7 @@ export interface ITerminalChildProcess {
onProcessOverrideDimensions
?:
Event
<
ITerminalDimensionsOverride
|
undefined
>
;
onProcessResolvedShellLaunchConfig
?:
Event
<
IShellLaunchConfig
>
;
onDidChangeHasChildProcesses
?:
Event
<
boolean
>
;
onDidChangeProperty
:
Event
<
TerminalProperty
>
;
onDidChangeProperty
:
Event
<
ITerminalProperty
<
any
>
>
;
/**
* Starts the process.
...
...
src/vs/platform/terminal/node/ptyHostService.ts
浏览文件 @
7238f384
...
...
@@ -15,7 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
LogLevelChannelClient
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
RequestStore
}
from
'
vs/platform/terminal/common/requestStore
'
;
import
{
HeartbeatConstants
,
IHeartbeatService
,
IProcessDataEvent
,
IPtyService
,
IReconnectConstants
,
IRequestResolveVariablesEvent
,
IShellLaunchConfig
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
ITerminalProfile
,
ITerminalsLayoutInfo
,
TerminalIcon
,
TerminalIpcChannels
,
TerminalProperty
,
TerminalShellType
,
TitleEventSource
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
HeartbeatConstants
,
IHeartbeatService
,
IProcessDataEvent
,
IPtyService
,
IReconnectConstants
,
IRequestResolveVariablesEvent
,
IShellLaunchConfig
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
ITerminalProfile
,
ITerminalsLayoutInfo
,
TerminalIcon
,
TerminalIpcChannels
,
I
TerminalProperty
,
TerminalShellType
,
TitleEventSource
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
registerTerminalPlatformConfiguration
}
from
'
vs/platform/terminal/common/terminalPlatformConfiguration
'
;
import
{
IGetTerminalLayoutInfoArgs
,
IProcessDetails
,
IPtyHostProcessReplayEvent
,
ISetTerminalLayoutInfoArgs
}
from
'
vs/platform/terminal/common/terminalProcess
'
;
import
{
detectAvailableProfiles
}
from
'
vs/platform/terminal/node/terminalProfiles
'
;
...
...
@@ -83,7 +83,7 @@ export class PtyHostService extends Disposable implements IPtyService {
readonly
onDidRequestDetach
=
this
.
_onDidRequestDetach
.
event
;
private
readonly
_onProcessDidChangeHasChildProcesses
=
this
.
_register
(
new
Emitter
<
{
id
:
number
,
event
:
boolean
}
>
());
readonly
onProcessDidChangeHasChildProcesses
=
this
.
_onProcessDidChangeHasChildProcesses
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
{
id
:
number
,
event
:
TerminalProperty
}
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
{
id
:
number
,
property
:
ITerminalProperty
<
any
>
}
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
constructor
(
...
...
src/vs/platform/terminal/node/ptyService.ts
浏览文件 @
7238f384
...
...
@@ -12,7 +12,7 @@ import { URI } from 'vs/base/common/uri';
import
{
getSystemShell
}
from
'
vs/base/node/shell
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
RequestStore
}
from
'
vs/platform/terminal/common/requestStore
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IPtyService
,
IRawTerminalInstanceLayoutInfo
,
IReconnectConstants
,
IRequestResolveVariablesEvent
,
IShellLaunchConfig
,
ITerminalDimensionsOverride
,
ITerminalInstanceLayoutInfoById
,
ITerminalLaunchError
,
ITerminalsLayoutInfo
,
ITerminalTabLayoutInfoById
,
TerminalIcon
,
TerminalProperty
,
TerminalShellType
,
TitleEventSource
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IPtyService
,
IRawTerminalInstanceLayoutInfo
,
IReconnectConstants
,
IRequestResolveVariablesEvent
,
IShellLaunchConfig
,
ITerminalDimensionsOverride
,
ITerminalInstanceLayoutInfoById
,
ITerminalLaunchError
,
ITerminalsLayoutInfo
,
ITerminalTabLayoutInfoById
,
TerminalIcon
,
I
TerminalProperty
,
TerminalShellType
,
TitleEventSource
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
TerminalDataBufferer
}
from
'
vs/platform/terminal/common/terminalDataBuffering
'
;
import
{
escapeNonWindowsPath
}
from
'
vs/platform/terminal/common/terminalEnvironment
'
;
import
{
Terminal
as
XtermTerminal
}
from
'
xterm-headless
'
;
...
...
@@ -60,7 +60,7 @@ export class PtyService extends Disposable implements IPtyService {
readonly
onDidRequestDetach
=
this
.
_onDidRequestDetach
.
event
;
private
readonly
_onProcessDidChangeHasChildProcesses
=
this
.
_register
(
new
Emitter
<
{
id
:
number
,
event
:
boolean
}
>
());
readonly
onProcessDidChangeHasChildProcesses
=
this
.
_onProcessDidChangeHasChildProcesses
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
{
id
:
number
,
event
:
TerminalProperty
}
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
{
id
:
number
,
property
:
ITerminalProperty
<
any
>
}
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
constructor
(
...
...
@@ -140,7 +140,7 @@ export class PtyService extends Disposable implements IPtyService {
persistentProcess
.
onProcessReplay
(
event
=>
this
.
_onProcessReplay
.
fire
({
id
,
event
}));
persistentProcess
.
onProcessReady
(
event
=>
this
.
_onProcessReady
.
fire
({
id
,
event
}));
persistentProcess
.
onProcessTitleChanged
(
event
=>
this
.
_onProcessTitleChanged
.
fire
({
id
,
event
}));
persistentProcess
.
onDidChangeProperty
(
event
=>
this
.
_onDidChangeProperty
.
fire
({
id
,
event
}));
persistentProcess
.
onDidChangeProperty
(
property
=>
this
.
_onDidChangeProperty
.
fire
({
id
,
property
}));
persistentProcess
.
onProcessShellTypeChanged
(
event
=>
this
.
_onProcessShellTypeChanged
.
fire
({
id
,
event
}));
persistentProcess
.
onProcessOrphanQuestion
(()
=>
this
.
_onProcessOrphanQuestion
.
fire
({
id
}));
this
.
_ptys
.
set
(
id
,
persistentProcess
);
...
...
@@ -342,7 +342,7 @@ export class PersistentTerminalProcess extends Disposable {
readonly
onProcessData
=
this
.
_onProcessData
.
event
;
private
readonly
_onProcessOrphanQuestion
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onProcessOrphanQuestion
=
this
.
_onProcessOrphanQuestion
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
TerminalProperty
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
ITerminalProperty
<
any
>
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
private
_inReplay
=
false
;
...
...
src/vs/platform/terminal/node/terminalProcess.ts
浏览文件 @
7238f384
...
...
@@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri';
import
{
Promises
}
from
'
vs/base/node/pfs
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
FlowControlConstants
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
TerminalProperty
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
FlowControlConstants
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
ITerminalProperty
,
TerminalPropertyType
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
ChildProcessMonitor
}
from
'
vs/platform/terminal/node/childProcessMonitor
'
;
import
{
findExecutable
,
getWindowsBuildNumber
}
from
'
vs/platform/terminal/node/terminalEnvironment
'
;
import
{
WindowsShellHelper
}
from
'
vs/platform/terminal/node/windowsShellHelper
'
;
...
...
@@ -77,6 +77,8 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
readonly
id
=
0
;
readonly
shouldPersist
=
false
;
currentCwd
:
string
|
undefined
=
undefined
;
private
static
_lastKillOrStart
=
0
;
private
_exitCode
:
number
|
undefined
;
...
...
@@ -114,7 +116,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
readonly
onProcessShellTypeChanged
=
this
.
_onProcessShellTypeChanged
.
event
;
private
readonly
_onDidChangeHasChildProcesses
=
this
.
_register
(
new
Emitter
<
boolean
>
());
readonly
onDidChangeHasChildProcesses
=
this
.
_onDidChangeHasChildProcesses
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
TerminalProperty
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
ITerminalProperty
<
any
>
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
onProcessOverrideDimensions
?:
Event
<
ITerminalDimensionsOverride
|
undefined
>
|
undefined
;
...
...
@@ -143,6 +145,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
name
=
'
xterm-256color
'
;
}
this
.
_initialCwd
=
cwd
;
this
.
currentCwd
=
cwd
;
const
useConpty
=
windowsEnableConpty
&&
process
.
platform
===
'
win32
'
&&
getWindowsBuildNumber
()
>=
18309
;
this
.
_ptyOptions
=
{
name
,
...
...
@@ -203,6 +206,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
return
{
message
:
localize
(
'
launchFail.cwdDoesNotExist
'
,
"
Starting directory (cwd)
\"
{0}
\"
does not exist
"
,
this
.
_initialCwd
.
toString
())
};
}
}
this
.
_onDidChangeProperty
.
fire
({
type
:
TerminalPropertyType
.
InitialCwd
,
value
:
this
.
_initialCwd
});
return
undefined
;
}
...
...
@@ -494,7 +498,12 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
this
.
_logService
.
trace
(
'
IPty#pid
'
);
exec
(
'
lsof -OPln -p
'
+
this
.
_ptyProcess
.
pid
+
'
| grep cwd
'
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
!
error
&&
stdout
!==
''
)
{
resolve
(
stdout
.
substring
(
stdout
.
indexOf
(
'
/
'
),
stdout
.
length
-
1
));
const
newCwd
=
stdout
.
substring
(
stdout
.
indexOf
(
'
/
'
),
stdout
.
length
-
1
);
if
(
this
.
currentCwd
!==
newCwd
)
{
this
.
currentCwd
=
newCwd
;
this
.
_onDidChangeProperty
.
fire
({
type
:
TerminalPropertyType
.
Cwd
,
value
:
this
.
currentCwd
});
resolve
(
newCwd
);
}
}
else
{
this
.
_logService
.
error
(
'
lsof did not run successfully, it may not be on the $PATH?
'
,
error
,
stdout
,
stderr
);
resolve
(
this
.
_initialCwd
);
...
...
@@ -510,7 +519,12 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
}
this
.
_logService
.
trace
(
'
IPty#pid
'
);
try
{
return
await
Promises
.
readlink
(
`/proc/
${
this
.
_ptyProcess
.
pid
}
/cwd`
);
const
newCwd
=
await
Promises
.
readlink
(
`/proc/
${
this
.
_ptyProcess
.
pid
}
/cwd`
);
if
(
newCwd
!==
this
.
currentCwd
)
{
this
.
currentCwd
=
newCwd
;
this
.
_onDidChangeProperty
.
fire
({
type
:
TerminalPropertyType
.
Cwd
,
value
:
this
.
currentCwd
});
}
return
this
.
currentCwd
;
}
catch
(
error
)
{
return
this
.
_initialCwd
;
}
...
...
src/vs/workbench/api/common/extHostTerminalService.ts
浏览文件 @
7238f384
...
...
@@ -18,7 +18,7 @@ import { serializeEnvironmentVariableCollection } from 'vs/workbench/contrib/ter
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
ISerializableEnvironmentVariableCollection
}
from
'
vs/workbench/contrib/terminal/common/environmentVariable
'
;
import
{
ICreateContributedTerminalProfileOptions
,
IProcessReadyEvent
,
IShellLaunchConfigDto
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
ITerminalProfile
,
TerminalIcon
,
TerminalLocation
,
TerminalProperty
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
ICreateContributedTerminalProfileOptions
,
IProcessReadyEvent
,
IShellLaunchConfigDto
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
ITerminalProfile
,
TerminalIcon
,
TerminalLocation
,
I
TerminalProperty
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
TerminalDataBufferer
}
from
'
vs/platform/terminal/common/terminalDataBuffering
'
;
import
{
ThemeColor
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
...
...
@@ -250,7 +250,7 @@ export class ExtHostPseudoterminal implements ITerminalChildProcess {
public
get
onProcessOverrideDimensions
():
Event
<
ITerminalDimensionsOverride
|
undefined
>
{
return
this
.
_onProcessOverrideDimensions
.
event
;
}
private
readonly
_onProcessShellTypeChanged
=
new
Emitter
<
TerminalShellType
>
();
public
readonly
onProcessShellTypeChanged
=
this
.
_onProcessShellTypeChanged
.
event
;
private
readonly
_onDidChangeProperty
=
new
Emitter
<
TerminalProperty
>
();
private
readonly
_onDidChangeProperty
=
new
Emitter
<
ITerminalProperty
<
any
>
>
();
public
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
...
...
src/vs/workbench/contrib/terminal/browser/remotePty.ts
浏览文件 @
7238f384
...
...
@@ -8,14 +8,16 @@ import { Emitter } from 'vs/base/common/event';
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
TerminalProperty
,
TerminalPropertyType
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
I
TerminalProperty
,
TerminalPropertyType
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IPtyHostProcessReplayEvent
}
from
'
vs/platform/terminal/common/terminalProcess
'
;
import
{
RemoteTerminalChannelClient
}
from
'
vs/workbench/contrib/terminal/common/remoteTerminalChannel
'
;
import
{
IRemoteAgentService
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
export
class
RemotePty
extends
Disposable
implements
ITerminalChildProcess
{
initialCwd
:
string
|
undefined
=
undefined
;
cwd
:
string
|
undefined
=
undefined
;
private
_properties
:
{
cwd
:
string
;
initialCwd
:
string
};
private
readonly
_onProcessData
=
this
.
_register
(
new
Emitter
<
string
|
IProcessDataEvent
>
());
readonly
onProcessData
=
this
.
_onProcessData
.
event
;
private
readonly
_onProcessExit
=
this
.
_register
(
new
Emitter
<
number
|
undefined
>
());
...
...
@@ -32,7 +34,7 @@ export class RemotePty extends Disposable implements ITerminalChildProcess {
readonly
onProcessResolvedShellLaunchConfig
=
this
.
_onProcessResolvedShellLaunchConfig
.
event
;
private
readonly
_onDidChangeHasChildProcesses
=
this
.
_register
(
new
Emitter
<
boolean
>
());
readonly
onDidChangeHasChildProcesses
=
this
.
_onDidChangeHasChildProcesses
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
TerminalProperty
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
ITerminalProperty
<
any
>
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
private
_startBarrier
:
Barrier
;
...
...
@@ -49,6 +51,10 @@ export class RemotePty extends Disposable implements ITerminalChildProcess {
private
readonly
_logService
:
ILogService
)
{
super
();
this
.
_properties
=
{
cwd
:
''
,
initialCwd
:
''
};
this
.
_startBarrier
=
new
Barrier
();
}
...
...
@@ -120,21 +126,11 @@ export class RemotePty extends Disposable implements ITerminalChildProcess {
}
async
getInitialCwd
():
Promise
<
string
>
{
if
(
!
this
.
initialCwd
)
{
await
this
.
_startBarrier
.
wait
();
this
.
initialCwd
=
await
this
.
_remoteTerminalChannel
.
getInitialCwd
(
this
.
_id
);
}
return
this
.
initialCwd
;
return
this
.
_properties
.
initialCwd
;
}
async
getCwd
():
Promise
<
string
>
{
await
this
.
_startBarrier
.
wait
();
const
cwd
=
await
this
.
_remoteTerminalChannel
.
getCwd
(
this
.
_id
);
if
(
this
.
cwd
!==
cwd
)
{
this
.
cwd
=
cwd
;
this
.
handleDidChangeProperty
({
type
:
TerminalPropertyType
.
cwd
,
value
:
this
.
cwd
});
}
return
this
.
cwd
;
return
this
.
_properties
.
cwd
||
this
.
_properties
.
initialCwd
;
}
handleData
(
e
:
string
|
IProcessDataEvent
)
{
...
...
@@ -168,7 +164,12 @@ export class RemotePty extends Disposable implements ITerminalChildProcess {
handleDidChangeHasChildProcesses
(
e
:
boolean
)
{
this
.
_onDidChangeHasChildProcesses
.
fire
(
e
);
}
handleDidChangeProperty
(
e
:
TerminalProperty
)
{
handleDidChangeProperty
(
e
:
ITerminalProperty
<
any
>
)
{
if
(
e
.
type
===
TerminalPropertyType
.
Cwd
)
{
this
.
_properties
.
cwd
=
e
.
value
;
}
else
if
(
e
.
type
===
TerminalPropertyType
.
InitialCwd
)
{
this
.
_properties
.
initialCwd
=
e
.
value
;
}
this
.
_onDidChangeProperty
.
fire
(
e
);
}
...
...
src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts
浏览文件 @
7238f384
...
...
@@ -79,7 +79,7 @@ export class RemoteTerminalService extends Disposable implements IRemoteTerminal
channel
.
onProcessOrphanQuestion
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleOrphanQuestion
());
channel
.
onDidRequestDetach
(
e
=>
this
.
_onDidRequestDetach
.
fire
(
e
));
channel
.
onProcessDidChangeHasChildProcesses
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleDidChangeHasChildProcesses
(
e
.
event
));
channel
.
onDidChangeProperty
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleDidChangeProperty
(
e
.
event
));
channel
.
onDidChangeProperty
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleDidChangeProperty
(
e
.
property
));
const
allowedCommands
=
[
'
_remoteCLI.openExternal
'
,
'
_remoteCLI.windowOpen
'
,
'
_remoteCLI.getSystemStatus
'
,
'
_remoteCLI.manageExtensions
'
];
channel
.
onExecuteCommand
(
async
e
=>
{
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
7238f384
...
...
@@ -1160,7 +1160,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
// Set the initial name based on the _resolved_ shell launch config, this will also
// ensure the resolved icon gets shown
this
.
_processManager
.
onDidChangeProperty
(
e
=>
{
if
(
e
.
type
===
TerminalPropertyType
.
cwd
||
e
.
type
===
TerminalPropertyType
.
i
nitialCwd
)
{
if
(
e
.
type
===
TerminalPropertyType
.
Cwd
||
e
.
type
===
TerminalPropertyType
.
I
nitialCwd
)
{
this
.
_cwd
=
e
.
value
;
this
.
setTitle
(
this
.
title
,
TitleEventSource
.
Api
);
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.ts
浏览文件 @
7238f384
...
...
@@ -5,7 +5,7 @@
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensions
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
TerminalProperty
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensions
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
I
TerminalProperty
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
ITerminalService
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
ITerminalProcessExtHostProxy
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
...
...
@@ -46,7 +46,7 @@ export class TerminalProcessExtHostProxy extends Disposable implements ITerminal
readonly
onRequestLatency
:
Event
<
void
>
=
this
.
_onRequestLatency
.
event
;
private
readonly
_onProcessShellTypeChanged
=
this
.
_register
(
new
Emitter
<
TerminalShellType
>
());
readonly
onProcessShellTypeChanged
=
this
.
_onProcessShellTypeChanged
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
TerminalProperty
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
ITerminalProperty
<
any
>
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
...
...
src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts
浏览文件 @
7238f384
...
...
@@ -22,7 +22,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
import
{
EnvironmentVariableInfoChangesActive
,
EnvironmentVariableInfoStale
}
from
'
vs/workbench/contrib/terminal/browser/environmentVariableInfo
'
;
import
{
IPathService
}
from
'
vs/workbench/services/path/common/pathService
'
;
import
{
IEnvironmentVariableInfo
,
IEnvironmentVariableService
,
IMergedEnvironmentVariableCollection
}
from
'
vs/workbench/contrib/terminal/common/environmentVariable
'
;
import
{
IProcessDataEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalEnvironment
,
ITerminalLaunchError
,
FlowControlConstants
,
TerminalShellType
,
ITerminalDimensions
,
TerminalSettingId
,
IProcessReadyEvent
,
TerminalProperty
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IProcessDataEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalEnvironment
,
ITerminalLaunchError
,
FlowControlConstants
,
TerminalShellType
,
ITerminalDimensions
,
TerminalSettingId
,
IProcessReadyEvent
,
I
TerminalProperty
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
TerminalRecorder
}
from
'
vs/platform/terminal/common/terminalRecorder
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
formatMessageForTerminal
}
from
'
vs/workbench/contrib/terminal/common/terminalStrings
'
;
...
...
@@ -96,7 +96,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
readonly
onProcessData
=
this
.
_onProcessData
.
event
;
private
readonly
_onProcessTitle
=
this
.
_register
(
new
Emitter
<
string
>
());
readonly
onProcessTitle
=
this
.
_onProcessTitle
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
TerminalProperty
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
ITerminalProperty
<
any
>
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
private
readonly
_onProcessShellTypeChanged
=
this
.
_register
(
new
Emitter
<
TerminalShellType
>
());
readonly
onProcessShellTypeChanged
=
this
.
_onProcessShellTypeChanged
.
event
;
...
...
src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts
浏览文件 @
7238f384
...
...
@@ -18,7 +18,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
IEnvironmentVariableService
,
ISerializableEnvironmentVariableCollection
}
from
'
vs/workbench/contrib/terminal/common/environmentVariable
'
;
import
{
IProcessDataEvent
,
IRequestResolveVariablesEvent
,
IShellLaunchConfig
,
IShellLaunchConfigDto
,
ITerminalDimensionsOverride
,
ITerminalEnvironment
,
ITerminalLaunchError
,
ITerminalProfile
,
ITerminalsLayoutInfo
,
ITerminalsLayoutInfoById
,
TerminalIcon
,
TerminalProperty
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IProcessDataEvent
,
IRequestResolveVariablesEvent
,
IShellLaunchConfig
,
IShellLaunchConfigDto
,
ITerminalDimensionsOverride
,
ITerminalEnvironment
,
ITerminalLaunchError
,
ITerminalProfile
,
ITerminalsLayoutInfo
,
ITerminalsLayoutInfoById
,
TerminalIcon
,
I
TerminalProperty
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IGetTerminalLayoutInfoArgs
,
IProcessDetails
,
IPtyHostProcessReplayEvent
,
ISetTerminalLayoutInfoArgs
}
from
'
vs/platform/terminal/common/terminalProcess
'
;
import
{
IProcessEnvironment
,
OperatingSystem
}
from
'
vs/base/common/platform
'
;
...
...
@@ -124,8 +124,8 @@ export class RemoteTerminalChannelClient {
get
onDidRequestDetach
():
Event
<
{
requestId
:
number
,
workspaceId
:
string
,
instanceId
:
number
}
>
{
return
this
.
_channel
.
listen
<
{
requestId
:
number
,
workspaceId
:
string
,
instanceId
:
number
}
>
(
'
$onDidRequestDetach
'
);
}
get
onDidChangeProperty
():
Event
<
{
id
:
number
,
event
:
TerminalProperty
}
>
{
return
this
.
_channel
.
listen
<
{
id
:
number
,
event
:
TerminalProperty
}
>
(
'
$onDidChangeProperty
'
);
get
onDidChangeProperty
():
Event
<
{
id
:
number
,
property
:
ITerminalProperty
<
any
>
}
>
{
return
this
.
_channel
.
listen
<
{
id
:
number
,
property
:
ITerminalProperty
<
any
>
}
>
(
'
$onDidChangeProperty
'
);
}
constructor
(
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
7238f384
...
...
@@ -8,7 +8,7 @@ import { Event } from 'vs/base/common/event';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IProcessEnvironment
,
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IExtensionPointDescriptor
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensions
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
ITerminalProfile
,
ITerminalProfileObject
,
ITerminalsLayoutInfo
,
ITerminalsLayoutInfoById
,
TerminalIcon
,
TerminalLocationString
,
TerminalProperty
,
TerminalShellType
,
TitleEventSource
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensions
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
ITerminalProfile
,
ITerminalProfileObject
,
ITerminalsLayoutInfo
,
ITerminalsLayoutInfoById
,
TerminalIcon
,
TerminalLocationString
,
I
TerminalProperty
,
TerminalShellType
,
TitleEventSource
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IEnvironmentVariableInfo
}
from
'
vs/workbench/contrib/terminal/common/environmentVariable
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -291,13 +291,13 @@ export interface ITerminalProcessManager extends IDisposable {
readonly
onBeforeProcessData
:
Event
<
IBeforeProcessDataEvent
>
;
readonly
onProcessData
:
Event
<
IProcessDataEvent
>
;
readonly
onProcessTitle
:
Event
<
string
>
;
readonly
onDidChangeProperty
:
Event
<
TerminalProperty
>
;
readonly
onProcessShellTypeChanged
:
Event
<
TerminalShellType
>
;
readonly
onProcessExit
:
Event
<
number
|
undefined
>
;
readonly
onProcessOverrideDimensions
:
Event
<
ITerminalDimensionsOverride
|
undefined
>
;
readonly
onProcessResolvedShellLaunchConfig
:
Event
<
IShellLaunchConfig
>
;
readonly
onProcessDidChangeHasChildProcesses
:
Event
<
boolean
>
;
readonly
onEnvironmentVariableInfoChanged
:
Event
<
IEnvironmentVariableInfo
>
;
readonly
onDidChangeProperty
:
Event
<
ITerminalProperty
<
any
>>
;
dispose
(
immediate
?:
boolean
):
void
;
detachFromProcess
():
Promise
<
void
>
;
...
...
src/vs/workbench/contrib/terminal/electron-sandbox/localPty.ts
浏览文件 @
7238f384
...
...
@@ -6,7 +6,7 @@
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ILocalPtyService
}
from
'
vs/platform/terminal/electron-sandbox/terminal
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
TerminalProperty
,
TerminalPropertyType
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IProcessDataEvent
,
IProcessReadyEvent
,
IShellLaunchConfig
,
ITerminalChildProcess
,
ITerminalDimensionsOverride
,
ITerminalLaunchError
,
I
TerminalProperty
,
TerminalPropertyType
,
TerminalShellType
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
IPtyHostProcessReplayEvent
}
from
'
vs/platform/terminal/common/terminalProcess
'
;
/**
...
...
@@ -15,8 +15,10 @@ import { IPtyHostProcessReplayEvent } from 'vs/platform/terminal/common/terminal
*/
export
class
LocalPty
extends
Disposable
implements
ITerminalChildProcess
{
private
_inReplay
=
false
;
initialCwd
:
string
|
undefined
=
undefined
;
cwd
:
string
|
undefined
=
undefined
;
private
_properties
:
{
cwd
:
string
;
initialCwd
:
string
};
private
readonly
_onProcessData
=
this
.
_register
(
new
Emitter
<
IProcessDataEvent
|
string
>
());
readonly
onProcessData
=
this
.
_onProcessData
.
event
;
private
readonly
_onProcessReplay
=
this
.
_register
(
new
Emitter
<
IPtyHostProcessReplayEvent
>
());
...
...
@@ -35,7 +37,7 @@ export class LocalPty extends Disposable implements ITerminalChildProcess {
readonly
onProcessShellTypeChanged
=
this
.
_onProcessShellTypeChanged
.
event
;
private
readonly
_onDidChangeHasChildProcesses
=
this
.
_register
(
new
Emitter
<
boolean
>
());
readonly
onDidChangeHasChildProcesses
=
this
.
_onDidChangeHasChildProcesses
.
event
;
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
TerminalProperty
>
());
private
readonly
_onDidChangeProperty
=
this
.
_register
(
new
Emitter
<
ITerminalProperty
<
any
>
>
());
readonly
onDidChangeProperty
=
this
.
_onDidChangeProperty
.
event
;
constructor
(
...
...
@@ -44,6 +46,10 @@ export class LocalPty extends Disposable implements ITerminalChildProcess {
@
ILocalPtyService
private
readonly
_localPtyService
:
ILocalPtyService
)
{
super
();
this
.
_properties
=
{
cwd
:
''
,
initialCwd
:
''
};
}
start
():
Promise
<
ITerminalLaunchError
|
undefined
>
{
...
...
@@ -74,18 +80,10 @@ export class LocalPty extends Disposable implements ITerminalChildProcess {
this
.
_localPtyService
.
resize
(
this
.
id
,
cols
,
rows
);
}
async
getInitialCwd
():
Promise
<
string
>
{
if
(
!
this
.
initialCwd
)
{
this
.
initialCwd
=
await
this
.
_localPtyService
.
getInitialCwd
(
this
.
id
);
}
return
this
.
initialCwd
;
return
this
.
_properties
.
initialCwd
;
}
async
getCwd
():
Promise
<
string
>
{
const
cwd
=
await
this
.
_localPtyService
.
getCwd
(
this
.
id
);
if
(
this
.
cwd
!==
cwd
)
{
this
.
cwd
=
cwd
;
this
.
handleDidChangeProperty
({
type
:
TerminalPropertyType
.
cwd
,
value
:
this
.
cwd
});
}
return
this
.
cwd
;
return
this
.
_properties
.
cwd
||
this
.
_properties
.
initialCwd
;
}
getLatency
():
Promise
<
number
>
{
// TODO: The idea here was to add the result plus the time it took to get the latency
...
...
@@ -125,7 +123,12 @@ export class LocalPty extends Disposable implements ITerminalChildProcess {
handleDidChangeHasChildProcesses
(
e
:
boolean
)
{
this
.
_onDidChangeHasChildProcesses
.
fire
(
e
);
}
handleDidChangeProperty
(
e
:
TerminalProperty
)
{
handleDidChangeProperty
(
e
:
ITerminalProperty
<
any
>
)
{
if
(
e
.
type
===
TerminalPropertyType
.
Cwd
)
{
this
.
_properties
.
cwd
=
e
.
value
;
}
else
if
(
e
.
type
===
TerminalPropertyType
.
InitialCwd
)
{
this
.
_properties
.
initialCwd
=
e
.
value
;
}
this
.
_onDidChangeProperty
.
fire
(
e
);
}
...
...
src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalService.ts
浏览文件 @
7238f384
...
...
@@ -66,7 +66,7 @@ export class LocalTerminalService extends Disposable implements ILocalTerminalSe
this
.
_localPtyService
.
onProcessOverrideDimensions
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleOverrideDimensions
(
e
.
event
));
this
.
_localPtyService
.
onProcessResolvedShellLaunchConfig
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleResolvedShellLaunchConfig
(
e
.
event
));
this
.
_localPtyService
.
onProcessDidChangeHasChildProcesses
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleDidChangeHasChildProcesses
(
e
.
event
));
this
.
_localPtyService
.
onDidChangeProperty
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleDidChangeProperty
(
e
.
event
));
this
.
_localPtyService
.
onDidChangeProperty
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleDidChangeProperty
(
e
.
property
));
this
.
_localPtyService
.
onProcessReplay
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleReplay
(
e
.
event
));
this
.
_localPtyService
.
onProcessOrphanQuestion
(
e
=>
this
.
_ptys
.
get
(
e
.
id
)?.
handleOrphanQuestion
());
this
.
_localPtyService
.
onDidRequestDetach
(
e
=>
this
.
_onDidRequestDetach
.
fire
(
e
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录