Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2613d48d
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,发现更多精彩内容 >>
提交
2613d48d
编写于
6月 11, 2018
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
start debug terminal from ext host
上级
8f120f6f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
80 deletion
+55
-80
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
.../workbench/api/electron-browser/mainThreadDebugService.ts
+3
-32
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+0
-2
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+43
-13
src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts
...workbench/parts/debug/electron-browser/terminalSupport.ts
+8
-32
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
浏览文件 @
2613d48d
...
...
@@ -6,7 +6,7 @@
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
uri
from
'
vs/base/common/uri
'
;
import
{
IDebugService
,
IConfig
,
IDebugConfigurationProvider
,
IBreakpoint
,
IFunctionBreakpoint
,
IBreakpointData
,
IAdapterExecutable
,
ITerminalSettings
,
IDebugAdapter
,
IDebugAdapterProvider
,
ITerminalLauncher
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IDebugService
,
IConfig
,
IDebugConfigurationProvider
,
IBreakpoint
,
IFunctionBreakpoint
,
IBreakpointData
,
IAdapterExecutable
,
ITerminalSettings
,
IDebugAdapter
,
IDebugAdapterProvider
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ExtHostContext
,
ExtHostDebugServiceShape
,
MainThreadDebugServiceShape
,
DebugSessionUUID
,
MainContext
,
...
...
@@ -18,8 +18,6 @@ import { AbstractDebugAdapter } from 'vs/workbench/parts/debug/node/debugAdapter
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
convertToVSCPaths
,
convertToDAPaths
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
ITerminalService
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
AbstractTerminalLauncher
}
from
'
vs/workbench/parts/debug/electron-browser/terminalSupport
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadDebugService
)
...
...
@@ -30,13 +28,11 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
private
_breakpointEventsActive
:
boolean
;
private
_debugAdapters
:
Map
<
number
,
ExtensionHostDebugAdapter
>
;
private
_debugAdaptersHandleCounter
=
1
;
private
_terminalLauncher
:
ITerminalLauncher
;
constructor
(
extHostContext
:
IExtHostContext
,
@
IDebugService
private
debugService
:
IDebugService
,
@
ITerminalService
private
terminalService
:
ITerminalService
,
@
IDebugService
private
debugService
:
IDebugService
)
{
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostDebugService
);
this
.
_toDispose
=
[];
...
...
@@ -77,10 +73,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
}
runInTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
{
if
(
!
this
.
_terminalLauncher
)
{
this
.
_terminalLauncher
=
new
ExtensionTerminalLauncher
(
this
.
terminalService
,
this
.
_proxy
);
}
return
this
.
_terminalLauncher
.
runInTerminal
(
args
,
config
);
return
this
.
_proxy
.
$runInTerminal
(
args
,
config
);
}
public
dispose
():
void
{
...
...
@@ -303,25 +296,3 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
return
this
.
_proxy
.
$stopDASession
(
this
.
_handle
);
}
}
export
class
ExtensionTerminalLauncher
extends
AbstractTerminalLauncher
{
constructor
(
@
ITerminalService
terminalService
:
ITerminalService
,
private
_proxy
:
ExtHostDebugServiceShape
)
{
super
(
terminalService
);
}
protected
runInExternalTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
{
return
this
.
_proxy
.
$runInTerminal
(
args
,
config
);
}
protected
isBusy
(
processId
:
number
):
TPromise
<
boolean
>
{
return
this
.
_proxy
.
$isTerminalBusy
(
processId
);
}
protected
prepareCommand
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
any
>
{
return
this
.
_proxy
.
$prepareCommandForTerminal
(
args
,
config
);
}
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
2613d48d
...
...
@@ -112,7 +112,6 @@ export function createApiFactory(
const
extHostCommands
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostCommands
,
new
ExtHostCommands
(
rpcProtocol
,
extHostHeapService
,
extHostLogService
));
const
extHostTreeViews
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostTreeViews
,
new
ExtHostTreeViews
(
rpcProtocol
.
getProxy
(
MainContext
.
MainThreadTreeViews
),
extHostCommands
));
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostWorkspace
,
extHostWorkspace
);
const
extHostDebugService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDebugService
,
new
ExtHostDebugService
(
rpcProtocol
,
extHostWorkspace
,
extensionService
,
extHostDocumentsAndEditors
,
extHostConfiguration
));
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostConfiguration
,
extHostConfiguration
);
const
extHostDiagnostics
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDiagnostics
,
new
ExtHostDiagnostics
(
rpcProtocol
));
const
extHostLanguageFeatures
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostLanguageFeatures
,
new
ExtHostLanguageFeatures
(
rpcProtocol
,
schemeTransformer
,
extHostDocuments
,
extHostCommands
,
extHostHeapService
,
extHostDiagnostics
));
...
...
@@ -120,6 +119,7 @@ export function createApiFactory(
const
extHostFileSystemEvent
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostFileSystemEventService
,
new
ExtHostFileSystemEventService
());
const
extHostQuickOpen
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostQuickOpen
,
new
ExtHostQuickOpen
(
rpcProtocol
,
extHostWorkspace
,
extHostCommands
));
const
extHostTerminalService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostTerminalService
,
new
ExtHostTerminalService
(
rpcProtocol
,
extHostConfiguration
,
extHostLogService
));
const
extHostDebugService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDebugService
,
new
ExtHostDebugService
(
rpcProtocol
,
extHostWorkspace
,
extensionService
,
extHostDocumentsAndEditors
,
extHostConfiguration
,
extHostTerminalService
));
const
extHostSCM
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostSCM
,
new
ExtHostSCM
(
rpcProtocol
,
extHostCommands
,
extHostLogService
));
const
extHostSearch
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostSearch
,
new
ExtHostSearch
(
rpcProtocol
,
schemeTransformer
));
const
extHostTask
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostTask
,
new
ExtHostTask
(
rpcProtocol
,
extHostWorkspace
,
extHostDocumentsAndEditors
,
extHostConfiguration
));
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
2613d48d
...
...
@@ -839,8 +839,6 @@ export interface ISourceMultiBreakpointDto {
export
interface
ExtHostDebugServiceShape
{
$substituteVariables
(
folder
:
UriComponents
|
undefined
,
config
:
IConfig
):
TPromise
<
IConfig
>
;
$runInTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
;
$isTerminalBusy
(
processId
:
number
):
TPromise
<
boolean
>
;
$prepareCommandForTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
any
>
;
$startDASession
(
handle
:
number
,
debugType
:
string
,
adapterExecutableInfo
:
IAdapterExecutable
|
null
,
debugPort
:
number
):
TPromise
<
void
>
;
$stopDASession
(
handle
:
number
):
TPromise
<
void
>
;
$sendDAMessage
(
handle
:
number
,
message
:
DebugProtocol
.
ProtocolMessage
):
TPromise
<
void
>
;
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
2613d48d
...
...
@@ -10,6 +10,7 @@ import URI, { UriComponents } from 'vs/base/common/uri';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
MainContext
,
MainThreadDebugServiceShape
,
ExtHostDebugServiceShape
,
DebugSessionUUID
,
IMainContext
,
IBreakpointsDeltaDto
,
ISourceMultiBreakpointDto
,
IFunctionBreakpointDto
...
...
@@ -29,6 +30,8 @@ import { IStringDictionary } from 'vs/base/common/collections';
import
{
ExtHostConfiguration
}
from
'
./extHostConfiguration
'
;
import
{
convertToVSCPaths
,
convertToDAPaths
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
import
{
ExtHostTerminalService
}
from
'
vs/workbench/api/node/extHostTerminalService
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
class
ExtHostDebugService
implements
ExtHostDebugServiceShape
{
...
...
@@ -66,12 +69,16 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
private
_variableResolver
:
IConfigurationResolverService
;
private
_integratedTerminalInstance
:
vscode
.
Terminal
;
private
_terminalDisposedListener
:
IDisposable
;
constructor
(
mainContext
:
IMainContext
,
private
_workspaceService
:
ExtHostWorkspace
,
private
_extensionService
:
ExtHostExtensionService
,
private
_editorsService
:
ExtHostDocumentsAndEditors
,
private
_configurationService
:
ExtHostConfiguration
private
_configurationService
:
ExtHostConfiguration
,
private
_terminalService
:
ExtHostTerminalService
)
{
this
.
_handleCounter
=
0
;
...
...
@@ -117,20 +124,43 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}
}
public
$runInTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
{
const
terminalLauncher
=
getTerminalLauncher
();
if
(
terminalLauncher
)
{
return
terminalLauncher
.
runInTerminal
(
args
,
config
);
}
return
void
0
;
}
public
async
$runInTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
{
public
$isTerminalBusy
(
processId
:
number
):
TPromise
<
boolean
>
{
return
asWinJsPromise
(
token
=>
hasChildprocesses
(
processId
));
}
if
(
args
.
kind
===
'
integrated
'
)
{
if
(
!
this
.
_terminalDisposedListener
)
{
// React on terminal disposed and check if that is the debug terminal #12956
this
.
_terminalDisposedListener
=
this
.
_terminalService
.
onDidCloseTerminal
(
terminal
=>
{
if
(
this
.
_integratedTerminalInstance
&&
this
.
_integratedTerminalInstance
===
terminal
)
{
this
.
_integratedTerminalInstance
=
null
;
}
});
}
public
$prepareCommandForTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
any
>
{
return
asWinJsPromise
(
token
=>
prepareCommand
(
args
,
config
));
let
t
=
this
.
_integratedTerminalInstance
;
if
((
t
&&
hasChildprocesses
(
await
t
.
processId
))
||
!
t
)
{
t
=
this
.
_terminalService
.
createTerminal
(
args
.
title
||
nls
.
localize
(
'
debug.terminal.title
'
,
"
debuggee
"
));
this
.
_integratedTerminalInstance
=
t
;
}
t
.
show
();
return
new
TPromise
((
resolve
,
error
)
=>
{
setTimeout
(
_
=>
{
const
command
=
prepareCommand
(
args
,
config
);
t
.
sendText
(
command
,
true
);
resolve
(
void
0
);
},
500
);
});
}
else
if
(
args
.
kind
===
'
external
'
)
{
const
terminalLauncher
=
getTerminalLauncher
();
if
(
terminalLauncher
)
{
return
terminalLauncher
.
runInTerminal
(
args
,
config
);
}
}
return
void
0
;
}
public
$substituteVariables
(
folderUri
:
UriComponents
|
undefined
,
config
:
IConfig
):
TPromise
<
IConfig
>
{
...
...
src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts
浏览文件 @
2613d48d
...
...
@@ -11,18 +11,21 @@ import { ITerminalService as IExternalTerminalService } from 'vs/workbench/parts
import
{
ITerminalLauncher
,
ITerminalSettings
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
hasChildprocesses
,
prepareCommand
}
from
'
vs/workbench/parts/debug/node/terminals
'
;
export
class
Abstract
TerminalLauncher
implements
ITerminalLauncher
{
export
class
TerminalLauncher
implements
ITerminalLauncher
{
private
integratedTerminalInstance
:
ITerminalInstance
;
private
terminalDisposedListener
:
IDisposable
;
constructor
(
private
terminalService
:
ITerminalService
)
{
constructor
(
@
ITerminalService
private
terminalService
:
ITerminalService
,
@
IExternalTerminalService
private
nativeTerminalService
:
IExternalTerminalService
)
{
}
async
runInTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
{
if
(
args
.
kind
===
'
external
'
)
{
return
this
.
runInExternalTerminal
(
args
,
config
);
return
this
.
nativeTerminalService
.
runInTerminal
(
args
.
title
,
args
.
cwd
,
args
.
args
,
args
.
env
||
{}
);
}
if
(
!
this
.
terminalDisposedListener
)
{
...
...
@@ -35,46 +38,19 @@ export class AbstractTerminalLauncher implements ITerminalLauncher {
}
let
t
=
this
.
integratedTerminalInstance
;
if
((
t
&&
await
this
.
isBusy
(
t
.
processId
))
||
!
t
)
{
if
((
t
&&
hasChildprocesses
(
t
.
processId
))
||
!
t
)
{
t
=
this
.
terminalService
.
createTerminal
({
name
:
args
.
title
||
nls
.
localize
(
'
debug.terminal.title
'
,
"
debuggee
"
)
});
this
.
integratedTerminalInstance
=
t
;
}
this
.
terminalService
.
setActiveInstance
(
t
);
this
.
terminalService
.
showPanel
(
true
);
const
command
=
await
this
.
prepareCommand
(
args
,
config
);
return
new
TPromise
((
resolve
,
error
)
=>
{
setTimeout
(
_
=>
{
const
command
=
prepareCommand
(
args
,
config
);
t
.
sendText
(
command
,
true
);
resolve
(
void
0
);
},
500
);
});
}
protected
runInExternalTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
{
return
void
0
;
}
protected
isBusy
(
processId
:
number
):
TPromise
<
boolean
>
{
return
TPromise
.
as
(
hasChildprocesses
(
processId
));
}
protected
prepareCommand
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
string
>
{
return
TPromise
.
as
(
prepareCommand
(
args
,
config
));
}
}
export
class
TerminalLauncher
extends
AbstractTerminalLauncher
{
constructor
(
@
ITerminalService
terminalService
:
ITerminalService
,
@
IExternalTerminalService
private
nativeTerminalService
:
IExternalTerminalService
)
{
super
(
terminalService
);
}
runInExternalTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
{
return
this
.
nativeTerminalService
.
runInTerminal
(
args
.
title
,
args
.
cwd
,
args
.
args
,
args
.
env
||
{});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录