Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e384ca74
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,发现更多精彩内容 >>
提交
e384ca74
编写于
1月 28, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up terminal cwd handling
上级
88467576
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
38 deletion
+21
-38
src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
...rkbench/api/electron-browser/mainThreadTerminalService.ts
+2
-8
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+2
-11
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+9
-10
src/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts
...parts/terminal/electron-browser/terminalProcessManager.ts
+8
-9
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
浏览文件 @
e384ca74
...
...
@@ -214,14 +214,8 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
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
(()
=>
{
console
.
log
(
'
onRequestCwd
'
,
request
.
proxy
.
terminalId
);
this
.
_proxy
.
$acceptProcessRequestCwd
(
request
.
proxy
.
terminalId
);
});
request
.
proxy
.
onRequestInitialCwd
(()
=>
{
console
.
log
(
'
onRequestInitialCwd
'
,
request
.
proxy
.
terminalId
);
this
.
_proxy
.
$acceptProcessRequestInitialCwd
(
request
.
proxy
.
terminalId
);
});
request
.
proxy
.
onRequestCwd
(()
=>
this
.
_proxy
.
$acceptProcessRequestCwd
(
request
.
proxy
.
terminalId
));
request
.
proxy
.
onRequestInitialCwd
(()
=>
this
.
_proxy
.
$acceptProcessRequestInitialCwd
(
request
.
proxy
.
terminalId
));
}
public
$sendProcessTitle
(
terminalId
:
number
,
title
:
string
):
void
{
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
e384ca74
...
...
@@ -458,21 +458,12 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
this
.
_terminalProcesses
[
id
].
shutdown
(
immediate
);
}
// TODO: Also support initial cwd as it's evaluated on the ext host
public
$acceptProcessRequestInitialCwd
(
id
:
number
):
void
{
console
.
log
(
'
$acceptProcessRequestInitialCwd
'
,
id
);
this
.
_terminalProcesses
[
id
].
getInitialCwd
().
then
(
initialCwd
=>
{
console
.
log
(
'
initialCwd
'
,
initialCwd
);
this
.
_proxy
.
$sendProcessInitialCwd
(
id
,
initialCwd
);
});
this
.
_terminalProcesses
[
id
].
getInitialCwd
().
then
(
initialCwd
=>
this
.
_proxy
.
$sendProcessInitialCwd
(
id
,
initialCwd
));
}
public
$acceptProcessRequestCwd
(
id
:
number
):
void
{
console
.
log
(
'
$acceptProcessRequestCwd
'
,
id
);
this
.
_terminalProcesses
[
id
].
getCwd
().
then
(
cwd
=>
{
console
.
log
(
'
cwd
'
,
cwd
);
this
.
_proxy
.
$sendProcessCwd
(
id
,
cwd
);
});
this
.
_terminalProcesses
[
id
].
getCwd
().
then
(
cwd
=>
this
.
_proxy
.
$sendProcessCwd
(
id
,
cwd
));
}
private
_onProcessExit
(
id
:
number
,
exitCode
:
number
):
void
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
e384ca74
...
...
@@ -30,15 +30,19 @@ import { Command } from 'vs/editor/browser/editorExtensions';
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
FindReplaceState
}
from
'
vs/editor/contrib/find/findState
'
;
import
{
ISelectOptionItem
}
from
'
vs/base/browser/ui/selectBox/selectBox
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
const
TERMINAL_PICKER_PREFIX
=
'
term
'
;
function
getCwdForSplit
(
configHelper
:
ITerminalConfigHelper
,
instance
:
ITerminalInstance
,
folders
?:
IWorkspaceFolder
[],
commandService
?:
ICommandService
):
Promise
<
string
|
undefined
>
{
function
getCwdForSplit
(
configHelper
:
ITerminalConfigHelper
,
instance
:
ITerminalInstance
,
folders
?:
IWorkspaceFolder
[],
commandService
?:
ICommandService
):
Promise
<
string
|
URI
>
{
switch
(
configHelper
.
config
.
splitCwd
)
{
case
'
workspaceRoot
'
:
// allow original behavior
let
pathPromise
:
Promise
<
string
>
=
Promise
.
resolve
(
''
);
if
(
folders
.
length
>
1
)
{
let
pathPromise
:
Promise
<
string
|
URI
>
;
if
(
folders
.
length
===
0
)
{
pathPromise
=
Promise
.
resolve
(
''
);
}
else
if
(
folders
.
length
===
1
)
{
pathPromise
=
Promise
.
resolve
(
folders
[
0
].
uri
);
}
else
if
(
folders
.
length
>
1
)
{
// Only choose a path when there's more than 1 folder
const
options
:
IPickOptions
<
IQuickPickItem
>
=
{
placeHolder
:
nls
.
localize
(
'
workbench.action.terminal.newWorkspacePlaceholder
'
,
"
Select current working directory for new terminal
"
)
...
...
@@ -48,16 +52,13 @@ function getCwdForSplit(configHelper: ITerminalConfigHelper, instance: ITerminal
// Don't split the instance if the workspace picker was canceled
return
undefined
;
}
return
Promise
.
resolve
(
workspace
.
uri
.
fsPath
);
return
Promise
.
resolve
(
workspace
.
uri
);
});
}
return
pathPromise
;
case
'
initial
'
:
console
.
log
(
'
getCwdForSplit initial
'
);
return
instance
.
getInitialCwd
();
case
'
inherited
'
:
console
.
log
(
'
getCwdForSplit inherited
'
);
return
instance
.
getCwd
();
}
}
...
...
@@ -382,9 +383,7 @@ export class SplitTerminalAction extends Action {
if
(
!
instance
)
{
return
Promise
.
resolve
(
undefined
);
}
console
.
log
(
'
SplitTerminalAction
'
);
return
getCwdForSplit
(
this
.
_terminalService
.
configHelper
,
instance
,
this
.
workspaceContextService
.
getWorkspace
().
folders
,
this
.
commandService
).
then
(
cwd
=>
{
console
.
log
(
'
SplitTerminalAction cwd
'
,
cwd
);
if
(
cwd
||
(
cwd
===
''
))
{
this
.
_terminalService
.
splitInstance
(
instance
,
{
cwd
});
return
this
.
_terminalService
.
showPanel
(
true
);
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts
浏览文件 @
e384ca74
...
...
@@ -35,8 +35,6 @@ export class TerminalProcessManager implements ITerminalProcessManager {
public
processState
:
ProcessState
=
ProcessState
.
UNINITIALIZED
;
public
ptyProcessReady
:
Promise
<
void
>
;
public
shellProcessId
:
number
;
// TODO: This should be removed in favor of async getInitialCwd
public
initialCwd
:
string
;
private
_process
:
ITerminalChildProcess
|
null
=
null
;
private
_preLaunchInputQueue
:
string
[]
=
[];
...
...
@@ -92,24 +90,25 @@ export class TerminalProcessManager implements ITerminalProcessManager {
rows
:
number
):
void
{
let
launchRemotely
=
false
;
const
forceExtHostProcess
=
(
this
.
_configHelper
.
config
as
any
).
extHostProcess
;
if
(
shellLaunchConfig
.
cwd
&&
typeof
shellLaunchConfig
.
cwd
===
'
object
'
)
{
launchRemotely
=
!!
getRemoteAuthority
(
shellLaunchConfig
.
cwd
);
shellLaunchConfig
.
cwd
=
shellLaunchConfig
.
cwd
.
fsPath
;
}
else
{
launchRemotely
=
!!
this
.
_windowService
.
getConfiguration
().
remoteAuthority
||
(
this
.
_configHelper
.
config
as
any
).
extHostProcess
;
launchRemotely
=
!!
this
.
_windowService
.
getConfiguration
().
remoteAuthority
;
}
if
(
launchRemotely
)
{
const
activeWorkspaceRootUri
=
this
.
_historyService
.
getLastActiveWorkspaceRoot
(
REMOTE_HOST_SCHEME
);
if
(
launchRemotely
||
forceExtHostProcess
)
{
const
activeWorkspaceRootUri
=
this
.
_historyService
.
getLastActiveWorkspaceRoot
(
forceExtHostProcess
?
undefined
:
REMOTE_HOST_SCHEME
);
this
.
_process
=
this
.
_instantiationService
.
createInstance
(
TerminalProcessExtHostProxy
,
this
.
_terminalId
,
shellLaunchConfig
,
activeWorkspaceRootUri
,
cols
,
rows
);
}
else
{
if
(
!
shellLaunchConfig
.
executable
)
{
this
.
_configHelper
.
mergeDefaultShellPathAndArgs
(
shellLaunchConfig
);
}
// TODO: @daniel
const
activeWorkspaceRootUri
=
this
.
_historyService
.
getLastActiveWorkspaceRoot
(
Schemas
.
file
);
this
.
initialCwd
=
terminalEnvironment
.
getCwd
(
shellLaunchConfig
,
activeWorkspaceRootUri
,
this
.
_configHelper
.
config
.
cwd
);
const
initialCwd
=
terminalEnvironment
.
getCwd
(
shellLaunchConfig
,
activeWorkspaceRootUri
,
this
.
_configHelper
.
config
.
cwd
);
// Compel type system as process.env should not have any undefined entries
let
env
:
platform
.
IProcessEnvironment
=
{};
...
...
@@ -140,8 +139,8 @@ export class TerminalProcessManager implements ITerminalProcessManager {
terminalEnvironment
.
addTerminalEnvironmentKeys
(
env
,
platform
.
locale
,
this
.
_configHelper
.
config
.
setLocaleVariables
);
}
this
.
_logService
.
debug
(
`Terminal process launching`
,
shellLaunchConfig
,
this
.
initialCwd
,
cols
,
rows
,
env
);
this
.
_process
=
new
TerminalProcess
(
shellLaunchConfig
,
this
.
initialCwd
,
cols
,
rows
,
env
,
this
.
_configHelper
.
config
.
windowsEnableConpty
);
this
.
_logService
.
debug
(
`Terminal process launching`
,
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
);
this
.
_process
=
new
TerminalProcess
(
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
,
this
.
_configHelper
.
config
.
windowsEnableConpty
);
}
this
.
processState
=
ProcessState
.
LAUNCHING
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录